Thread (117 messages) 117 messages, 11 authors, 2021-11-03

Re: [dpdk-dev] [PATCH] Enable AddressSanitizer feature on DPDK

From: David Marchand <hidden>
Date: 2021-09-21 08:29:54

On Mon, Sep 20, 2021 at 9:41 PM David Christensen
[off-list ref] wrote:
quoted
quoted
quoted
We do not have a ppc platform, so there is no adaptation.
doc/guides/prog_guide/asan.rst has stated that we currently only
support Linux x86_64. You can adapt according to the following documents,
the main work is to modify the base address according to the platform.
quoted
Documents:
https://github.com/google/sanitizers/wiki/AddressSanitizer
https://github.com/llvm/llvm-project/tree/main/compiler-rt
Understand you don't have such a platform.  I looked into it and suggest the
following change in lib/eal/common/malloc_elem.h:

#define ASAN_SHADOW_GRAIN_SIZE  8
#define ASAN_SHADOW_SCALE       3
#ifdef RTE_ARCH_PPC_64
#define ASAN_SHADOW_OFFSET 0x020000000000 #else #define
ASAN_SHADOW_OFFSET 0x00007fff8000 #endif
#define ASAN_MEM_FREE_FLAG      0xfd
#define ASAN_MEM_REDZONE_FLAG   0xfa
#define ASAN_MEM_TO_SHADOW(mem) (((mem) >>
ASAN_SHADOW_SCALE) +
ASAN_SHADOW_OFFSET)


This resolves the segmentation error I receive.

Dave
Great, good information for dpdk asan tool. Because we can't do many tests,
so when this patch is merged into the main line, you can submit the ppc
architecture patch.
If your argument is that this is x86 only then please ensure it can't be
enabled on non-x86 platforms such as ARM and PPC.  I can then easily
submit a follow-on patch to enable for PPC.

As the patch currently stands it enables ASAN on a non-tested platform
and provides an unexpected error for some users when it can easily be
avoided.  I'd advise not accepting the patch as currently presented.
Please make sure only x86_64 gets this code enabled.
I'll wait for a new revision, thanks.


-- 
David Marchand
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help