On 30-Sep-21 1:59 PM, [email protected] wrote:
From: Zhihong Peng <[email protected]>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. `AddressSanitizer <https://github.com/google/sanitizers/wiki/AddressSanitizer>` (ASan) is a widely-used debugging tool to detect memory access errors. It helps detect issues like use-after-free, various kinds of buffer overruns in C/C++ programs, and other similar errors, as well as printing out detailed debug information whenever an error is detected. DPDK ASan functionality is currently only supported Linux x86_64. Support other platforms, need to define ASAN_SHADOW_OFFSET value according to google ASan document. 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 add below compilation options when compiling code: -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address "-Dbuildtype=debug": This is a non-essential option. When this option is added, if a memory error occurs, ASan can clearly show where the code is wrong. "-Db_lundef=false": When use clang to compile DPDK, this option must be added. Signed-off-by: Xueqin Lin <[email protected]> Signed-off-by: Zhihong Peng <[email protected]> ---
Acked-by: Anatoly Burakov <[email protected]> -- Thanks, Anatoly

