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 50E75A0C43; Tue, 19 Oct 2021 16:50:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C1DA411DC; Tue, 19 Oct 2021 16:50:47 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 34DD44119E for ; Tue, 19 Oct 2021 16:50:44 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="209332325" X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="209332325" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 07:47:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,164,1631602800"; d="scan'208";a="629650504" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 19 Oct 2021 07:47:13 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) 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 07:47:12 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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 07:47:12 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) 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 07:47:12 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.47) 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 07:47:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5tHvFBG9KhdmGVz8xWjiP1AWisLr7bfv+itk0QQ0aQRJ4p9Xy/ejgc3Oh7zXpRK7cyP5+Mm6U+u+RsBgdPc4v9cQpEUVEsR2NT4U4+TrKCqSainqHAtlLSlETtFk0DL9xn1LTR0hGraB23cQQN5PbqtjnD4HCCyi0Qz2vYqZpN7bEmJO4bGc8uHSsfCDC8xYMJY92WiksyeVZWiJOZN/Xd7TLh9u101XykepWzEqQKMNscjxKlLNgsaI8WS39K1HNOApfsrvhLZcaehWQW9f2DG2gMBkAyM4BwrJ258C0S4Edwxfw+W3iIjNm5m4rLHH1EfFnfAyF/H2uQO5eHQTA== 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=lIOURkjzM4K966nl/Hakb+0h26fhnHbgb4yZXztqbnE=; b=Snmhgeb9b8W1jH2A2SA6oj501c2Rz59MbqPhVB4oPHSYchTsPc8V7FQTpL4FL2X9wF+9GWLDQlH/9X0UJWJfueJkFROyqCsJ5cvoCBwDnKQTLve+cf2RYLD3ndxqCcTSZhk7gecm3i7cm/hL1sp8KXchykcIm3CvG5dcrSZ0M0TiiTPv3wT2ZJ3VzVHmVPv+gtiOKHAaHS5Wg4DB9hkOWY+tWX9VM7glTLubryRTlUE37OOsCedL255jvT1PO/rhg+/UAp/mz8TYCz9iTovrXi5Uv64qbkHs8+iZW0w0MapGYXz+SivT2dG/I951oQfnL69ArViECPWm2926WfAyug== 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=lIOURkjzM4K966nl/Hakb+0h26fhnHbgb4yZXztqbnE=; b=sna2sHZ78hDdJMTJEjzDE/GOlsSsObT+Ycm4ATW9uMYhiOlWE6o0ta2suS88sO2xcC6xKtO5TmyXiMFTwiu+q+oY7tAOFSKghQi5UudByAwdrZrTwFykBoQ0GI9T9vJl16LBAQOt1xd37rrvLVXAXZwUCiiAhyhqfWZ7n8sphIs= Received: from PH0PR11MB5596.namprd11.prod.outlook.com (2603:10b6:510:eb::23) by PH0PR11MB5611.namprd11.prod.outlook.com (2603:10b6:510:ed::9) 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 14:47:08 +0000 Received: from PH0PR11MB5596.namprd11.prod.outlook.com ([fe80::78a5:3d61:f3a1:4fbb]) by PH0PR11MB5596.namprd11.prod.outlook.com ([fe80::78a5:3d61:f3a1:4fbb%5]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 14:47:08 +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 v12 1/4] Enable ASan Address Sanitization Thread-Index: AQHXxPGJFN3FW6BrQ0qh1HxGlo9XkKvaZSVQ Date: Tue, 19 Oct 2021 14:47:08 +0000 Message-ID: References: <20211019101207.1451058-4-zhihongx.peng@intel.com> <20211019135841.2004819-1-zhihongx.peng@intel.com> In-Reply-To: <20211019135841.2004819-1-zhihongx.peng@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows 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: 4105df68-10eb-408f-88c5-08d9930f538d x-ms-traffictypediagnostic: PH0PR11MB5611: 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:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QmzUFW2lD4Yv2mXazOmcyMt7M8SnU23YYDbZQLY7GuImcL28IzJmEFg5slTgmHnbApTY2kq6f3fd1Ymqg+RgRJK+vb0dVtUEyrzEY+m7ixHGz/JnC622w0xLZV+beSYwTgsv4vszHSTbHYC4pbpuAUORhnVnvPMMgcqdUPTvbvJWoEFXCWGmNd3bGSr8MH61fh7GT3PBn6JAUQ93iL604/9fCFDQG9Y9r6LCobEjAdC13ATX2OMx03ttQoH1uCAxx0ludlyOUwv9EHuMmU9VrOwIOcE06x9+kqCwIc83asw4DNsc9gkGkpKD/E7x0l/uqGf4IGVKdZzHAnHaIqwRmjdHjgEzXWBt4e/xmpTc6mLUJdhKVwiH/QRvzvF4BLN9twL1oZLuDu+Hs4qX0RRR5imozyrJpmFZGbkL3yHUC2Ts4MG0ehL4nMfp5+RhGY/lkEPaxNHFO+cVJRMFT8377574l2vz+WTOnL8Pj6vRbNSuEHAN/W+fZOmeVv1P86BuZgElWWrsCjxy4OtcH6oXey81end8B02mAjId326rEbhm5r8nulg1/7T11JlPDYn1BzqUUTy58GZCXfGN2GIe6zPV0aZyy3Zf5Lvs9h6yfmDRDlcBiK6imPmKNMGwythBtwUcoEbWesmSET48eXlGqdR7+epcnLatSiBxNDnyaHubOnb722PoqUqp2TXv4+hUf+0yAhHb3o7R+Ku6hoTvE4siC+9zASKnX8gQ9T2RMsPeTcjv4Oh0z3lN5AgVLZfyUfeMvbjphNuFnBhuAZCRSnKcQDd6fsf/IRgyyuXYPr7cH+FwKPvYcz2e0jL/k1zV x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5596.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(8936002)(66556008)(66946007)(66476007)(64756008)(66446008)(54906003)(921005)(33656002)(4326008)(76116006)(86362001)(2906002)(6636002)(71200400001)(6506007)(107886003)(7696005)(38100700002)(53546011)(38070700005)(9686003)(316002)(82960400001)(122000001)(55016002)(83380400001)(5660300002)(8676002)(110136005)(52536014)(508600001)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RYgINfd+GJfO+focW2JX5P2JReZsjMHLoSKtBL8JRdOeDiBA6Ey4OVrHr9yG?= =?us-ascii?Q?xTXxScA0FxHXVyYNn2T/lZAsXSk7ujmGTtQXHu7gn8UXlvmq7dbVjD5iSv6Y?= =?us-ascii?Q?Qi7RgSVTqPlUxk0QhJp9JdicoOxXpbjocM2qSfhvoLbmDXykDd/rEG3cMhHw?= =?us-ascii?Q?HB6mFYnD2g8TS0JhcdJEsWUWVff7aJD7tgbHRbGP+d9KsrbjzjEqbSlPnEcp?= =?us-ascii?Q?KaVUVPaf8RoxbzhVRpVClh0LGRbNE3oWuGHuYavRlYYZtR93SPWyFIp/DYeu?= =?us-ascii?Q?f9aGUnmO5Thu326WMPt6kO22ICQcK5Ry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?MHbkXf7aMe+7usyTnGeNDK3EqRVhA4IzMQkgo56OvQk34ZPbRIkgziGqXjON?= =?us-ascii?Q?MnpyrJMvihZ2f6y6ukJC/QCv0ieShlrWcjaamW5SSDTlRM4Qxm7TO2yqI9/R?= =?us-ascii?Q?BgnVZ3CxxqGW25HaS7kVG2zW6gEhK2vYPSkuGnB74x+1UXZ9UaBV9StLaamp?= =?us-ascii?Q?q0McH+rTPprq184/+Xmdc0eWIp8p?= 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: PH0PR11MB5596.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4105df68-10eb-408f-88c5-08d9930f538d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 14:47:08.3699 (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: XxAN87JlSVdHKRxHJOVUrY7uC+W6dAQ7GRvRxvgH1w87aKd9bAQeBJNhUkoBzGnigovdu9NeWienLB4W2wfIlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5611 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v12 1/4] Enable ASan Address Sanitization 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" Hi, David The v12 version has been submitted, and patch 3 and 4 has been acked. 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. > -----Original Message----- > From: Peng, ZhihongX > Sent: Tuesday, October 19, 2021 9:59 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 v12 1/4] Enable ASan Address Sanitization >=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. > v12:No change. > --- > 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..b95c460b19 100644 > --- a/doc/guides/prog_guide/index.rst > +++ b/doc/guides/prog_guide/index.rst > @@ -71,4 +71,5 @@ Programmer's Guide > writing_efficient_code > lto > profile_app > + asan > glossary > diff --git a/doc/guides/rel_notes/release_21_11.rst > b/doc/guides/rel_notes/release_21_11.rst > index d5435a64aa..63d9fef1b4 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 Address Sanitization.** > + > + `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