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 283F5A0C55; Wed, 13 Oct 2021 18:45:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12C384111A; Wed, 13 Oct 2021 18:45:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 3EAE8410E8 for ; Wed, 13 Oct 2021 18:45:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634143537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PE/ady3mhbgE5RWkwjhWmurO74KMZV+Rm/fisBURKGc=; b=D11Y4F5vKnGZgsMVvdPpwZdPuq9gxKdPnk5QiUVnIl28CM61eA8HtOYemzLmZ3txxDl0YJ OM5hAxKPxEW6/Rn+hT1w2Qpc8mcTmM2MlV7/aouf3aF3FJSh8/aqAZK2vAu3dZQybfPXou 4AgkN1L9miZRuLTx+/7psqeuFfHunRo= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487--0WbY0onM1W9HYtbeXwq9g-1; Wed, 13 Oct 2021 12:45:36 -0400 X-MC-Unique: -0WbY0onM1W9HYtbeXwq9g-1 Received: by mail-lf1-f70.google.com with SMTP id z29-20020a195e5d000000b003fd437f0e07so2381526lfi.20 for ; Wed, 13 Oct 2021 09:45:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PE/ady3mhbgE5RWkwjhWmurO74KMZV+Rm/fisBURKGc=; b=dRYokO19hPk5neMLwoyIsbI7smyORR0C3KQr2x0kxd41mjrhlIX3SfD1Mug8nF2F8g Lfxfvj4KNVWmZkxYXa7Qk1pMugYLWm4piWxjk/F9hC7I4+uuqcF0fXcqH/aIOVa71DuI cxKmUppeLqy0TsObkOEmztXLIMNYCY3g4qnY9q0yI7+q6/fZrI+XuX/UMxu6RBeK/2wB 07mV1MDSpbY6XyVp3VL4GFlf/zI+pBXNLFQNGw2QfLMvb+I7ffokHB0XxJ00l+ZEDkqk HoQMCwyWBJLtliFuFU/pKaPqENaBMVNOxGv+TnRDn3fytTTUUphBic20Ub7Nv/dvRbq9 ByJw== X-Gm-Message-State: AOAM530Ii3XRM04YRHNtg7K92Y2a2xIlmPyJy84ZMyetC/xpf6JwFdvm OHRyErWtXM9eg9+7+jW8AEo6oU272Sy+YYuztwzJDAw4ALR61sKmQlqopvB6oED1D+vqK/elwko V/xahpFtx3wnhaMQ05+M= X-Received: by 2002:a2e:8e34:: with SMTP id r20mr415716ljk.333.1634143534912; Wed, 13 Oct 2021 09:45:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS6pd6qyNSvrnApPs5QRrE5Cu16IKV+bJw9rzPXES6rca5lQd8rramOEChCJtwyBH2ihIAypGUCxpjK2f7tCM= X-Received: by 2002:a2e:8e34:: with SMTP id r20mr415681ljk.333.1634143534700; Wed, 13 Oct 2021 09:45:34 -0700 (PDT) MIME-Version: 1.0 References: <20211011062810.422220-1-zhihongx.peng@intel.com> <20211012094318.1154727-1-zhihongx.peng@intel.com> <20211012094318.1154727-2-zhihongx.peng@intel.com> In-Reply-To: <20211012094318.1154727-2-zhihongx.peng@intel.com> From: David Marchand Date: Wed, 13 Oct 2021 18:45:23 +0200 Message-ID: To: Zhihong Peng Cc: "Burakov, Anatoly" , "Ananyev, Konstantin" , Stephen Hemminger , dev , Xueqin Lin , Bruce Richardson , Thomas Monjalon Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v9 2/3] DPDK code adapts to ASan 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" On Tue, Oct 12, 2021 at 11:54 AM wrote: > > From: Zhihong Peng > > DPDK ASan functionality is currently only supported Linux x86_64. > Support other platforms, need to define ASAN_SHADOW_OFFSET value > according to google ASan document, and configure meson > (config/meson.build). > > Signed-off-by: Xueqin Lin > Signed-off-by: Zhihong Peng > --- > v7: Split doc and code into two. > v8: No change. > v9: Modify the definition of RTE_MALLOC_ASAN. > --- > config/meson.build | 2 + > lib/eal/common/malloc_elem.c | 26 ++++- > lib/eal/common/malloc_elem.h | 194 ++++++++++++++++++++++++++++++++++- > lib/eal/common/malloc_heap.c | 12 +++ > lib/eal/common/rte_malloc.c | 9 +- > 5 files changed, 238 insertions(+), 5 deletions(-) > > diff --git a/config/meson.build b/config/meson.build > index 5170b79fed..1ae9390e68 100644 > --- a/config/meson.build > +++ b/config/meson.build > @@ -419,6 +419,8 @@ if get_option('b_sanitize') =3D=3D 'address' > error('broken dependency, "libasan"') > endif > endif > + > + dpdk_conf.set10('RTE_MALLOC_ASAN', true) The test on architecture =3D=3D x86_64 is missing. ARM compilation with ASan is broken. $ ./devtools/test-meson-builds.sh ... ... ninja: Entering directory `/home/dmarchan/builds/build-arm64-bluefield' [0/1] Regenerating build files. The Meson build system Version: 0.59.0 Source dir: /home/dmarchan/dpdk Build dir: /home/dmarchan/builds/build-arm64-bluefield ... [2/2784] Compiling C object lib/librte_eal.a.p/eal_common_eal_common_memzon= e.c.o FAILED: lib/librte_eal.a.p/eal_common_eal_common_memzone.c.o aarch64-linux-gnu-gcc -Ilib/librte_eal.a.p -Ilib -I../../dpdk/lib -I. -I../../dpdk -Iconfig -I../../dpdk/config -Ilib/eal/include -I../../dpdk/lib/eal/include -Ilib/eal/linux/include -I../../dpdk/lib/eal/linux/include -Ilib/eal/arm/include -I../../dpdk/lib/eal/arm/include -Ilib/eal/common -I../../dpdk/lib/eal/common -Ilib/eal -I../../dpdk/lib/eal -Ilib/kvargs -I../../dpdk/lib/kvargs -Ilib/metrics -I../../dpdk/lib/metrics -Ilib/telemetry -I../../dpdk/lib/telemetry -fdiagnostics-color=3Dalways -fsanitize=3Daddress -fno-omit-frame-pointer -D_FILE_OFFSET_BITS=3D64 -Wall -Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-zero-length-bounds -D_GNU_SOURCE -fPIC -mcpu=3Dcortex-a72 -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation '-DABI_VERSION=3D"22.0"' -DRTE_LIBEAL_USE_GETENTROPY -DRTE_LOG_DEFAULT_LOGTYPE=3Dlib.eal -MD -MQ lib/librte_eal.a.p/eal_common_eal_common_memzone.c.o -MF lib/librte_eal.a.p/eal_common_eal_common_memzone.c.o.d -o lib/librte_eal.a.p/eal_common_eal_common_memzone.c.o -c ../../dpdk/lib/eal/common/eal_common_memzone.c In file included from ../../dpdk/lib/eal/include/rte_log.h:25, from ../../dpdk/lib/eal/common/eal_common_memzone.c:14: ../../dpdk/lib/eal/common/malloc_elem.h: In function =E2=80=98asan_set_zone= =E2=80=99: ../../dpdk/lib/eal/common/malloc_elem.h:118:35: error: =E2=80=98ASAN_SHADOW_OFFSET=E2=80=99 undeclared (first use in this function= ); did you mean =E2=80=98ASAN_SHADOW_SCALE=E2=80=99? 118 | RTE_PTR_ADD(ASAN_MEM_SHIFT(mem), ASAN_SHADOW_OFFSET) | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/include/rte_common.h:250:58: note: in definition of macro =E2=80=98RTE_PTR_ADD=E2=80=99 250 | #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x))) | ^ ../../dpdk/lib/eal/common/malloc_elem.h:142:12: note: in expansion of macro =E2=80=98ASAN_MEM_TO_SHADOW=E2=80=99 142 | shadow =3D ASAN_MEM_TO_SHADOW((uintptr_t)ptr + offset); | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/common/malloc_elem.h:118:35: note: each undeclared identifier is reported only once for each function it appears in 118 | RTE_PTR_ADD(ASAN_MEM_SHIFT(mem), ASAN_SHADOW_OFFSET) | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/include/rte_common.h:250:58: note: in definition of macro =E2=80=98RTE_PTR_ADD=E2=80=99 250 | #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x))) | ^ ../../dpdk/lib/eal/common/malloc_elem.h:142:12: note: in expansion of macro =E2=80=98ASAN_MEM_TO_SHADOW=E2=80=99 142 | shadow =3D ASAN_MEM_TO_SHADOW((uintptr_t)ptr + offset); | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/common/malloc_elem.h: In function =E2=80=98asan_set_redz= one=E2=80=99: ../../dpdk/lib/eal/common/malloc_elem.h:118:35: error: =E2=80=98ASAN_SHADOW_OFFSET=E2=80=99 undeclared (first use in this function= ); did you mean =E2=80=98ASAN_SHADOW_SCALE=E2=80=99? 118 | RTE_PTR_ADD(ASAN_MEM_SHIFT(mem), ASAN_SHADOW_OFFSET) | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/include/rte_common.h:250:58: note: in definition of macro =E2=80=98RTE_PTR_ADD=E2=80=99 250 | #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x))) | ^ ../../dpdk/lib/eal/common/malloc_elem.h:196:18: note: in expansion of macro =E2=80=98ASAN_MEM_TO_SHADOW=E2=80=99 196 | front_shadow =3D ASAN_MEM_TO_SHADOW(head_redzone); | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/common/malloc_elem.h: In function =E2=80=98asan_clear_re= dzone=E2=80=99: ../../dpdk/lib/eal/common/malloc_elem.h:118:35: error: =E2=80=98ASAN_SHADOW_OFFSET=E2=80=99 undeclared (first use in this function= ); did you mean =E2=80=98ASAN_SHADOW_SCALE=E2=80=99? 118 | RTE_PTR_ADD(ASAN_MEM_SHIFT(mem), ASAN_SHADOW_OFFSET) | ^~~~~~~~~~~~~~~~~~ ../../dpdk/lib/eal/include/rte_common.h:250:58: note: in definition of macro =E2=80=98RTE_PTR_ADD=E2=80=99 250 | #define RTE_PTR_ADD(ptr, x) ((void*)((uintptr_t)(ptr) + (x))) | ^ ../../dpdk/lib/eal/common/malloc_elem.h:235:17: note: in expansion of macro =E2=80=98ASAN_MEM_TO_SHADOW=E2=80=99 235 | head_shadow =3D ASAN_MEM_TO_SHADOW(head_redzone); | ^~~~~~~~~~~~~~~~~~ [31/2784] Compiling C object lib/librte_eal.a.p/eal_linux_eal_interrupts.c.= o ninja: build stopped: subcommand failed. --=20 David Marchand -- David Marchand