From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAC3FA0C53; Thu, 14 Oct 2021 08:53:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8F4740042; Thu, 14 Oct 2021 08:53:17 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C36CE40041 for ; Thu, 14 Oct 2021 08:53:15 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227510341" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227510341" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:53:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="461075719" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga002.jf.intel.com with ESMTP; 13 Oct 2021 23:53:14 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 13 Oct 2021 23:53:14 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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; Wed, 13 Oct 2021 23:53:13 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 13 Oct 2021 23:53:13 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 13 Oct 2021 23:53:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YLp8gyHDwMm/O3fmSoWA2hB2LxGi8b+mHGKjmplpcaGYBtfe2+1IqDUdJhoD/V5X9O4GBLxYWRMG7Mj0qhxjmJiGm2j2J/r1Ma95UoEDRP6/xvtUCSEKqZ6Yb1EbA3HRLjDSgUKuLbqghPMpup/vfO2MNofZE/I0FlP1hmDoaU21Lqly7YBeoi6W5QO6nGVaM/ZG2r/2Gzp2K3JlpVWIGWUW9Fu9sNR/QRHd0RSc/EMDjrodt5JSms9h/X+1guZNUc+T2ZMfgjP4sE0UUH8p/9375VJoJzkl9OQh/xCCEh82dg+pxFGobOG3xDpph0Yf9y+qeFrUCoX4mFTyCznP/g== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eW2DpZIAnm6dRg2UHWcNU5dcVybiDqhlDK6sSyDnIU8=; b=HWdQcmYu7gMAV7SkXz6+t16lrM3PfiIEdJWLZLcK6RT0G091yhEU7MqhnLdME6a218OoxbHWmTFMhmNvf8571o6du6xnK0BvPmYE4T/eoZrAniF5UhfL3MXP8Mu6QfgMJIjLZnZA61C0aYuAFXwBrSOJoDuBu/b6FdJjuR9gfyrn2DoRYBcdCLK+YgTEB4VEeWtyGqm5I1/XqDbh0hJoMtQmwaPbkV+RkVi2KFGpwsWsAJhTNh1FwpBYkEMzqhxoq+PJN0WMbP6G0UlBkOB8oRR75CdDGvu48VMtHSYrLXbZ0i9DVzi4QhPgIvvecfHClnxgdsaAURfszXFFCtomHQ== 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=eW2DpZIAnm6dRg2UHWcNU5dcVybiDqhlDK6sSyDnIU8=; b=QOHteYVLUCNKXN43CdV0tPhGOzixw9fHowdcaVpARg14eatprVslHwUpY1aR8njSRUhJWYISmZy5CdwBnIkrd/YkKC0m7HvIyhH6i/uazqWLFmzw8sCxAqvqqSx+MGLQqgmbw2fM5EC6foWxw4L+eUJIo7YJWWTrZ5Y0cLRiOOM= Received: from DM8PR11MB5591.namprd11.prod.outlook.com (2603:10b6:8:38::23) by DM8PR11MB5670.namprd11.prod.outlook.com (2603:10b6:8:37::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Thu, 14 Oct 2021 06:53:10 +0000 Received: from DM8PR11MB5591.namprd11.prod.outlook.com ([fe80::3d47:b590:aa2a:d5cc]) by DM8PR11MB5591.namprd11.prod.outlook.com ([fe80::3d47:b590:aa2a:d5cc%9]) with mapi id 15.20.4608.016; Thu, 14 Oct 2021 06:53:10 +0000 From: "Peng, ZhihongX" To: "Peng, ZhihongX" , "Richardson, Bruce" , David Marchand CC: "Burakov, Anatoly" , "Ananyev, Konstantin" , Stephen Hemminger , dev , "Lin, Xueqin" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on DPDK Thread-Index: AQHXtb0yUlb9uW6iB0uZ+PLmDLP2Qau8PHEAgBRolACAAXlmoIAABeEQ Date: Thu, 14 Oct 2021 06:53:10 +0000 Message-ID: References: <20210924100310.4278-1-zhihongx.peng@intel.com> <20210930052724.195414-1-zhihongx.peng@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: 965e5a5d-66a5-41df-a749-08d98edf4934 x-ms-traffictypediagnostic: DM8PR11MB5670: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oF+VAracmk0RuYrbnSPQjlLJmRAQlRBjjinQvVF0nwtmG0GUdOJWzv1m8lA7Yn3R4L2DHpDKpiD+midaJJ2R5w/pQaVeOcj3Kh193iieUvxO4ft8tnieDpwvp2M/rO4IW6SdDs7Ul33STzIn2sD8JithIImLMtlVkCj54MJpllfE7sM8g2kqUHznaPbNFFpy9hJmiAtRBsIvwtq5IQVNsKXzvjA5EZC0g3M6PmZhh8rhxpXgEeEKvgTCHc4EPjEjADH8Sl8D09MV5IKrfFB5C251Ub5qNkIsC64Z0yqXHth9VpBICpJIQDf/eb2qpGRBEgZrzQ4TQFzeaAzOWDsEDxSD4wYZ2omQbe8GWrRh1ZuQug66jqD1Xj3Q6P87ZDJjpR87ijchZ1tHiti0panr6BTxpN4/VBxQm5nbdLWwHTR3aHhG/J+lkoYj3g4q6kBxy1N+lyl/Cm2ZrpbFq0L21qtcr6eLEYduYb3CzPxy1TJvNLp11ued/HrYWqQvkVMDaI/3XRBW9ccUKZiJ4gWZ6P04aNCu2Hfw6rnGf2tRlzrT5h4nOVXA2CIwb8b18qYSTsloLwCE+J+bfJ7GRzwo52wYH3QkFzZorgbcqLhNkoe+mfIFwMu1ZaCjexhOT4vK8X4gHjoGI89PFWqKatn2OBExWdMUQKvJJUKLUizZ8sLh+N3TjH5eo1nbgbb3+o0lNFKj/vUIpqPwPjVIfMXVeJSN1qgYv8628U9Vm++ZlwmRQ3Ndla7mr8QR2Kdm/L+8XDbPsibAVeByV550Ly8UEuT9FVEv6wbiiYDHDfoxJv4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5591.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(186003)(55016002)(26005)(316002)(71200400001)(38070700005)(5660300002)(38100700002)(110136005)(122000001)(66556008)(508600001)(66476007)(54906003)(9686003)(33656002)(76116006)(82960400001)(64756008)(83380400001)(2940100002)(66946007)(2906002)(7696005)(86362001)(6506007)(8936002)(8676002)(4326008)(66446008)(53546011)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?EqSewVizsQmOmgdSg23lg5J9sHXRf0FKItcc+d6s+QxpqtosXfmEEJUVosw+?= =?us-ascii?Q?ksntZ0wLmbrHd+3GrPePnGW+/PYhsY0ub0hn6dpuM2M9mZArwRT7jm7RFBj8?= =?us-ascii?Q?QsZYP+oaJ5Du1c/Vhzwa+MLqQryssHIkQz8krU3+RU7fNfPMXOCDWFe1iBd+?= =?us-ascii?Q?l/lQd77MLxHN4LzSMbV2tFLrcnbryY7hInDyIyQKscXSORu2NTM2t0RCMoDz?= =?us-ascii?Q?v2x5zDEKzRoq7T3+2/8ys6tgaL2SJDhf5jL/1V92zH7yQOL9UrSaQ9AMJB7e?= =?us-ascii?Q?QThL1WRknCWSmRfvGBPRDh1MG9HUYI/IXbjJNG28tE9qoKaqzkHyb2i8I0t6?= =?us-ascii?Q?GW4o5YWRnAl8HLYbUs4h4+Z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?Q?/L5ymWS7SQ1p1nJD/goR//2C75nhbnl6GCjoKU+4+yhQZvnGcwVNNOUCL68C?= =?us-ascii?Q?dDI=3D?= 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: DM8PR11MB5591.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 965e5a5d-66a5-41df-a749-08d98edf4934 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2021 06:53:10.5161 (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: zG2yYan0RBa7j95GZZA7xm97234gvM71ixJFZDv4hAFGSwzuayyqBuOj6QxYD0XEbO5490Jqk1VrrI5EwZcNsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5670 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Peng, ZhihongX > Sent: Thursday, October 14, 2021 2:34 PM > To: Richardson, Bruce ; David Marchand > > Cc: Burakov, Anatoly ; Ananyev, Konstantin > ; Stephen Hemminger > ; dev ; Lin, Xueqin > ; Thomas Monjalon > Subject: Re: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on > DPDK >=20 > > -----Original Message----- > > From: Richardson, Bruce > > Sent: Wednesday, October 13, 2021 4:00 PM > > To: David Marchand > > Cc: Peng, ZhihongX ; Burakov, Anatoly > > ; Ananyev, Konstantin > > ; Stephen Hemminger > > ; dev ; Lin, Xueqin > > ; Thomas Monjalon > > Subject: Re: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector > > on DPDK > > > > On Thu, Sep 30, 2021 at 10:20:00AM +0200, David Marchand wrote: > > > Hello, > > > > > > I see v6 is superseded in pw, I have been cleaning my queue... maybe > > > my > > fault. > > > > > > > > > On Thu, Sep 30, 2021 at 7:37 AM wrote: > > > > > > > > From: Zhihong Peng > > > > > > > > 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. > > > > > > > > `AddressSanitizer > > > > ` > > > > (ASan) is a widely-used debugging tool to detect memory access erro= rs. > > > > It helps detect issues like use-after-free, various kinds of > > > > buffer overruns in C/C++ programs, and other similar errors, as > > > > well as printing out detailed debug information whenever an error i= s > detected. > > > > > > This patch mixes how to use ASan and instrumenting the DPDK mem > > allocator. > > > > > > I would split this patch in two. > > > > > > The first patch can add the documentation on enabling/using ASan and > > > describe the known issues on enabling it. > > > I'd find it better (from a user pov) if we hide all those details > > > about b_lundef and installation of libasan on Centos. > > > > > > 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') =3D=3D 'address' > > > + asan_dep =3D 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 +=3D '-lasan' > > > +endif > > > + > > > if get_option('default_library') =3D=3D 'both' > > > error( ''' > > > Unsupported value "both" for "default_library" option. > > > > > > > > > Bruce, do you see an issue with this approach? > > > > > > > Apologies for delayed reply on this. > > > > No issue with this approach on my end, seems reasonable. Just watch > > out that b_sanitize can have "address,undefined" as a possible value, > > so if we want to support that, we can't just check directly for the > > literal string "address" > > > > > > > > Then a second patch adds the rte_malloc instrumentation, with a > > > check at configuration time. > > > > > > endif > > > add_project_link_arguments('-lasan', language: 'c') > > > dpdk_extra_ldflags +=3D '-lasan' > > > + if arch_subdir =3D=3D 'x86' > > > + asan_check_code =3D ''' > > > +#ifdef __SANITIZE_ADDRESS__ > > > +#define RTE_MALLOC_ASAN > > > +#elif defined(__has_feature) > > > +# if __has_feature(address_sanitizer) #define RTE_MALLOC_ASAN # > > endif > > > +#endif > > > + > > > +#ifndef RTE_MALLOC_ASAN > > > +#error ASan not available. > > > +#endif > > > +''' > > > + if cc.compiles(asan_check_code) > > > + dpdk_conf.set10('RTE_MALLOC_ASAN', true) > > > + endif > > > + endif > > > endif > > > > > > > Apologies, but I haven't been tracking this set in much detail. > > Do we really need this second configuration check? Should it, or could > > it, be merged into the check above for the asan library presence? > > >=20 > All code: > if get_option('b_sanitize') =3D=3D 'address' or get_option('b_sanitize') = =3D=3D > 'undefined' > if cc.get_id() =3D=3D 'gcc' > asan_dep =3D 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 > endif >=20 > if exec_env =3D=3D 'linux' and arch_subdir =3D=3D 'x86' > dpdk_conf.set10('RTE_MALLOC_ASAN', true) > endif > endif >=20 Modify: if get_option('b_sanitize') =3D=3D 'address' or get_option('b_sanitize') = =3D=3D 'undefined' if cc.get_id() =3D=3D 'gcc' asan_dep =3D 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 endif if get_option('b_sanitize') =3D=3D 'address' if exec_env =3D=3D 'linux' and arch_subdir =3D=3D 'x86' dpdk_conf.set10('RTE_MALLOC_ASAN', true) endif endif endif > Bruce, is this code correct? > Thanks! > > /Bruce