[vpp-dev] Unable to run VPP with ASAN enabled

2021-06-15 Thread jiangxiaoming
Hi experts,
Here is an ASAN error when run vpp with ASAN enabled.

> 
> [root@localhost vpp]# make
> VPP_EXTRA_CMAKE_ARGS=-DVPP_ENABLE_SANITIZE_ADDR=ON build& debug
> make[1]: Entering directory `/home/dev/code/vpp/build-root'
>  Arch for platform 'vpp' is native 
>  Finding source for external 
>  Makefile fragment found in
> /home/dev/code/vpp/build-data/packages/external.mk 
>  Source found in /home/dev/code/vpp/build 
>  Arch for platform 'vpp' is native 
>  Finding source for vpp 
>  Makefile fragment found in
> /home/dev/code/vpp/build-data/packages/vpp.mk 
>  Source found in /home/dev/code/vpp/src 
>  Configuring external: nothing to do 
>  Building external: nothing to do 
>  Installing external: nothing to do 
>  Configuring vpp: nothing to do 
>  Building vpp: nothing to do 
>  Installing vpp: nothing to do 
> make[1]: Leaving directory `/home/dev/code/vpp/build-root'
> WARNING: STARTUP_CONF not defined or file doesn't exist.
> Running with minimal startup config:  unix { interactive cli-listen
> /run/vpp/cli.sock gid 0 } dpdk { no-pci } \n
> GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> 
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> 
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> ...
> Reading symbols from
> /home/dev/code/vpp/build-root/install-vpp_debug-native/vpp/bin/vpp...done.
> 
> Signal        Stop      Print   Pass to program Description
> SIGUSR1       No        No      Yes             User defined signal 1
> (gdb) r
> Starting program:
> /home/dev/code/vpp/build-root/install-vpp_debug-native/vpp/bin/vpp \ unix\
> \{\ interactive\ cli-listen\ /run/vpp/cli.sock\ gid\ 0\ \ \}\ \ dpdk \{
> no-pci \}\ \
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> =
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x773de5c1 in __asan::FakeStack::AddrIsInFakeStack(unsigned long,
> unsigned long*, unsigned long*) () from /lib64/libasan.so.5
> Missing separate debuginfos, use: debuginfo-install
> libasan5-9.3.1-2.el7.x86_64 libgcc-4.8.5-44.el7.x86_64
> libstdc++-4.8.5-44.el7.x86_64 libuuid-2.23.2-65.el7_9.1.x86_64
> mbedtls-2.7.17-1.el7.x86_64 numactl-libs-2.0.12-5.el7.x86_64
> pkcs11-helper-1.11-3.el7.x86_64
> (gdb) bt
> #0  0x773de5c1 in __asan::FakeStack::AddrIsInFakeStack(unsigned
> long, unsigned long*, unsigned long*) () from /lib64/libasan.so.5
> #1  0x774c5a11 in
> __asan::ThreadStackContainsAddress(__sanitizer::ThreadContextBase*, void*)
> () from /lib64/libasan.so.5
> #2  0x774dfdc2 in
> __sanitizer::ThreadRegistry::FindThreadContextLocked(bool
> (*)(__sanitizer::ThreadContextBase*, void*), void*) ()
> from /lib64/libasan.so.5
> #3  0x774c6e5a in __asan::FindThreadByStackAddress(unsigned long)
> () from /lib64/libasan.so.5
> #4  0x773d8fb6 in __asan::GetStackAddressInformation(unsigned
> long, unsigned long, __asan::StackAddressDescription*) ()
> from /lib64/libasan.so.5
> #5  0x773da3f9 in
> __asan::AddressDescription::AddressDescription(unsigned long, unsigned
> long, bool) () from /lib64/libasan.so.5
> #6  0x773dce51 in __asan::ErrorGeneric::ErrorGeneric(unsigned int,
> unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned
> long) () from /lib64/libasan.so.5
> #7  0x774c0c2a in __asan::ReportGenericError(unsigned long,
> unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned
> int, bool) () from /lib64/libasan.so.5
> #8  0x77411f9c in __interceptor_strlen.part.0 () from
> /lib64/libasan.so.5
> #9  0x7376e2ec in string_key_sum (h=0x7fffb5c89550,
> key=140736179430656) at /home/dev/code/vpp/src/vppinfra/hash.c:947
> #10 0x7376af15 in key_sum (h=0x7fffb5c89550, key=140736179430656)
> at /home/dev/code/vpp/src/vppinfra/hash.c:333
> #11 0x7376bf76 in lookup (v=0x7fffb5c89598, key=140736179430656,
> op=GET, new_value=0x0, old_value=0x0)
> at /home/dev/code/vpp/src/vppinfra/hash.c:557
> #12 0x7376c59d in _hash_get_pair (v=0x7fffb5c89598,
> key=140736179430656) at /home/dev/code/vpp/src/vppinfra/hash.c:653
> #13 0x0042e885 in lookup_hash_index (name=0x7fffb1fb6500
> "/mem/stat segment") at /home/dev/code/vpp/src/vpp/stats/stat_segment.c:69
> 
> #14 0x00431790 in stat_segment_new_entry (name=0x7fffb1fb6500
> "/mem/stat segment", t=STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE)
> at /home/dev/code/vpp/src/vpp/stats/stat_segment.c:402

Re: [vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-27 Thread Benoit Ganne (bganne) via lists.fd.io
Hi Rajith,

> The problem seems to be due to external libraries that we have linked with
> VPP. These external libraries have not been compiled with ASAN.
> I could see that when those external libraries were suppressed through the
> MyASAN.supp file, VPP started running with ASAN enabled.

This is surprising because the default policy of ASan is to allow access to any 
memory by default - IOW ASan will not detect access memory errors *unless* this 
memory address was *explicitly* marked as unaccessible. ASan interpose malloc() 
etc. symbols so libc allocations are automatically marked as 
accessible/unaccessible by the ASan runtime, and VPP does the same for its own 
memory allocator.
Of course there might still be false positive but in my experience they are 
usually rare. 

Best
ben

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19486): https://lists.fd.io/g/vpp-dev/message/19486
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-27 Thread Rajith PR via lists.fd.io
Hi Ben,

The problem seems to be due to external libraries that we have linked with
VPP. These external libraries have not been compiled with ASAN.
I could see that when those external libraries were suppressed through the
MyASAN.supp file, VPP started running with ASAN enabled.

Thanks,
Rajith

On Wed, May 26, 2021 at 2:25 PM Benoit Ganne (bganne) 
wrote:

> Hi Rajith,
>
> > I was able to proceed further after setting LD_PRELOAD to the asan
> > library. After this i get SIGSEGV crash in asan. These dont seem to be
> > related to our code, as without ASAN they have been perfectly working.
>
> I suspect the opposite  - ASan detects errors we do not detect in
> release or debug mode, esp. out-of-bound access and use-after-free. Look
> carefully at /home/supervisor/libvpp/src/vpp/rtbrick/rtb_vpp_ifp.c:287
>
> Best
> ben
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19484): https://lists.fd.io/g/vpp-dev/message/19484
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-26 Thread Benoit Ganne (bganne) via lists.fd.io
Hi Rajith,

> I was able to proceed further after setting LD_PRELOAD to the asan
> library. After this i get SIGSEGV crash in asan. These dont seem to be
> related to our code, as without ASAN they have been perfectly working.

I suspect the opposite  - ASan detects errors we do not detect in release or 
debug mode, esp. out-of-bound access and use-after-free. Look carefully at 
/home/supervisor/libvpp/src/vpp/rtbrick/rtb_vpp_ifp.c:287

Best
ben

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19471): https://lists.fd.io/g/vpp-dev/message/19471
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-25 Thread Rajith PR via lists.fd.io
 in qb_loop_run_level (level=level@entry=0x611000b0)
at /development/rtbrick-infrastructure/code/qb/lib/loop.c:43
#33 0x766bf54c in qb_loop_run (lp=) at
/development/rtbrick-infrastructure/code/qb/lib/loop.c:210
#34 0x766cb19a in lib_qb_service_start_event_loop () at
/development/rtbrick-infrastructure/code/qb/lib/wrapper/lib_qb_service.c:257
#35 0x502d in main (argc=3, argv=) at
/development/rtbrick-infrastructure/code/bd/src/bd/bd_main.c:136

Thanks,
Rajith



On Tue, May 25, 2021 at 3:10 PM Benoit Ganne (bganne) 
wrote:

> How are you starting VPP? If this is through 'make test' then chances are
> the culprit is the interaction of asan, clang and python [1].
> The easy way to fix is to rebuild with gcc instead of clang, eg.
> ~# make rebuild VPP_EXTRA_CMAKE_ARGS=-DVPP_ENABLE_SANITIZE_ADDR=ON CC=gcc-9
>
> Best
> ben
>
> [1]
> https://gerrit.fd.io/r/c/vpp/+/27268/3/src/vpp-api/python/vpp_papi/vpp_ffi.py.in#1
>
> > -Original Message-
> > From: vpp-dev@lists.fd.io  On Behalf Of Rajith PR
> via
> > lists.fd.io
> > Sent: mardi 25 mai 2021 09:51
> > To: vpp-dev 
> > Subject: [vpp-dev]: Unable to run VPP with ASAN enabled
> >
> > Hi All,
> >
> > I am not able to run VPP with ASAN. Though we have been using VPP for
> > sometime this is the first time we enabled ASAN in the build.
> > I have followed the steps as mentioned in the sanitizer doc, can someone
> > please let me know what is missed here.
> >
> > Run Time Error(Missing symbol):
> >
> > /usr/local/lib/librtbvpp.so:/home/supervisor/libvpp/build-root/install-
> > vpp_debug-native/vpp/lib/libvppinfra.so.1.0.1: undefined symbol:
> > __asan_option_detect_stack_use_after_return
> >
> >
> > VPP Version : 20.09
> >
> >
> > Build Command : make rebuild VPP_EXTRA_CMAKE_ARGS=-
> > DVPP_ENABLE_SANITIZE_ADDR=ON
> >
> >
> > Build Summary :
> >
> > VPP version : 1.0.1-3032~g4b28254fc-dirty
> > VPP library version : 1.0.1
> > GIT toplevel dir: /home/supervisor/libvpp
> > Build type  : debug
> > C flags : -fsanitize=address -DCLIB_SANITIZE_ADDR -Wno-
> > address-of-packed-member -g -fPIC -Werror -Wall -march=corei7 -
> > mtune=corei7-avx -O0 -DCLIB_DEBUG -fstack-protector -DFORTIFY_SOURCE=2 -
> > fno-common
> > Linker flags (apps) : -fsanitize=address
> > Linker flags (libs) : -fsanitize=address
> > Host processor  : x86_64
> > Target processor: x86_64
> > Prefix path :
> > /opt/vpp/external/x86_64;/home/supervisor/libvpp/build-root/install-
> > vpp_debug-native/external
> > Install prefix  : /home/supervisor/libvpp/build-root/install-
> > vpp_debug-native/vpp
> >
> >
> >
> > Reference : https://fd.io/docs/vpp/master/troubleshooting/sanitizer.html
> >
> >
> > Thanks,
> > Rajith
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19462): https://lists.fd.io/g/vpp-dev/message/19462
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-25 Thread Benoit Ganne (bganne) via lists.fd.io
How are you starting VPP? If this is through 'make test' then chances are the 
culprit is the interaction of asan, clang and python [1].
The easy way to fix is to rebuild with gcc instead of clang, eg.
~# make rebuild VPP_EXTRA_CMAKE_ARGS=-DVPP_ENABLE_SANITIZE_ADDR=ON CC=gcc-9

Best
ben

[1] 
https://gerrit.fd.io/r/c/vpp/+/27268/3/src/vpp-api/python/vpp_papi/vpp_ffi.py.in#1

> -Original Message-
> From: vpp-dev@lists.fd.io  On Behalf Of Rajith PR via
> lists.fd.io
> Sent: mardi 25 mai 2021 09:51
> To: vpp-dev 
> Subject: [vpp-dev]: Unable to run VPP with ASAN enabled
> 
> Hi All,
> 
> I am not able to run VPP with ASAN. Though we have been using VPP for
> sometime this is the first time we enabled ASAN in the build.
> I have followed the steps as mentioned in the sanitizer doc, can someone
> please let me know what is missed here.
> 
> Run Time Error(Missing symbol):
> 
> /usr/local/lib/librtbvpp.so:/home/supervisor/libvpp/build-root/install-
> vpp_debug-native/vpp/lib/libvppinfra.so.1.0.1: undefined symbol:
> __asan_option_detect_stack_use_after_return
> 
> 
> VPP Version : 20.09
> 
> 
> Build Command : make rebuild VPP_EXTRA_CMAKE_ARGS=-
> DVPP_ENABLE_SANITIZE_ADDR=ON
> 
> 
> Build Summary :
> 
> VPP version : 1.0.1-3032~g4b28254fc-dirty
> VPP library version : 1.0.1
> GIT toplevel dir: /home/supervisor/libvpp
> Build type  : debug
> C flags : -fsanitize=address -DCLIB_SANITIZE_ADDR -Wno-
> address-of-packed-member -g -fPIC -Werror -Wall -march=corei7 -
> mtune=corei7-avx -O0 -DCLIB_DEBUG -fstack-protector -DFORTIFY_SOURCE=2 -
> fno-common
> Linker flags (apps) : -fsanitize=address
> Linker flags (libs) : -fsanitize=address
> Host processor  : x86_64
> Target processor: x86_64
> Prefix path :
> /opt/vpp/external/x86_64;/home/supervisor/libvpp/build-root/install-
> vpp_debug-native/external
> Install prefix  : /home/supervisor/libvpp/build-root/install-
> vpp_debug-native/vpp
> 
> 
> 
> Reference : https://fd.io/docs/vpp/master/troubleshooting/sanitizer.html
> 
> 
> Thanks,
> Rajith

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19452): https://lists.fd.io/g/vpp-dev/message/19452
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev]: Unable to run VPP with ASAN enabled

2021-05-25 Thread Rajith PR via lists.fd.io
Hi All,

I am not able to run VPP with ASAN. Though we have been using VPP for
sometime this is the first time we enabled ASAN in the build.
I have followed the steps as mentioned in the sanitizer doc, can someone
please let me know what is missed here.

*Run Time Error(Missing symbol):*

/usr/local/lib/librtbvpp.so:/home/supervisor/libvpp/build-root/install-vpp_debug-native/vpp/lib/libvppinfra.so.1.0.1:
undefined symbol: __asan_option_detect_stack_use_after_return

*VPP Version* : 20.09

*Build Command* : make rebuild VPP_EXTRA_CMAKE_ARGS=
-DVPP_ENABLE_SANITIZE_ADDR=ON

*Build Summary *:

VPP version : 1.0.1-3032~g4b28254fc-dirty
VPP library version : 1.0.1
GIT toplevel dir: /home/supervisor/libvpp
Build type  : debug
C flags : -fsanitize=address -DCLIB_SANITIZE_ADDR
-Wno-address-of-packed-member -g -fPIC -Werror -Wall -march=corei7
-mtune=corei7-avx -O0 -DCLIB_DEBUG -fstack-protector -DFORTIFY_SOURCE=2
-fno-common
Linker flags (apps) : -fsanitize=address
Linker flags (libs) : -fsanitize=address
Host processor  : x86_64
Target processor: x86_64
Prefix path :
/opt/vpp/external/x86_64;/home/supervisor/libvpp/build-root/install-vpp_debug-native/external
Install prefix  :
/home/supervisor/libvpp/build-root/install-vpp_debug-native/vpp

*Reference *: https://fd.io/docs/vpp/master/troubleshooting/sanitizer.html

Thanks,
Rajith

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19450): https://lists.fd.io/g/vpp-dev/message/19450
Mute This Topic: https://lists.fd.io/mt/83071228/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-