[dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on DPDK

David Marchand david.marchand at redhat.com
Fri Oct 8 10:30:05 CEST 2021


On Fri, Oct 8, 2021 at 10:07 AM Peng, ZhihongX <zhihongx.peng at intel.com> wrote:
>
> > -----Original Message-----
> > From: David Marchand <david.marchand at redhat.com>
> > Sent: Thursday, September 30, 2021 4:20 PM
> > To: Peng, ZhihongX <ZhihongX.Peng at intel.com>; Richardson, Bruce
> > <bruce.richardson at intel.com>
> > Cc: Burakov, Anatoly <anatoly.burakov at intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev at intel.com>; Stephen Hemminger
> > <stephen at networkplumber.org>; dev <dev at dpdk.org>; Lin, Xueqin
> > <xueqin.lin at intel.com>; Thomas Monjalon <thomas at monjalon.net>
> > Subject: Re: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on
> > DPDK
> >
> > Hello,
> >
> > I see v6 is superseded in pw, I have been cleaning my queue... maybe my
> > fault.
> >

[snip]

> >
> V7 version will be modified.

Ok, let's forget about *v6 bis* and go with v7...


>
> > Something like (only quickly tested):
> >
> > diff --git a/config/meson.build b/config/meson.build index
> > 4cdf589e20..7d8b71da79 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -411,6 +411,33 @@ if get_option('b_lto')
> >      endif
> >  endif
> >
> > +if get_option('b_sanitize') == 'address'
> > +    asan_dep = cc.find_library('asan', required: true)
> > +    if (not cc.links('int main(int argc, char *argv[]) { return 0; }',
> > +                     dependencies: asan_dep))
> > +        error('broken dependency, "libasan"')
> > +    endif
> > +    add_project_link_arguments('-lasan', language: 'c')
> > +    dpdk_extra_ldflags += '-lasan'
> > +endif
> > +
> >  if get_option('default_library') == 'both'
> >      error( '''
> >   Unsupported value "both" for "default_library" option.
> >
> >
> > Bruce, do you see an issue with this approach?
>
> It seems clearer to get the ASan switch in the c code.

This is a feature the developper asked for at configuration time.
We have other condition to fulfill to get ASan linking correctly (wrt
lundef workaround and presence of libasan on Centos/RHEL 7).

It's not a matter of being clearer (which I fail to see how it is),
it's a matter of putting the check at the right place.


-- 
David Marchand



More information about the dev mailing list