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 398CAA0C4E; Tue, 19 Oct 2021 07:52:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDF3940142; Tue, 19 Oct 2021 07:52:05 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id A628D4003E for ; Tue, 19 Oct 2021 07:52:03 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10141"; a="291895575" X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="291895575" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 22:52:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="444366197" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga003.jf.intel.com with ESMTP; 18 Oct 2021 22:52:02 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 18 Oct 2021 22:52:01 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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, 18 Oct 2021 22:52:01 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.48) 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, 18 Oct 2021 22:52:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QjdAx80wIBmPjCzqWgUFLvWUea6isCy2PSMromMdpM/WMBKUhp9A450ooyczF5+Evb74RM+EbsiiANruJc6DlvNWSF8VtI/RptZD2GspWhotFt+hHr18nZrusZEGSSj4I5saU3tiUcKO0tjSl5Ge++CTh3FGVUkFw2pP5hN/nLpyMtJZoMKumupdLX1rCnnlt929IVznd3SL6v0FQrzgVFr4F9AMen3JwveVOG8aXWM77FyJBwtWgsW3fXLJxfRcMW++WpW3LcKBLCSjpLDeptRZDymEkjre004Hq2eEiM0P8EDW560xbfV4flLqViQ/O9SMymgC9wVWMv19APAUZg== 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=Sok9LfjIEHjaL3nqBhWfnbDUkBSI2fGL2bKvpFJ7ppE=; b=H29I/VHdiR97XM2T6ES17k0VF8rXRxRGlRl93sNHFHcmd32TeXMV1w0Z4JxMmuPpFXusgkjCtZmkJPPZaHtUBEJgT6m3GzPUg+InmLRjQ9cIpolcvuSjeiWkqKkuJc8Cd//9W9dPL09ldXXWbUOuTbfXdFkHLZELkFc9wlySduniRdANhVB7EIZ/eGq/dXkLaOg6ANh22MTwTQsZWFCM7/SO1VXZ6Z/W+VVYnMDeApH6UAaMurheSXqhzktxm9SRmYNDc5EvJiNto2cEXQRnnlWdiy1W6X1bSLiHuvIkYShr6Nq+Y02XJ/jCsFiDf91udkVZdBYQi0+QpdxO5QIeOw== 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=Sok9LfjIEHjaL3nqBhWfnbDUkBSI2fGL2bKvpFJ7ppE=; b=fn3utAfK3H7Ek5YwrH/1i+fWbkboAJxxU8+5jQPEq4LuyGip4MLKRCaPnSOZE+YgiN09mO+1cvr5C74kLFbVpLGGzMN19B+vt54KF0yJK8nOtZ/XJgMg/QKY6tolAGXKPZ9ilPVWetUyDgEQT3QHYAa/Z0NB0AywZ3gBNlLDHRE= Received: from DM8PR11MB5591.namprd11.prod.outlook.com (2603:10b6:8:38::23) by DM8PR11MB5592.namprd11.prod.outlook.com (2603:10b6:8:35::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 05:52:00 +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.018; Tue, 19 Oct 2021 05:52:00 +0000 From: "Peng, ZhihongX" To: "david.marchand@redhat.com" , "Burakov, Anatoly" , "Ananyev, Konstantin" , "stephen@networkplumber.org" , "Dumitrescu, Cristian" , "Mcnamara, John" CC: "dev@dpdk.org" , "Lin, Xueqin" Thread-Topic: [PATCH v10 1/4] Enable ASan for memory detector on DPDK Thread-Index: AQHXwdb1B9LDu0TtmEic3Ps0lIKLJqvZ0DKg Date: Tue, 19 Oct 2021 05:52:00 +0000 Message-ID: References: <20211012094318.1154727-3-zhihongx.peng@intel.com> <20211015151110.1876850-1-zhihongx.peng@intel.com> In-Reply-To: <20211015151110.1876850-1-zhihongx.peng@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5953bac8-3d20-4edf-84cc-08d992c491bc x-ms-traffictypediagnostic: DM8PR11MB5592: 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: NvnfQPp6CiAaCx42qDjvWY4PlMoIVTLLAs3vIymcvhloUzgNizckDUjlQW/csPvxEi/OKbs7ymPAJ8p8HhIbuAXs4z7Y2DSYosRNoxjthN1ddNMqliwZPfWos9rqN2pSlYpTszLzmgWbtOM4wxVOudeOYSkcgxg4SuBiohi3zhmtn1uXNQeMMayTzuvdqgEQwvzA+Pxi8a72JM76tn4vpx9rgEceao2qNi3CGVw7t/Py3OVV//JBx1B+eAYAkgjIq9yZhPSDRZdpZlIbt0hJ8SDQojmj7KbTp1bgIWyg52+ln9WX6x6NXSHf+XWnF4fGFmLkFe04imHoHxpwdiJM/ed8VjKyWHNOM1FlvcH1PrRvOzrLNQBILlx1kmcda/TR42tKv60ywhnyNoM4twPUwc1rr5ux+ofwiCG7ICcn31jere6VNFqBHW+w5p5xhl1VZjOWtF6wI826ZBr45u12DDq/ivXnsSoR/9QIEWDRfLztpsEEF3yEhjXv4DprLNt4HcQogeAK7MSAzv6+bNIfOUoQmAPIOOehn08IgfzMA+Lvr0VIPQcuZ1fxPVgXZNUzKvBPTuGuv5PPSAhy6JlmNfD0ANo5WFzsj5BttT6siPyy1QIVDv8XBwqhJgd8ycUE4KOBtAYLPg+BPQpmyxY4kcpYR19HpvxjcAxi5AjVpfV0Tef4uUfcgphQWJOP+LDyKmA+GVg/K8wO1505TIm4k3zwcaDarEIqw6aI0NWGy1tt2w5dT6O1Eu6PIjRIxDv/zjpuPGJsHzwlTDYTzKzE4M/US4g0jrh8oyTNyJE57XwWZ7eaZuyvA8PKXUQgqt6h 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)(38100700002)(9686003)(186003)(122000001)(8936002)(55016002)(82960400001)(316002)(76116006)(66946007)(66476007)(66556008)(64756008)(6636002)(66446008)(4326008)(107886003)(52536014)(83380400001)(8676002)(33656002)(26005)(7696005)(54906003)(2906002)(110136005)(508600001)(6506007)(71200400001)(5660300002)(53546011)(921005)(86362001)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?HmRfo7VB5r1ZXDGjl53U231fJLFYCIsRvXh7c6Uk2OxMdvLLvnUukRJ2lJK5?= =?us-ascii?Q?FvrbWtco5LVLP7RRYcJGTK039eqOEyOVsJL/SXxt//jy1g5K7ZxOdc5C6jAi?= =?us-ascii?Q?4DuIICqlE4wYzIYMeb1e7N84svCY+wAwqlmD+TfMrPqw1b3zAozhW5BYVP9k?= =?us-ascii?Q?7VMkeT58+wqS5HORmlbnGwX+7adF+IFeGJQvFB4vva6yMrl3BLWz6pW7SCZs?= =?us-ascii?Q?UAR4KnxQNghwcucoCYV7mcV+4mq0NKt105zFZwZDJ/jcXgDOu1oZj1fMz1L9?= =?us-ascii?Q?9+yi1p0RGuAgcAls5+zFpIsdNMziAoDJjcB2ZBLRKun20na80fgYUz95BDwn?= =?us-ascii?Q?iMzieYOz3p6dwIG/B4NznmEAFNXDiE9lJvY8pfxtCx3QvgzIXJ/+nJheTT+7?= =?us-ascii?Q?WERBSwd8iyvI8RjQfC4po6XhkYSihf+I2dYnBvrq6s4UDLF04KtXG18rCL27?= =?us-ascii?Q?LSPhhpoCcU80ToVPgv74F3XJPLZUyylWsBcpilZm8YDtlbXkatTGMEom3wMe?= =?us-ascii?Q?cl8Wh0e3xeOD2GoUMKiDmKvLi+xk3qYEHiG7dfo/C8mL5Vkg5b+z7YVqG0pV?= =?us-ascii?Q?uAdbLZUSNBMsO0eXRxN5T+YdEeynb/YZhT28Fqf/5b1uygSFRbEEMkIXovnw?= =?us-ascii?Q?JI0v3K4RrB3vkF229MpKDD2nyE3G7ySoRKalacmtFTZgCZpgdnJO3K7bXsUS?= =?us-ascii?Q?iRTLcO6XZIg3GnA6zKUiKw0iDby8cVILXpiKFfZYBiIiVp/4LaZNe9TpMED/?= =?us-ascii?Q?SOQSpc6ejAa3o1Q2jrGPw5sbP/TvqPY93ykXHMZXAdwEgLwSCoTUTLre+PoP?= =?us-ascii?Q?MZvfNAvuwABJSzmO+ZGI000thtNXel1I9L8wQ3qrVI+AF1sGRUxgNAA8YFZF?= =?us-ascii?Q?bcGhQfLzIbCHweUYZMiN+9Wwdyo+LyWQxprDaJH+B6JeW8FpR2HlSpC/EHYy?= =?us-ascii?Q?GZpGcYXLO2NbRT2DOFwL1ffaMbWHkVZ7CIFmV7qFshhb0v3+RpofyWHwCPz0?= =?us-ascii?Q?PjWBg6Kj3UWN9QCAS/9oGtAWXcMq1dkK8ruAz74Xe51kClNTTHRv+B2XTMeD?= =?us-ascii?Q?spwFh0wuKiH9v3drCDXZvJYN6pWyOxYjWpPiAAAAE4qugHmi3ku6zWnOd2J7?= =?us-ascii?Q?0X/O7sNDD/MJYk893nGmqkRzxK4NDnf71yPEdLbX8VxrmIj88qp9EB8RnSSB?= =?us-ascii?Q?W4GxkAmrOSiG08lTJnDlt0rsaApUHCwN5wpxyu01MSSDdomlHHKLe9vFRG9V?= =?us-ascii?Q?T/sgyvtWw/H7YpAb7e3dDd+DHLktKR24Tj4hNdqz8sjD4y92hIPMbZqY8CAQ?= =?us-ascii?Q?YPw=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: 5953bac8-3d20-4edf-84cc-08d992c491bc X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 05:52:00.4050 (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: M6Ck9BxSixPRCH56YqcPqu9frgJ2iqHuNYQEldAil7AZPSv2LCmE42K//1oL4X7169/N4Y/VLgUCK9JWn7hC3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5592 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v10 1/4] 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: Peng, ZhihongX > Sent: Friday, October 15, 2021 11:11 PM > To: david.marchand@redhat.com; Burakov, Anatoly > ; Ananyev, Konstantin > ; stephen@networkplumber.org; > Dumitrescu, Cristian ; Mcnamara, John > > Cc: dev@dpdk.org; Lin, Xueqin ; Peng, ZhihongX > > Subject: [PATCH v10 1/4] Enable ASan for memory detector on DPDK >=20 > From: Zhihong Peng >=20 > `AddressSanitizer > ` (ASan) is a > widely-used debugging tool to detect memory access errors. > It helps detect issues like use-after-free, various kinds of buffer overr= uns in > C/C++ programs, and other similar errors, as well as printing out detaile= d > debug information whenever an error is detected. >=20 > We can enable ASan by adding below compilation options: > -Dbuildtype=3Ddebug -Db_lundef=3Dfalse -Db_sanitize=3Daddress > "-Dbuildtype=3Ddebug": This is a non-essential option. When this option i= s > added, if a memory error occurs, ASan can clearly show where the code is > wrong. > "-Db_lundef=3Dfalse": When use clang to compile DPDK, this option must be > added. >=20 > Signed-off-by: Xueqin Lin > Signed-off-by: Zhihong Peng > --- > v7: 1) Split doc and code into two. > 2) Modify asan.rst doc > v8: No change. > v9: 1) Add the check of libasan library. > 2) Add release notes. > v10:1) Split doc and code into two. > 2) Meson supports asan. > --- > config/meson.build | 16 ++++++++++++ > devtools/words-case.txt | 1 + > doc/guides/prog_guide/asan.rst | 35 ++++++++++++++++++++++++++ > doc/guides/prog_guide/index.rst | 1 + > doc/guides/rel_notes/release_21_11.rst | 9 +++++++ > 5 files changed, 62 insertions(+) > create mode 100644 doc/guides/prog_guide/asan.rst >=20 > diff --git a/config/meson.build b/config/meson.build index > 4cdf589e20..a7b71581dd 100644 > --- a/config/meson.build > +++ b/config/meson.build > @@ -411,6 +411,22 @@ if get_option('b_lto') > endif > endif >=20 > +if get_option('b_sanitize') =3D=3D 'address' or get_option('b_sanitize')= =3D=3D > 'address,undefined' > + if is_windows > + error('ASan is not supported on windows') > + endif > + > + 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 > + add_project_link_arguments('-lasan', language: 'c') > + dpdk_extra_ldflags +=3D '-lasan' > + endif > +endif > + > if get_option('default_library') =3D=3D 'both' > error( ''' > Unsupported value "both" for "default_library" option. > diff --git a/devtools/words-case.txt b/devtools/words-case.txt index > 0bbad48626..ada6910fa0 100644 > --- a/devtools/words-case.txt > +++ b/devtools/words-case.txt > @@ -5,6 +5,7 @@ API > Arm > armv7 > armv8 > +ASan > BAR > CRC > DCB > diff --git a/doc/guides/prog_guide/asan.rst > b/doc/guides/prog_guide/asan.rst new file mode 100644 index > 0000000000..b732288af3 > --- /dev/null > +++ b/doc/guides/prog_guide/asan.rst > @@ -0,0 +1,35 @@ > +.. Copyright (c) <2021>, Intel Corporation > + All rights reserved. > + > +Memory error detect standard tool - AddressSanitizer(ASan) > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D > =3D > + > +`AddressSanitizer > +` (ASan) is > +a widely-used debugging tool to detect memory access errors. > +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 is detected. > + > +AddressSanitizer is a part of LLVM (3.1+) and GCC (4.8+). > + > +Usage > +----- > + > +meson build > +^^^^^^^^^^^ > + > +To enable ASan in meson build system, use following meson build > command: > + > +Example usage:: > + > + gcc : meson build -Dbuildtype=3Ddebug -Db_sanitize=3Daddress > + ninja -C build > + clang: meson build -Dbuildtype=3Ddebug -Db_lundef=3Dfalse - > Db_sanitize=3Daddress > + ninja -C build > + > +.. Note:: > + > + a) DPDK test has been completed in ubuntu18.04/ubuntu20.04/redhat8.3. > To compile with gcc in > + centos, libasan needs to be installed separately. > + b) If the program uses cmdline, when a memory bug occurs, need to > execute the "stty echo" command. > diff --git a/doc/guides/prog_guide/index.rst > b/doc/guides/prog_guide/index.rst index 2dce507f46..df8a4b93e1 100644 > --- a/doc/guides/prog_guide/index.rst > +++ b/doc/guides/prog_guide/index.rst > @@ -71,3 +71,4 @@ Programmer's Guide > lto > profile_app > glossary > + asan > diff --git a/doc/guides/rel_notes/release_21_11.rst > b/doc/guides/rel_notes/release_21_11.rst > index 4c56cdfeaa..b6c4174dc6 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -159,6 +159,15 @@ New Features > * Added tests to verify tunnel header verification in IPsec inbound. > * Added tests to verify inner checksum. >=20 > +* **Enable ASan for memory detector on DPDK.** > + > + `AddressSanitizer > + ` (ASan) > + is a widely-used debugging tool to detect memory access errors. > + 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 is detected. > + >=20 > Removed Items > ------------- > -- > 2.25.1 Hi, David I have compiled passed on the x86/arm/ppc platforms, directory targets as = below : build-arm64-bluefield build-arm64-host-clang build-clang-shared build-gc= c-shared build-ppc64le-power8 build-arm64-dpaa build-arm64-octeontx2 build-clang-static build-gcc-stat= ic build-x86-generic We do not support the windows platform due to standard google document(http= s://github.com/google/sanitizers/wiki/AddressSanitizer) also not support this. We also sent our cross-compilation log to you in an other email. Passed to = run unit test for dpdk-testpmd simple on x86 platform. What else is blocking the process ?=20 What's any action we should do for the code merge? High appreciate for your= check and feedback. Thanks!