DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: David Christensen <drc@linux.vnet.ibm.com>
Cc: zhihongx.peng@intel.com, anatoly.burakov@intel.com,
	konstantin.ananyev@intel.com, dev@dpdk.org, xueqin.lin@intel.com
Subject: Re: [dpdk-dev] [RFC v2] porting AddressSanitizer feature to DPDK
Date: Tue, 6 Jul 2021 16:12:13 -0700	[thread overview]
Message-ID: <20210706161213.48249906@hermes.local> (raw)
In-Reply-To: <8eff3541-919d-37fe-76f9-1c4141b33af0@linux.vnet.ibm.com>

On Tue, 6 Jul 2021 13:40:56 -0700
David Christensen <drc@linux.vnet.ibm.com> wrote:

> On 6/15/21 1:12 AM, zhihongx.peng@intel.com wrote:
> > From: Zhihong Peng <zhihongx.peng@intel.com>
> > 
> > AddressSanitizer (ASan) is a google memory error detect
> > standard tool. It could help to detect use-after-free and
> > {heap,stack,global}-buffer overflow bugs in C/C++ programs,
> > print detailed error information when error happens, large
> > improve debug efficiency.
> > 
> > By referring to its implementation algorithm
> > (https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm),
> > ported heap-buffer-overflow and use-after-freefunctions to dpdk.
> > 
> > Here is an example of heap-buffer-overflow bug:
> > 	......
> >          char *p = rte_zmalloc(NULL, 7, 0);
> >          p[7] = 'a';
> > 	......
> > 
> > Here is an example of use-after-free bug:
> > 	......
> >          char *p = rte_zmalloc(NULL, 7, 0);
> >          rte_free(p);
> >          *p = 'a';
> > 	......
> > 
> > If you want to use this feature,
> > you need to use the following compilation options:
> > -Db_lundef=false -Db_sanitize=address  
> 
> Any library dependencies here that might be architecture specific?  I 
> applied the patch to a POWER9 system with RHEL 8.3 and observed a SEGV:
> 
> sudo /home/drc/src/dpdk/build/app/dpdk-testpmd -l 64-71 
> --vdev=net_memif0,role=server,id=0 --vdev=net_memif1,role=client,id=0 
> --no-pci -- -i --numa --port-numa-config=0,8,1,8 
> --ring-numa-config=0,3,8,1,3,8 --socket-num=8
> EAL: Detected 128 lcore(s)
> EAL: Detected 2 NUMA nodes
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> EAL: No available 1048576 kB hugepages reported
> EAL: VFIO support initialized
> AddressSanitizer:DEADLYSIGNAL
> =================================================================
> ==3011526==ERROR: AddressSanitizer: SEGV on unknown address 
> 0x0002a0177bd0 (pc 0x000011411ce0 bp 0x7fffccd738b0 sp 0x7fffccd738b0 T0)
> ==3011526==The signal is caused by a UNKNOWN memory access.
>      #0 0x11411cdc in asan_set_shadow.constprop.4 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11411cdc)
>      #1 0x114131ec in malloc_elem_alloc 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x114131ec)
>      #2 0x11416adc in heap_alloc.isra.1 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11416adc)
>      #3 0x11419570 in malloc_heap_alloc_on_heap_id.isra.5 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11419570)
>      #4 0x1141977c in malloc_heap_alloc 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x1141977c)
>      #5 0x11421794 in rte_malloc_socket 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11421794)
>      #6 0x11421e14 in rte_zmalloc_socket 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11421e14)
>      #7 0x11422250 in rte_zmalloc 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11422250)
>      #8 0x114222f4 in rte_calloc 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x114222f4)
>      #9 0x11428fa4 in rte_service_init 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11428fa4)
>      #10 0x11433680 in rte_eal_init 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11433680)
>      #11 0x1039a734 in main 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x1039a734)
>      #12 0x7fffa3664074 in generic_start_main ../csu/libc-start.c:308
>      #13 0x7fffa3664260 in __libc_start_main 
> ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:102
> 
> AddressSanitizer can not provide additional info.
> SUMMARY: AddressSanitizer: SEGV 
> (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11411cdc) in 
> asan_set_shadow.constprop.4
> ==3011526==ABORTING
> 
> Dave

ASAN says you should use -fno-omit-frame-pointer to get reasonable backtrace.

      reply	other threads:[~2021-07-06 23:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  5:13 [dpdk-dev] [RFC] " zhihongx.peng
2021-06-10  8:32 ` Bruce Richardson
2021-06-11  4:42   ` Lin, Xueqin
2021-06-10  9:12 ` Ananyev, Konstantin
2021-06-11  4:49   ` Lin, Xueqin
2021-06-10 20:03 ` Stephen Hemminger
2021-06-11  6:15   ` Lin, Xueqin
2021-06-15  8:12 ` [dpdk-dev] [RFC v2] " zhihongx.peng
2021-06-15  8:40   ` Jerin Jacob
2021-06-16  9:13     ` Lin, Xueqin
2021-06-16 11:34       ` Jerin Jacob
2021-06-18  7:48         ` Lin, Xueqin
2021-06-18  9:04           ` David Marchand
2021-06-22  3:26             ` Lin, Xueqin
2021-06-28 14:22             ` Burakov, Anatoly
2021-06-28 14:23               ` Jerin Jacob
2021-06-30  8:15               ` Lin, Xueqin
2021-06-30  8:34               ` David Marchand
2021-07-01  6:48                 ` Lin, Xueqin
2021-07-01  7:40                   ` David Marchand
2021-07-02 11:05                     ` Lin, Xueqin
2021-07-06 20:40   ` David Christensen
2021-07-06 23:12     ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706161213.48249906@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=xueqin.lin@intel.com \
    --cc=zhihongx.peng@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).