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 71AFDA0C43; Tue, 19 Oct 2021 12:24:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F370940683; Tue, 19 Oct 2021 12:24:27 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 10FEA4003E for ; Tue, 19 Oct 2021 12:24:25 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10141"; a="227244053" X-IronPort-AV: E=Sophos;i="5.85,384,1624345200"; d="scan'208";a="227244053" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 03:24:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,384,1624345200"; d="scan'208";a="531377928" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga008.fm.intel.com with ESMTP; 19 Oct 2021 03:24:24 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 19 Oct 2021 03:24:24 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 19 Oct 2021 03:24:24 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.45) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 19 Oct 2021 03:24:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NioJWib1QTgbozN+Bj0tin3d99kiN3twQILSJ2t2IUcuwoVMzxGaqm3kUW4LKIR/+76yzo3sFcz4N+5O7SKB7bni6k63qoGf8tTniDT7ESHKB0894gkGvE2pK16twlzrlHAFWldDJqOO4fD8JjPh7QhKcR4yDC/aMEzC3Vb1hoN4aQzYemj/XBBrX14zORVcvJuHJ3EB8QAPE0RP1PMvtgUsXK5ePKOdx1xdw1vNKIJwtXSMfmLKSzU2No9uS9Pl2wKs3NxZH2wFNnp+N+UlnT0a8hCKNxNjxtPB/T8+JId3LhmIpaAYiuO88MOs1EAVXmJ5cp6YoijCK+57sThRaQ== 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=4ngtJOOxAVYZ1nRi7CE8gWINmzqNO9lEOv8Z2zcdsUg=; b=QunBarXVr3CL7f1LYDz0nyvGa18u+t+Dm+w+blbZztTO2LUHu8coc7KsABhO8uS2zoTC+yZy7Anc/EFmLLbx7I7DURz0rTrnQmj9oTRxzybiZJP1wg6XUHT/Z/a/UzniilnwxM8z9kMCbeHH61nvgwKnX0vTUiD66jbc6bchdTbg+745zYbttVkZdRug9tc69DmAlkrDp/YFQ4LtsqEYikvsRMW/KxhCYggD0QecCDfzHVYFFdfSpj+H2UwN8C6SH3saLiCiIxRxeQ9H2dDXfJQarQiLh3sITTDd42m0ZgZoZDqy1sysCujvNjsFVk28iJqgUbyxBmhYnl4l1vUzYA== 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=4ngtJOOxAVYZ1nRi7CE8gWINmzqNO9lEOv8Z2zcdsUg=; b=CUQEg7+6sBluj+S5zyoEaxPkjJe988NI2d4lzysNC0UOFQTS5vSZC0NoERe3fQew1UxqfLf62EGrvnnKKhtbSsSNJC7lS0UETGfRCclsgM1JmoQlkXNfQ7sYplwI/kktH8ulGMCd6oszKcfJFH6yO3JGUAcienf0FYuldXkKGY8= Received: from DM8PR11MB5591.namprd11.prod.outlook.com (2603:10b6:8:38::23) by DM4PR11MB5567.namprd11.prod.outlook.com (2603:10b6:5:39a::15) 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 10:24:15 +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 10:24:15 +0000 From: "Peng, ZhihongX" To: "david.marchand@redhat.com" , "Burakov, Anatoly" , "Ananyev, Konstantin" , "stephen@networkplumber.org" , "Dumitrescu, Cristian" , "Mcnamara, John" , "Richardson, Bruce" CC: "dev@dpdk.org" , "Lin, Xueqin" Thread-Topic: [PATCH v11 1/4] Enable ASan for memory detector on DPDK Thread-Index: AQHXxNHZIAG0rVjEgEyK4k86JsU94avaHIyQ Date: Tue, 19 Oct 2021 10:24:15 +0000 Message-ID: References: <20211015151110.1876850-4-zhihongx.peng@intel.com> <20211019101207.1451058-1-zhihongx.peng@intel.com> In-Reply-To: <20211019101207.1451058-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: 2eec7296-0641-44c5-bc1d-08d992ea9a53 x-ms-traffictypediagnostic: DM4PR11MB5567: 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: bog0MrGhAIMXvXc8/w8QFSehcNjN7vGCKL2BL2+UAaNaOZCc9e9z7q4cTKPRaJaQTTmEMFVZPFrnOPpiHrB1vo9FjLYlqnuluF9SfxivKtCFxtqfweJHWVTcPAONCQJmIljKX2vfW/10FZA+MT50EeF3pvT+zVow1+Lmp1EYSZAzLJ/ha7U9tnX+eAXP84+aLxT7twn7XE3I36JGpeoLXc5V2eR83q8qHSob72T996qYk5cPe5sOIg3rkt36HZqsY341QPJlukJoFzG8Hw/hjOtHZG8v6iIflQ6M3TtuIlFQP2A1nAWsiHQeoESP1yFkv+0nbX6qrMg5Pc0Jm8S/977a/cnlN1CZocqk8YerHgsL9Ozhx+UH0A4FHHpYjlEQLScg/l3aaeLICDrs6DTdthY67xcEzPIdgVtV9L7e4k7a8ZG9pvhE3tkF40XIqT8Cuu7/6pqcb2KAZVDND6vrnGRS2sAv0pWAi6uyH7QTehDhCSDZFaV2Z9LvpeBYmSxhWrlsp7dhvBKZFIdeKZNEo+aKBIOz/2Z/FabX7kLtBlFk1+T2N1ttW3gwySZtF2003xaUHh6JKWqY9kPGXlkPzKvQl8i9zlsBTJNTrbD0PZHfE3w0ueR3ZrCsKweHG2sUSAyJJO7YZ4f1pvThiapyonUfK36tpkYsKZFqMnRQ6dXxu6J1ItDUm/t76eeDdz6L7NGtKnaOu0U3KDI4rPmb55VM7bzPnNPirqtE1GF3XLke/Uh+/is8neJGMPynp5VzrfVm0cLRSl2jUJTqmew5piul7GKMzO5UQVw6sntnrJ2cMgsmS261ZHG30p1qgswC 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)(66446008)(64756008)(83380400001)(5660300002)(82960400001)(66556008)(6636002)(6506007)(508600001)(86362001)(122000001)(38070700005)(66476007)(54906003)(921005)(33656002)(66946007)(107886003)(76116006)(2906002)(9686003)(4326008)(38100700002)(8676002)(52536014)(8936002)(110136005)(55016002)(7696005)(53546011)(316002)(186003)(26005)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?utEOUgs9PH+iMnnOl/OZYNmhP3/1Rfnvd1Slc/KlwVdWQv0ztXNi4rYcw9P4?= =?us-ascii?Q?sBJz78T/5HCkxPaXpicgu8z7vYsGZRsB4zZQmpUsSADC9uNGVlH2u1CfyFO/?= =?us-ascii?Q?/vA04oQVk/bWcs4XBBS7E+rUbHYlCte369xICM+cPcV1D9W09FrubASA+X44?= =?us-ascii?Q?W3QXUzchDXy8ou56PzQjpBTfbYVdNJFiphkIDt+zWD0x46zfdVHQ9tmr0BTn?= =?us-ascii?Q?yIQq/JKMuVo65EoCtPdkduUKBlFwdfzwPMm4xdHZYS9DPnrzdj+xnJzfQDIM?= =?us-ascii?Q?hchsJyrxaSdYI0tJl0tVtxCaFgj3mwI7bxKuxA3QiCj8qt3o2Cc9rODE3B/x?= =?us-ascii?Q?6zH+kZBvFlLMj/vtyUOulXJ7ADlhFJNizT+ELgoxoX9Tb4OQ5NYr/8Se/1AP?= =?us-ascii?Q?BHvgMWu8RV8KKBIEn7E4tGH5qrj7QeVGt5zMEubNoodoiWr9spRPs4lkJAxn?= =?us-ascii?Q?nDbQE2P8yCn+4PvCzvNUlqbwuez69eYMcMC+t5iIXsNH0+NkXmPrNTuiNEoG?= =?us-ascii?Q?8yso2L/rZj7nt4X1vMi5boxuOWF1EU1Gju39R6iHsaYoldtJZdDU2csx1UeO?= =?us-ascii?Q?Zmlz4+vpUwIRPqfCBz+zEBUQYFWn/tCZ9BuCFptOoqU68dVoM9itom7a0rqu?= =?us-ascii?Q?Z/JnQMdvC2Nx9kZWgmprBhAfRMsFWMR6C7un5SzxEkCca6P1t+80Cw6zX1FT?= =?us-ascii?Q?5hfEH0ci4pGL8IG31hZEFXc36fPPERhJ89BPRFUF7YN85Vsysac7UDP5hnay?= =?us-ascii?Q?pKMwpWapyUe8zNn6Ck6oQkvDsnyZZ3kWnljyRJ+s6gOjIClInJVHvRlBkSrB?= =?us-ascii?Q?1luZu0/zAnrLTm8x3O8MHG0LauFZhInZjO6BysKTUsdNZ+malcWeNqQhieDQ?= =?us-ascii?Q?FHP5qC3aIqyhwBJcV1YPd/X8RXpCWQGgX5L2+b5VMgTdwuyOx7x8yHLxoDY4?= =?us-ascii?Q?BInt2k35wE4lRyY38ZDCH/NUSGFTaEGd62EGmz9dtaHLUA4N/Ky53QEmyhfl?= =?us-ascii?Q?U/kzc7xsgNZZgFXdR4NwDl2J8xLk9lN55CL/l87Vo+G8NlISVjKxXHxheWab?= =?us-ascii?Q?rDfAZqRNbSd1DRaQm/XUe84xV2YWJoGROzDwlvkPNMW1iGhvlW6mEpevq1hc?= =?us-ascii?Q?1skEGfRylQehQO4Txtbc0rzgIu6f3tGSdpdavAqNMXwraL5CY2iXWVEsgcHS?= =?us-ascii?Q?x77HMzt6WJBq2ocVOEPDnT9zQvnUN4ujcM0favyNPpLo1tSiEIM56ibn6/RP?= =?us-ascii?Q?nJJ8dLe/JdkrSG45dLC+eNU54w9VAQJ0XAAr7bTCpbii7UwKdy47i6jb07xv?= =?us-ascii?Q?ClU=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: 2eec7296-0641-44c5-bc1d-08d992ea9a53 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 10:24:15.7582 (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: JGUWbiMt7BHly5f+EiNG+5FRcFD85RBAbFi68AnwwHK+JlEuhL9GMt1VgdCl4lyR9rQSU6Vu/0iSOVfx/RhViQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5567 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v11 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: Tuesday, October 19, 2021 6:12 PM > To: david.marchand@redhat.com; Burakov, Anatoly > ; Ananyev, Konstantin > ; stephen@networkplumber.org; > Dumitrescu, Cristian ; Mcnamara, John > ; Richardson, Bruce > > Cc: dev@dpdk.org; Lin, Xueqin ; Peng, ZhihongX > > Subject: [PATCH v11 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. > v11:Modify the document. > --- > config/meson.build | 16 +++++++++++ > devtools/words-case.txt | 1 + > doc/guides/prog_guide/asan.rst | 40 ++++++++++++++++++++++++++ > doc/guides/prog_guide/index.rst | 1 + > doc/guides/rel_notes/release_21_11.rst | 9 ++++++ > 5 files changed, 67 insertions(+) > create mode 100644 doc/guides/prog_guide/asan.rst >=20 > diff --git a/config/meson.build b/config/meson.build index > 4cdf589e20..f02b0e9c6d 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..969676ebe8 > --- /dev/null > +++ b/doc/guides/prog_guide/asan.rst > @@ -0,0 +1,40 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2021 Intel Corporation > + > +Running Address Sanitizer > +=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=3D= address > + ninja -C build > + > +.. Note:: > + > + a) To compile with gcc in centos, libasan needs to be installed separa= tely. > + b) If the program being tested uses cmdline you will need to execute t= he > + "stty echo" command when a error occurs. > diff --git a/doc/guides/prog_guide/index.rst > b/doc/guides/prog_guide/index.rst index 89af28dacb..561d787fcf 100644 > --- a/doc/guides/prog_guide/index.rst > +++ b/doc/guides/prog_guide/index.rst > @@ -72,3 +72,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 d5435a64aa..1fa8eb3368 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -167,6 +167,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 submitted the v11 version and modified the document and string copy = function. The string copy function has been compiled passed on the arm plat= form. V10 information: 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!