DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] eal/ppc: support ASan
@ 2021-11-15 18:41 David Christensen
  2021-11-15 20:10 ` David Marchand
  2021-11-15 21:38 ` [PATCH v2] " David Christensen
  0 siblings, 2 replies; 5+ messages in thread
From: David Christensen @ 2021-11-15 18:41 UTC (permalink / raw)
  To: Bruce Richardson, Anatoly Burakov; +Cc: dev, David Christensen

Add support for Address Sanitizer (ASan) for PPC/POWER architecture.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 config/meson.build             | 2 +-
 doc/guides/prog_guide/asan.rst | 4 ++--
 lib/eal/common/malloc_elem.h   | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 3f5912fce7..ba433af7d9 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -433,7 +433,7 @@ if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address
         dpdk_extra_ldflags += '-lasan'
     endif
 
-    if is_linux and arch_subdir in ['x86', 'arm'] and dpdk_conf.get('RTE_ARCH_64')
+    if is_linux and arch_subdir in ['x86', 'arm', 'ppc'] and dpdk_conf.get('RTE_ARCH_64')
         dpdk_conf.set10('RTE_MALLOC_ASAN', true)
     endif
 endif
diff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst
index 28b2382fc7..7c1b59cfea 100644
--- a/doc/guides/prog_guide/asan.rst
+++ b/doc/guides/prog_guide/asan.rst
@@ -32,8 +32,8 @@ Example::
   - If the program is tested using cmdline, you may need to execute the
     "stty echo" command when an error occurs.
 
-ASan is aware of DPDK memory allocations, thanks to added instrumentation.
-This is enabled on x86_64 and arm64 at the moment.
+ASan is aware of DPDK memory allocations, thanks to added instrumentation, and
+is enabled on x86_64, arm64, and PPC64 architectures.
 Other architectures may have to define ASAN_SHADOW_OFFSET.
 
 Example heap-buffer-overflow error
diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h
index b982c83f70..15d8ba7af2 100644
--- a/lib/eal/common/malloc_elem.h
+++ b/lib/eal/common/malloc_elem.h
@@ -112,6 +112,8 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem)
 #define ASAN_SHADOW_OFFSET    0x00007fff8000
 #elif defined(RTE_ARCH_ARM64)
 #define ASAN_SHADOW_OFFSET    0x001000000000
+#elif defined(RTE_ARCH_PPC_64)
+#define ASAN_SHADOW_OFFSET    0x020000000000
 #endif
 
 #define ASAN_SHADOW_GRAIN_SIZE	8
-- 
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eal/ppc: support ASan
  2021-11-15 18:41 [PATCH] eal/ppc: support ASan David Christensen
@ 2021-11-15 20:10 ` David Marchand
  2021-11-15 21:38 ` [PATCH v2] " David Christensen
  1 sibling, 0 replies; 5+ messages in thread
From: David Marchand @ 2021-11-15 20:10 UTC (permalink / raw)
  To: David Christensen; +Cc: Bruce Richardson, Anatoly Burakov, dev

On Mon, Nov 15, 2021 at 7:41 PM David Christensen
<drc@linux.vnet.ibm.com> wrote:
>
> Add support for Address Sanitizer (ASan) for PPC/POWER architecture.
>
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  config/meson.build             | 2 +-
>  doc/guides/prog_guide/asan.rst | 4 ++--
>  lib/eal/common/malloc_elem.h   | 2 ++
>  3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/config/meson.build b/config/meson.build
> index 3f5912fce7..ba433af7d9 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -433,7 +433,7 @@ if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address
>          dpdk_extra_ldflags += '-lasan'
>      endif
>
> -    if is_linux and arch_subdir in ['x86', 'arm'] and dpdk_conf.get('RTE_ARCH_64')
> +    if is_linux and arch_subdir in ['x86', 'arm', 'ppc'] and dpdk_conf.get('RTE_ARCH_64')

Now that all supported 64-bits arches can have ASan, we can remove the
check on arch_subdir.


>          dpdk_conf.set10('RTE_MALLOC_ASAN', true)
>      endif
>  endif
> diff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst
> index 28b2382fc7..7c1b59cfea 100644
> --- a/doc/guides/prog_guide/asan.rst
> +++ b/doc/guides/prog_guide/asan.rst
> @@ -32,8 +32,8 @@ Example::
>    - If the program is tested using cmdline, you may need to execute the
>      "stty echo" command when an error occurs.
>
> -ASan is aware of DPDK memory allocations, thanks to added instrumentation.
> -This is enabled on x86_64 and arm64 at the moment.
> +ASan is aware of DPDK memory allocations, thanks to added instrumentation, and
> +is enabled on x86_64, arm64, and PPC64 architectures.

is enabled for 64-bits architectures on Linux.



>  Other architectures may have to define ASAN_SHADOW_OFFSET.
>
>  Example heap-buffer-overflow error
> diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h
> index b982c83f70..15d8ba7af2 100644
> --- a/lib/eal/common/malloc_elem.h
> +++ b/lib/eal/common/malloc_elem.h
> @@ -112,6 +112,8 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem)
>  #define ASAN_SHADOW_OFFSET    0x00007fff8000
>  #elif defined(RTE_ARCH_ARM64)
>  #define ASAN_SHADOW_OFFSET    0x001000000000
> +#elif defined(RTE_ARCH_PPC_64)
> +#define ASAN_SHADOW_OFFSET    0x020000000000
>  #endif
>
>  #define ASAN_SHADOW_GRAIN_SIZE 8
> --
> 2.27.0
>

Thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] eal/ppc: support ASan
  2021-11-15 18:41 [PATCH] eal/ppc: support ASan David Christensen
  2021-11-15 20:10 ` David Marchand
@ 2021-11-15 21:38 ` David Christensen
  2021-11-16  8:42   ` David Marchand
  1 sibling, 1 reply; 5+ messages in thread
From: David Christensen @ 2021-11-15 21:38 UTC (permalink / raw)
  To: Bruce Richardson, Anatoly Burakov; +Cc: dev, David Christensen

Add support for Address Sanitizer (ASan) for PPC/POWER architecture.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
v2: Removed architecture test, modified programmer's guide text

 config/meson.build             | 2 +-
 doc/guides/prog_guide/asan.rst | 6 +++---
 lib/eal/common/malloc_elem.h   | 2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 3f5912fce7..805d5d51d0 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -433,7 +433,7 @@ if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address
         dpdk_extra_ldflags += '-lasan'
     endif

-    if is_linux and arch_subdir in ['x86', 'arm'] and dpdk_conf.get('RTE_ARCH_64')
+    if is_linux and dpdk_conf.get('RTE_ARCH_64')
         dpdk_conf.set10('RTE_MALLOC_ASAN', true)
     endif
 endif
diff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst
index 28b2382fc7..693fba36c8 100644
--- a/doc/guides/prog_guide/asan.rst
+++ b/doc/guides/prog_guide/asan.rst
@@ -32,9 +32,9 @@ Example::
   - If the program is tested using cmdline, you may need to execute the
     "stty echo" command when an error occurs.

-ASan is aware of DPDK memory allocations, thanks to added instrumentation.
-This is enabled on x86_64 and arm64 at the moment.
-Other architectures may have to define ASAN_SHADOW_OFFSET.
+ASan is aware of DPDK memory allocations, thanks to added instrumentation, and
+is enabled on all 64 bit architectures for Linux.  Other architectures may have
+to define ASAN_SHADOW_OFFSET.

 Example heap-buffer-overflow error
 ----------------------------------
diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h
index b982c83f70..15d8ba7af2 100644
--- a/lib/eal/common/malloc_elem.h
+++ b/lib/eal/common/malloc_elem.h
@@ -112,6 +112,8 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem)
 #define ASAN_SHADOW_OFFSET    0x00007fff8000
 #elif defined(RTE_ARCH_ARM64)
 #define ASAN_SHADOW_OFFSET    0x001000000000
+#elif defined(RTE_ARCH_PPC_64)
+#define ASAN_SHADOW_OFFSET    0x020000000000
 #endif

 #define ASAN_SHADOW_GRAIN_SIZE	8
--
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] eal/ppc: support ASan
  2021-11-15 21:38 ` [PATCH v2] " David Christensen
@ 2021-11-16  8:42   ` David Marchand
  2021-11-16 10:22     ` David Marchand
  0 siblings, 1 reply; 5+ messages in thread
From: David Marchand @ 2021-11-16  8:42 UTC (permalink / raw)
  To: David Christensen; +Cc: Bruce Richardson, Anatoly Burakov, dev

On Mon, Nov 15, 2021 at 10:39 PM David Christensen
<drc@linux.vnet.ibm.com> wrote:
>
> Add support for Address Sanitizer (ASan) for PPC/POWER architecture.
>
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] eal/ppc: support ASan
  2021-11-16  8:42   ` David Marchand
@ 2021-11-16 10:22     ` David Marchand
  0 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2021-11-16 10:22 UTC (permalink / raw)
  To: David Christensen; +Cc: Bruce Richardson, Anatoly Burakov, dev

On Tue, Nov 16, 2021 at 9:42 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Mon, Nov 15, 2021 at 10:39 PM David Christensen
> <drc@linux.vnet.ibm.com> wrote:
> >
> > Add support for Address Sanitizer (ASan) for PPC/POWER architecture.
> >
> > Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-16 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 18:41 [PATCH] eal/ppc: support ASan David Christensen
2021-11-15 20:10 ` David Marchand
2021-11-15 21:38 ` [PATCH v2] " David Christensen
2021-11-16  8:42   ` David Marchand
2021-11-16 10:22     ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).