2. AddressSanitizer Smoke Test¶
2.1. Description¶
AddressSanitizer (ASan) is a fast memory error detector,it is a widely-used debugging tool to detect memory access errors.
- AddressSanitizer<https://github.com/google/sanitizers/wiki/AddressSanitizer>
- It finds use-after-free, various kinds of buffer overruns in dpdk, and print out detailed debug information whenever an error is detected.
- ASan is integrated with gcc and clang, and use meson option ‘-Db_sanitize=address’ to enable.
2.2. Prerequisites¶
NIC requires:
- Intel ethernet cards: 82599/X710/XXV710/XL710/E810,etc
Software:
dpdk: http://dpdk.org/git/dpdk. scapy: http://www.secdev.org/projects/scapy/
2.3. Test Case: RX/TX test with ASan enable¶
Build dpdk with ASan tool, add “-Dbuildtype=debug -Db_lundef=false -Db_sanitize=address” in meson build system could enable ASan tool, such as below:
CC=gcc meson -Denable_kmods=True -Dlibdir=lib -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address --default-library=static x86_64-native-linuxapp-gcc ninja -C x86_64-native-linuxapp-gcc -j 70
Bind NIC port to vfio-pci.
Setup testpmd, check testpmd could launch successfully and don’t have “heap-buffer-overflow”, “use-after-free” memory errors.
Set mac forward mode.
Send packet and check testpmd forward packet successfully.