> -----Original Message----- > From: Richardson, Bruce <bruce.richard...@intel.com> > Sent: Thursday, June 10, 2021 4:33 PM > To: Peng, ZhihongX <zhihongx.p...@intel.com> > Cc: Burakov, Anatoly <anatoly.bura...@intel.com>; > step...@networkplumber.org; dev@dpdk.org; Lin, Xueqin > <xueqin....@intel.com> > Subject: Re: [dpdk-dev] [RFC] porting AddressSanitizer feature to DPDK > > On Thu, Jun 10, 2021 at 01:13:52PM +0800, zhihongx.p...@intel.com wrote: > > From: Zhihong Peng <zhihongx.p...@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.