[dpdk-dev] [PATCH] Enable AddressSanitizer feature on DPDK
David Marchand
david.marchand at redhat.com
Tue Sep 21 10:29:31 CEST 2021
On Mon, Sep 20, 2021 at 9:41 PM David Christensen
<drc at linux.vnet.ibm.com> wrote:
> >>> 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.
> >>> 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
More information about the dev
mailing list