Thread (23 messages) 23 messages, 9 authors, 2021-07-06

Re: [dpdk-dev] [RFC] porting AddressSanitizer feature to DPDK

From: Lin, Xueqin <hidden>
Date: 2021-06-11 04:42:47

-----Original Message-----
From: Richardson, Bruce <redacted>
Sent: Thursday, June 10, 2021 4:33 PM
To: Peng, ZhihongX <redacted>
Cc: Burakov, Anatoly <redacted>;
stephen@networkplumber.org; dev@dpdk.org; Lin, Xueqin
[off-list ref]
Subject: Re: [dpdk-dev] [RFC] porting AddressSanitizer feature to DPDK

On Thu, Jun 10, 2021 at 01:13:52PM +0800, zhihongx.peng@intel.com wrote:
quoted
From: Zhihong Peng <redacted>

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:
-Dc_args='-DRTE_MALLOC_ASAN'
-Db_lundef=false -Db_sanitize=address
Rather than forcing the user to pass in the extra c_args, you can
automatically add it from the eal/meson.build files. Something like:

if get_option('b_sanitize').startswith('address'):
	cflags += '-DRTE_MALLOC_ASAN'
endif

/Bruce
Thanks Bruce for your review, really good suggestion for this part optimization, we will update it. 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help