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 CCDAFA0555 for ; Wed, 25 May 2022 18:29:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A93C0400EF; Wed, 25 May 2022 18:29:00 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 218FB400EF for ; Wed, 25 May 2022 18:28:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653496138; 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; bh=2Xd91jdl+HztRQY3qBUjL+LmtW9so97a0yNHKIvNWd4=; b=d/3uiEyIfbW4czTIjxTRbxVBx0hkwEe2Iz1z7Dds90evvopJWXr6iFPrM1HeoLc/3NJa5I R2bZD/+uxNsKACLhN6xhGBptbudPRsIHwBYGV85PRR1FweUuWkAMvbH++g4Ymogn99BPGg TiUp/3jYsDFwgPe/ABGbCsOHEaJVcUQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186-bx5w-DdpM82-9KcmYCG_gw-1; Wed, 25 May 2022 12:28:57 -0400 X-MC-Unique: bx5w-DdpM82-9KcmYCG_gw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9F6D1C05AE1; Wed, 25 May 2022 16:28:56 +0000 (UTC) Received: from rh.Home (unknown [10.39.193.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8CBD2026D64; Wed, 25 May 2022 16:28:55 +0000 (UTC) From: Kevin Traynor To: David Marchand Cc: Anatoly Burakov , dpdk stable Subject: patch 'test/mem: disable ASan when accessing unallocated memory' has been queued to stable release 21.11.2 Date: Wed, 25 May 2022 17:27:53 +0100 Message-Id: <20220525162847.711753-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/30/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/03e1864411b8a198ee065d9dc2e24102ed262518 Thanks. Kevin --- >From 03e1864411b8a198ee065d9dc2e24102ed262518 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Thu, 5 May 2022 11:29:51 +0200 Subject: [PATCH] test/mem: disable ASan when accessing unallocated memory [ upstream commit 48ff13ef37cbd63ecba9b28d5377444964c9c49f ] As described in bugzilla, ASan reports accesses to all memory segment as invalid, since those parts have not been allocated with rte_malloc. Move __rte_no_asan to rte_common.h and disable ASan on a part of the test. Bugzilla ID: 880 Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") Signed-off-by: David Marchand Acked-by: Anatoly Burakov --- app/test/test_memory.c | 5 +++++ lib/eal/common/malloc_elem.h | 10 ++-------- lib/eal/include/rte_common.h | 13 +++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/test/test_memory.c b/app/test/test_memory.c index 140ac3f3cf..440e5ef838 100644 --- a/app/test/test_memory.c +++ b/app/test/test_memory.c @@ -26,4 +26,9 @@ */ +/* + * ASan complains about accessing unallocated memory. + * See: https://bugs.dpdk.org/show_bug.cgi?id=880 + */ +__rte_no_asan static int check_mem(const struct rte_memseg_list *msl __rte_unused, diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h index c5f26ffd2f..503fe5c470 100644 --- a/lib/eal/common/malloc_elem.h +++ b/lib/eal/common/malloc_elem.h @@ -8,4 +8,6 @@ #include +#include + #define MIN_DATA_SIZE (RTE_CACHE_LINE_SIZE) @@ -126,10 +128,4 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem) RTE_PTR_ADD(ASAN_MEM_SHIFT(mem), ASAN_SHADOW_OFFSET) -#if defined(__clang__) -#define __rte_no_asan __attribute__((no_sanitize("address", "hwaddress"))) -#else -#define __rte_no_asan __attribute__((no_sanitize_address)) -#endif - __rte_no_asan static inline void @@ -271,6 +267,4 @@ old_malloc_size(struct malloc_elem *elem) #else /* !RTE_MALLOC_ASAN */ -#define __rte_no_asan - static inline void asan_set_zone(void *ptr __rte_unused, size_t len __rte_unused, diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 4a399cc7c8..eee1ada379 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -243,4 +243,17 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) #define __rte_cold __attribute__((cold)) +/** + * Disable AddressSanitizer on some code + */ +#ifdef RTE_MALLOC_ASAN +#ifdef RTE_CC_CLANG +#define __rte_no_asan __attribute__((no_sanitize("address", "hwaddress"))) +#else +#define __rte_no_asan __attribute__((no_sanitize_address)) +#endif +#else /* ! RTE_MALLOC_ASAN */ +#define __rte_no_asan +#endif + /*********** Macros for pointer arithmetic ********/ -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-25 17:26:58.683524696 +0100 +++ 0001-test-mem-disable-ASan-when-accessing-unallocated-mem.patch 2022-05-25 17:26:58.525828270 +0100 @@ -1 +1 @@ -From 48ff13ef37cbd63ecba9b28d5377444964c9c49f Mon Sep 17 00:00:00 2001 +From 03e1864411b8a198ee065d9dc2e24102ed262518 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 48ff13ef37cbd63ecba9b28d5377444964c9c49f ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -37 +38 @@ -index c5f65895e1..952ce7343b 100644 +index c5f26ffd2f..503fe5c470 100644 @@ -47 +48 @@ -@@ -132,10 +134,4 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem) +@@ -126,10 +128,4 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem) @@ -58 +59 @@ -@@ -277,6 +273,4 @@ old_malloc_size(struct malloc_elem *elem) +@@ -271,6 +267,4 @@ old_malloc_size(struct malloc_elem *elem) @@ -66 +67 @@ -index 67587025ab..d56a7570c0 100644 +index 4a399cc7c8..eee1ada379 100644 @@ -69 +70 @@ -@@ -268,4 +268,17 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) +@@ -243,4 +243,17 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)