From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D5ED8A0C45;
	Tue, 14 Sep 2021 05:11:27 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 925B54068F;
	Tue, 14 Sep 2021 05:11:27 +0200 (CEST)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by mails.dpdk.org (Postfix) with ESMTP id B54B140151
 for <dev@dpdk.org>; Tue, 14 Sep 2021 05:11:26 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10106"; a="201368442"
X-IronPort-AV: E=Sophos;i="5.85,291,1624345200"; d="scan'208";a="201368442"
Received: from fmsmga007.fm.intel.com ([10.253.24.52])
 by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Sep 2021 20:11:25 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,291,1624345200"; d="scan'208";a="469888320"
Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86])
 by fmsmga007.fm.intel.com with ESMTP; 13 Sep 2021 20:11:25 -0700
Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by
 fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.12; Mon, 13 Sep 2021 20:11:24 -0700
Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by
 fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.12; Mon, 13 Sep 2021 20:11:24 -0700
Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by
 fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.12 via Frontend Transport; Mon, 13 Sep 2021 20:11:23 -0700
Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by
 edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2242.12; Mon, 13 Sep 2021 20:11:21 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=J1yUJpOdM2pUhhUPB5AMbl2SQy+gDe9OeBQo6rehpmIXxwxk8LX3lZWz0eC6ygSltBmGgUWAbM+hj1uO/FLAlpheVThPGroXNx09UBKJ62Bni6CAOacKE1VMbo/1OG6nM9WELhC+a1f5H7lkRRUslpt6aogh863WLbHTQ1IRNmxcSCIiYDgD5klXdgd9iSZLxor18P3es0xH+YeXwUBSaiYwYkDxyaCfAar9v9Nw0sHVCJxfs7ghMZ7x3Ws0nD9NFO/7nS0Dmw/pmobNB6Kc4ntjy2h1a6j/stGMiyrE0g56oTegicTR1dV3H7dp/8r7bWojFHg/Z/dqv93AHUfcSQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; 
 bh=2gbKcClYci/yWlVJt2RJ2k6Yv8AuWN9EwWSutVfKCgc=;
 b=azEYCr2BJUEBdqOXJaXwrEOMOO8iQfUNw9o3vmxy4dFAi6ePzoFIgfxEuMNctlCqnluce7gG8oAm5zS2ZdMGLubfo9E80tdAI9I8pUZ+oZwbSFp/D6ek6WRyKV+nDbZVx6vSjqQUOkIPZhQQtxMmzlMCv6i9YTjoE8TNau2UL9W4is61wiVOm0OUzNr5Fk28Q36uYrYpLaXuSIWzzZJUN7OfVi9wKbwmvmzJ1R2Gsh3C9PjjSknwmArauv6x3cnpi+BQWmFgSRnJnkMhVN8i/OoOijv490ByL7Juw3dM2ByKS5cPKxaHJKjh33SnZqiYMgdlarcXZVQJtFXnKChufg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=2gbKcClYci/yWlVJt2RJ2k6Yv8AuWN9EwWSutVfKCgc=;
 b=Ik2YKgHG3N1FW/Wn8ul1w7sDm457qRqVZj8WViFa2Bu2yHcKR2i2Wu/KRW6FO5Cjpd84wA6fAzZh4v/blJtc/zCYAQkEDynIMG2SQWnuhX6A2lMq4ucVfvHSKrEi2RJ32dEKto6mmTByg4m0vKQgJjxfdlWUJOi12NYKmSK/svE=
Received: from BN7PR11MB2658.namprd11.prod.outlook.com (52.135.255.16) by
 BN6PR11MB3985.namprd11.prod.outlook.com (10.255.129.78) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.4478.20; Tue, 14 Sep 2021 03:11:14 +0000
Received: from BN7PR11MB2658.namprd11.prod.outlook.com
 ([fe80::dc53:d62d:2e6:2ee9]) by BN7PR11MB2658.namprd11.prod.outlook.com
 ([fe80::dc53:d62d:2e6:2ee9%6]) with mapi id 15.20.4500.019; Tue, 14 Sep 2021
 03:11:13 +0000
From: "Lin, Xueqin" <xueqin.lin@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>, Stephen Hemminger
 <stephen@networkplumber.org>
CC: "Peng, ZhihongX" <zhihongx.peng@intel.com>, "Burakov, Anatoly"
 <anatoly.burakov@intel.com>, "Ananyev, Konstantin"
 <konstantin.ananyev@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH] Enable AddressSanitizer feature on DPDK
Thread-Index: AQHXpekaTx4zf/rx3E2NQ2B/S5A12KuckLEAgATjfwCAAKG0AIAABIqAgADEfKA=
Date: Tue, 14 Sep 2021 03:11:13 +0000
Message-ID: <BN7PR11MB2658E08B342D09C96A815E2F94DA9@BN7PR11MB2658.namprd11.prod.outlook.com>
References: <20210910020147.148019-1-zhihongx.peng@intel.com>
 <20210909194756.6addfe73@hermes.local>
 <DM8PR11MB5591B350A1576EC362877000F0D99@DM8PR11MB5591.namprd11.prod.outlook.com>
 <20210913080558.4a8b9ae4@hermes.local>
 <YT9spRF60/EKe/2S@bricha3-MOBL.ger.corp.intel.com>
In-Reply-To: <YT9spRF60/EKe/2S@bricha3-MOBL.ger.corp.intel.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-version: 11.6.200.16
dlp-reaction: no-action
dlp-product: dlpe-windows
authentication-results: intel.com; dkim=none (message not signed)
 header.d=none;intel.com; dmarc=none action=none header.from=intel.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 16b3fe7a-cdb8-44a4-e7f2-08d9772d4f6f
x-ms-traffictypediagnostic: BN6PR11MB3985:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BN6PR11MB3985D7BC8CE1FD4CBF762D6D94DA9@BN6PR11MB3985.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: CPf83P8Fl9UmXeej5A79+wHwOUDOSUvhxOkQ4FGU1iMcy3bkqdm1XUfB98hgrl0fhyuxuqgmOo7/tpLUmIFVxi8b6u/SK64jdc4XA2zpo37v4mpyqGaxPGQjqrEcHQSXgcoG5jpvc35hR63dZG+akVWWHcAGC/pByGAtVSrrI/p+FpdVTgj0qY9biJcZzdvvJ0enFoMgPrcPzd7OTnSpLOnn86N1cjErqzMWXLFjNr4M5ZnClF1CGa21Q+i31DHCFMhqv4/xplqFdH4J8Vy9sNDfwTAZnCofYgIxLmBMJUQeqHvllXfxnlLT2j6uIoOBe6imMWQSZapSS/PnP24D6LUujuQJ07Eq8HHjRIqQ1PNXK6POTRfP0iJsE2Ajg2Jtvwoq0BRhCW42jvyqHTwRStwdft3MIggTCBc1xdJ+e0N311L5aVmKLRmEXvu8gUzDkNG5JmjapoiU8S5DKxb71ESUl3vmtST+jnUGWmjQBjcBexW37qbxfX+3s2pLgRExU3dgKrRlN2j7wQPHlyBPTC2V1H3jeXKSi2awoBStVK0wtJMewHo0328XjTQE0/rgyZHq/wlBFphukTDTFmgbgjLoHxV6OGwmlV4cruxOm8ME+CqZiN/UUaSw9Llk3O9yMhKv4G2GWLekePRUB02Vd08xWm9iSlgsRvnDKkSuzF8WnXZDnbsKYBXugGQmOQA9d37hkLOS/QEMDzn7G8zT4YXLzgM51bwRf+dr9rNyLoE=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BN7PR11MB2658.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(396003)(136003)(376002)(366004)(39860400002)(346002)(84040400005)(186003)(83380400001)(8676002)(122000001)(38100700002)(26005)(33656002)(66446008)(64756008)(110136005)(4326008)(38070700005)(9686003)(66556008)(66476007)(86362001)(8936002)(66946007)(76116006)(6506007)(316002)(53546011)(52536014)(5660300002)(7696005)(55016002)(71200400001)(54906003)(478600001)(2906002)(49343001);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?vfSdzhf9pDlj8vg5hSE2UlesQ+tSM57kQBpfDXUhcQZ3GDcRZoSw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?us-ascii?Q?bbCYaBmsc3WsU5+wdqhLudjITe1kqbQaAxN3lfeNiOBAdMbbb2UAR5swgf+w?=
 =?us-ascii?Q?iahtXpU9Fk4EXYmMT7RleEkkMwuqf1MY1qGLPpAiJQVkehrQMv2mJE2mtS/u?=
 =?us-ascii?Q?KY6+hAEBv17h5gVuHDlmP73HfzzrwQyM2kkCk78BX33yWXnoizTuF9Zbc1M5?=
 =?us-ascii?Q?WlZpKUPm6FpPuVn5FI51rSfiHl3hVF42bs1YQDhE3cOGn3qOvsuaAHOLEIHD?=
 =?us-ascii?Q?IMi2Hznd4CnRUJkbzYrEBQJepGcoGHB/5lbgchzAxxY3PYWHH9/z0/ft03/2?=
 =?us-ascii?Q?EY9BJwbiRBjSGhm0mMcSI8r7ok+rdTJj7WSgSGHLIU+gpu71g9xQme49L3nX?=
 =?us-ascii?Q?qs+5GJ5oFffFqVXl5dZFU2ZHIlli3vcVUKP30MZRcDLNYlroy6R2EcXAzdr+?=
 =?us-ascii?Q?syYzjdrNvzf6dntrovg/Spwl?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BN7PR11MB2658.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 16b3fe7a-cdb8-44a4-e7f2-08d9772d4f6f
X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2021 03:11:13.7784 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: a9Oe/89VXbBVXEjqe2BD7nZmQ/F7Fh5r+kNjqeOHZ/Ya1GMxY638KhKPHwzCMCAgZtRcWSuj17xNcmj7N1Pklg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3985
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH] Enable AddressSanitizer feature on DPDK
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Monday, September 13, 2021 11:22 PM
> To: Stephen Hemminger <stephen@networkplumber.org>
> Cc: Peng, ZhihongX <zhihongx.peng@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; dev@dpdk.org; Lin, Xueqin
> <xueqin.lin@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] Enable AddressSanitizer feature on DPDK
>=20
> On Mon, Sep 13, 2021 at 08:05:58AM -0700, Stephen Hemminger wrote:
> > On Mon, 13 Sep 2021 05:27:12 +0000
> > "Peng, ZhihongX" <zhihongx.peng@intel.com> wrote:
> >
> > > > -----Original Message-----
> > > > From: Stephen Hemminger <stephen@networkplumber.org>
> > > > Sent: Friday, September 10, 2021 10:48 AM
> > > > To: Peng, ZhihongX <zhihongx.peng@intel.com>
> > > > Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; Ananyev,
> > > > Konstantin <konstantin.ananyev@intel.com>; dev@dpdk.org; Lin,
> > > > Xueqin <xueqin.lin@intel.com>
> > > > Subject: Re: [PATCH] Enable AddressSanitizer feature on DPDK
> > > >
> > > > On Fri, 10 Sep 2021 02:01:47 +0000 zhihongx.peng@intel.com wrote:
> > > >
> > > > >
> > > > > +if get_option('b_sanitize').startswith('address')
> > > > > +	cflags +=3D '-DRTE_MALLOC_ASAN'
> > > > > +endif
> > > > > +
> > > >
> > > > This looks great, but can we make it just do-the-right-thing and
> > > > get rid of the nerd knobs (i.e no meson configure).
> > > >
>=20
> There are no new meson options being added here. Turning on/off address
> sanitizing is a built-in meson option that is there already.
>=20
> > > > The address sanitizer already has a way to detect if enabled.
> > > >
> > > > GCC uses:
> > > > __SANITIZE_ADDRESS__
> > > >
> > > > Clang uses:
> > > > #if defined(__has_feature)
> > > > #  if __has_feature(address_sanitizer)
> > >
> > > Tried this method you said. It can run successfully. Because gcc and
> > > clang have different Methods for determining whether to turn on the
> > > asan function, so if you judge the two methods in the code, it feels =
not
> simple to judge in meson.
> >
> > There is already compiler specific #ifdef's why not do this contained i=
n one
> header file?
> >
> > The point is DPDK is trying to get away from having configuration
> > settings if at all possible. Configuration creates dependency
> > nightmares and also leaves many code paths as never tested.
>=20
> Not sure I follow your point here. We need some macro to easily tell if w=
e
> are running with address sanitization enabled or not, so as to avoid havi=
ng
> the multi-compiler detection rules all over the place. The only question =
is
> where it's better to have this in a header file or a meson.build file.
> Given your objection and the fact that the meson.build code above looks a
> little awkward, I'd suggest putting the conditional checks in malloc_elem=
.h.
>=20
> Is something like the following what you had in mind?
>=20
>   #ifdef __SANITIZE_ADDRESS__
>   #define RTE_MALLOC_ASAN
>   #elif defined(__has_feature) && __has_feature(address_sanitizer)
>   #define RTE_MALLOC_ASAN
>   #endif
>=20
> /Bruce

Agree, we will update it in V2 version and send it soon.
Thanks Bruce for your review and guide. If no other objections, need your h=
elp to ACK this feature patch.=20