[dpdk-dev] [RFC] porting AddressSanitizer feature to DPDK
Lin, Xueqin
xueqin.lin at intel.com
Fri Jun 11 06:42:37 CEST 2021
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson at intel.com>
> Sent: Thursday, June 10, 2021 4:33 PM
> To: Peng, ZhihongX <zhihongx.peng at intel.com>
> Cc: Burakov, Anatoly <anatoly.burakov at intel.com>;
> stephen at networkplumber.org; dev at dpdk.org; Lin, Xueqin
> <xueqin.lin at intel.com>
> Subject: Re: [dpdk-dev] [RFC] porting AddressSanitizer feature to DPDK
>
> On Thu, Jun 10, 2021 at 01:13:52PM +0800, zhihongx.peng at intel.com wrote:
> > From: Zhihong Peng <zhihongx.peng at 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:
> > -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.
More information about the dev
mailing list