]> git.droids-corp.org - dpdk.git/commitdiff
eal/arm64: support ASan
authorVolodymyr Fialko <vfialko@marvell.com>
Tue, 9 Nov 2021 09:59:52 +0000 (10:59 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 12 Nov 2021 14:30:00 +0000 (15:30 +0100)
This patch defines ASAN_SHADOW_OFFSET for arm64 according to the ASan
documentation. This offset should cover all arm64 VMAs supported by
ASan.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
config/meson.build
doc/guides/prog_guide/asan.rst
lib/eal/common/malloc_elem.h

index 5926892a68ea0a24644fbf44216ff73201c009e7..3f5912fce7a4e71ae9ca121ca61dd6d85e372b8b 100644 (file)
@@ -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 == 'x86' and dpdk_conf.get('RTE_ARCH_64')
+    if is_linux and arch_subdir in ['x86', 'arm'] and dpdk_conf.get('RTE_ARCH_64')
         dpdk_conf.set10('RTE_MALLOC_ASAN', true)
     endif
 endif
index 6d1b871c93a64d96959bb142ea80da50fb91d4a2..28b2382fc7e3f17b0a38a2c01a8880e7a17b8578 100644 (file)
@@ -33,7 +33,7 @@ Example::
     "stty echo" command when an error occurs.
 
 ASan is aware of DPDK memory allocations, thanks to added instrumentation.
-This is only enabled on x86_64 at the moment.
+This is enabled on x86_64 and arm64 at the moment.
 Other architectures may have to define ASAN_SHADOW_OFFSET.
 
 Example heap-buffer-overflow error
index 262d69bb3ed07ec421974571e310cd7ea5a5eb04..b982c83f70f4beef014b4d3ca1b5573cbdf7f16e 100644 (file)
@@ -104,8 +104,14 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem)
 
 #ifdef RTE_MALLOC_ASAN
 
+/*
+ * ASAN_SHADOW_OFFSET should match to the corresponding
+ * value defined in gcc/libsanitizer/asan/asan_mapping.h
+ */
 #ifdef RTE_ARCH_X86_64
 #define ASAN_SHADOW_OFFSET    0x00007fff8000
+#elif defined(RTE_ARCH_ARM64)
+#define ASAN_SHADOW_OFFSET    0x001000000000
 #endif
 
 #define ASAN_SHADOW_GRAIN_SIZE 8