From patchwork Tue Jul 23 08:34:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Michon X-Patchwork-Id: 142713 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74026456B1; Thu, 25 Jul 2024 09:24:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C1B041101; Thu, 25 Jul 2024 09:24:54 +0200 (CEST) Received: from smtpout149.security-mail.net (smtpout149.security-mail.net [85.31.212.149]) by mails.dpdk.org (Postfix) with ESMTP id 8B0F440150 for ; Tue, 23 Jul 2024 10:34:59 +0200 (CEST) Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 68153349998 for ; Tue, 23 Jul 2024 10:34:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1721723699; bh=AtWzX6+VD8P3oJ0l2AwDdX8JkfWqy5xXRPkgi8VZmN0=; h=From:To:Cc:Subject:Date; b=P9pTZu7WfvKEVRlDLvk0FR2jisDnXz5zUHvnClA02uougkR2u3HrfcyqEldnkCWRr 0GulUZ+1QnPVqMS6i2YwhbGAT3BKpzuZeKCBeK2+4RXAQ4LlyRm8exiqFlif9+P8aT StKZihnUE+YYbqFQFyegVqg62dD2EG4/gQT0QBXg= Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 3E8C634998D; Tue, 23 Jul 2024 10:34:59 +0200 (CEST) Received: from PA5P264CU001.outbound.protection.outlook.com (mail-francecentralazlp17010001.outbound.protection.outlook.com [40.93.76.1]) by fx409.security-mail.net (Postfix) with ESMTPS id 8673E34985D; Tue, 23 Jul 2024 10:34:58 +0200 (CEST) Received: from MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:36::24) by MR1P264MB2449.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:32::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Tue, 23 Jul 2024 08:34:56 +0000 Received: from MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM ([fe80::c26f:de2d:13a8:eb05]) by MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM ([fe80::c26f:de2d:13a8:eb05%3]) with mapi id 15.20.7784.017; Tue, 23 Jul 2024 08:34:56 +0000 X-Secumail-id: <185.669f6b32.82c8c.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oPgRM6P3hsy9aBAGZC0orMveUf23PAiCRqtkSfUJa100PJsJPAmqUlBGC+Y4EhNNWcgB3F793k6iGi7bjT/LPPx0s6eFpE1zZt6XUEom79MbVWttrm0LkF5fZFR5UqIgKSfJRJzIaLN6jTrXxbPUXPHVi6BD7Gm1bNw3TCKfi9lqjtml3X8GUXiJDKPF7WOeT91y6AxNtk5oCWyGbeAzERthXJUAzmEBiK5UNTod5chggauuXPTYONJOkAvoIU6pfOgDwrcIwT01jFHObV+kpMtxKF7dRo6bm0/B5ExTxOzi2WEv5CFHZhGd+adyZ/GBBlverKaDG2B+A4Ii+Ey66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=OiKSdDw8XTnH9mA5tZYwqo1VF4NCDFDHygk12zGDSvg=; b=kvXUDDxIVtlRYX73sW3p+k0wHFzqzQrcmrBe+w4Oi/1FxYaRyd8EnPENMZBtxOQmSh7UR5WEZA+mg3a4o6k0P9uTruvTAthKbMlR0AfRj2SpVhXOILLjHRoKpKzdi43EneWZrub8TdDBCwqpSl18QDyCC7xkV77sb/WDz6EKzBE86T4Snkvkwd4/bFIOoYlmDw+JMt86heEEPYzPCWKDXHQC/Xdoyep6tiSz5JgUKHNQg42mHgmOMhbYkGXuhMttKJSKcsliOklS04Cc0S5xEDz3omf67qjHMCK3aTygpWBKztlPwD8qo1lYTxbY00ggWIiLEQdob29YHMcjeBMrpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OiKSdDw8XTnH9mA5tZYwqo1VF4NCDFDHygk12zGDSvg=; b=rTB4pJdN+tkGKoYPfT7Fb2N/TDdv8XqlitvEnFGMAmmSvSaPBCEjRIE75fAK42QmiblG1VrfVJstbKKdJmSJ6nNAxH+8op2w2ZqHLYjMX2IqSV4D3WwastqLsy2Wl5gbHj/XsrJwZ8653LbOdGifnK76h95Q1RN1SDpRrb4BqFVk4x0ckVAmtJk0ArayatUaGz8aSc9tRJakzIAHGe22UtLLpZEDqS5Zfakg2uavgFzUu3A/4ZRgSbzJkcEdBkgzqEGjs5MdtEa7aU0KyaWhejjSrF9ujslUHD38xmeRwtWefItYPDFJ/FJ764EBK4PIwOcxQlWgaXd+OUlhH/wUtw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Alex Michon To: Thomas Monjalon , Anatoly Burakov Cc: dev@dpdk.org, Alex Michon Subject: [PATCH] eal/linux: clear asan after allocation and before prefaulting Date: Tue, 23 Jul 2024 10:34:19 +0200 Message-ID: <20240723083419.12435-1-amichon@kalrayinc.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: PR1P264CA0086.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:345::12) To MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:36::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2785:EE_|MR1P264MB2449:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d28d1ff-8a72-4c61-80cb-08dcaaf254eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: p4psYMoKc4rkDf24Y8axKHHysfsjqJsL+3aQNCIbtHQjMNRGzDuYeQu7jvb/7a8DPt5pIQu6/+IbB0CnND4OZdB0xzGBCtqexop0OefoFlRmjgbZZJv3ZhnOoWzOO/+GXml7FfgtpNqsJHDokERuUSD+XtEqxKGYb5AwKHTbgWL68Ojd0Xccsek49c3//j/ac8cCsM3RoDwFAlmNJzNXw5bEbqNLAeaTVbbBtlNOGgJs9o6sPK80qw+X6ui1P++ITWZEkJXAUltudq8ZvTZexO1Nhv78IXxD3ffSaJ9vp4ynu2T9rHN8tDg77ZoWPy4S8vDK9t/+21q1lHjJBTRLNSz4QqPKrAZUoTmnVfVl4qE7THW7+WYBgASMjasfxehdJ3isRILHRTLpDtpat/fHgt/YDQzpxfcxLrY/jYaQmVB54hKD9YexRwUCOgfFGj9JRRu/PWsD24hHWWbQ9GegHkVndYZaPSxH3KmMg8yStRXXG284mtxHvUiMJ6vy/2xRaElKhUMlcxr4ZZxToePbs3FiiGbJkKBcu52e8pPAp30mLa6QhWRF6XeeEPvIPr1OQFYxONj9p4ha49azrahZOOvHrpg7kFoHLc2dd5+VUQEWSE7BA9mReHMVDpGhLD6JSWcNCR41/19A5+ylbO4gQFClpc4yXmI9wy6mUXcoYKWEU1pJSDcOy4Sf56O1oVB/0hUS2i2w+6l0xPI+GzMzoiTgEhS57f7FOu46synxfrwFVnzF3XhANEcS68rQ8XgmXcysjrEQEB6gjJssRGCsxb5wOLQ3IFxILCmwUD/hZZoQOpb8jy7hy1mMHBp1t4kOEt/xlrNrOH4UMI7ydURRyT/UeIOx4ystD6JSvgXIHHzG4SDQ33FVKMkGPIweHwXtuREEj3sZKCHfyvPywxWCWXtfrx0AOgEafweF48OlxwHuBisU3sZTFn9VxH2kI4CiFFY M10cCl0nE/nbMV9tSPFjLvWyz68TiYEAsQO+m1PPYCU48xuIAgd/UL21FrS6eO1AmNjHvjxtq3Hqnsz049OHhtoalTk5y2Nqe5b2fP9yITMX9F5zoJseo9FsIdgsPp7oZfXTQDxFpZUSyF05gZpuMwwl0iusmm2Dy5WlUQXLoQyaHVNGSs4tXed1DwFQY9nkgKOBXlB1ytXxY1bnpAYTniVeq7639VPJAXW+3bNn6EC1SCkEXTzxfWuS29zC9TayZ2/No2n6j+XI3KUMwxJl93k28flV/D6qkC79VUNOgOJ+cgddU3e3vw4aJPr4PcdUbo17Hs6jSXW/pMIlc4qEFn2zN9MEJ3hjqTIRjGUH3G1TLjP+AXCDNvnnyjRrRnCSademJeFcVpygTu1M5ACaEepaM2EcFEX/3gVV2N6PhzWArBVG4dE7Ib75TIvMJgb6y5NpfIU2Qnd5EMJqH6g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O+0o0ICCLM7X76fHRZacClaxgE0TQEfSQW5e3IcKPC3Si5HcEYqscgWczwJ7L+aehTaiO1DDP1W0S1VhARHrRG3/iidZng5YDUWPr2JOShvz5RVS9nlpHbrBl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2Wq8yW6zaCqzd4aK77bat0FatgS3ez1yDj/Eh35URD9kbgEyDl54IA2UWXYQs9nJo+l08raFAeMm+NOUeutBU7pIQSHFtNk1tFiMNX4jaRY5+XcLMQgzsOLnTh+L+Sxj7viC2ImjN8gDaVJlPtM0aKyApgJXThUCtWDlGa9MGhCcPcZrVe2m8Ri5C2AlUZdHG1V085u1UzWLWIMRrt2RJa9fWz4nbUEDZD3uyzwfDmXHvybiuWdLty3NEl4T71Xj6E2qsayLJeZAQrWEMl0lOeZe/lWBFJjJyKUA9wiYzpOx7IlCn1SMCMgMeJ7MVq2gY0tPJgoySu4qqItrkABoeZkor4ueWaL+iXB01Ug8F2zwwHd+VT2fs6JsPZ8SZR/vQKOHHJV/VEdD X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d28d1ff-8a72-4c61-80cb-08dcaaf254eb X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2785.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2024 08:34:56.5494 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: esV9EHntPdRRmD0WvL81HwCFaszvqzLsXUJUYjbARYXLRAtagg5IwAgJgJbZRFp18P7pvhouDbLZ/ABBU+J1vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB2449 X-ALTERMIMEV2_out: done X-Mailman-Approved-At: Thu, 25 Jul 2024 09:24:52 +0200 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 Prefaulting may generate asan error. Signed-off-by: Alex Michon --- .mailmap | 1 + lib/eal/linux/eal_memalloc.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.mailmap b/.mailmap index 3f3f0442e5..b1655a4080 100644 --- a/.mailmap +++ b/.mailmap @@ -60,6 +60,7 @@ Alexey Kardashevskiy Alex Kiselev Alex Marginean Alex Markuze +Alex Michon Alex Porosanu Alex Rosenbaum Alex Vesker diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c index e354efc95d..b9c631ea88 100644 --- a/lib/eal/linux/eal_memalloc.c +++ b/lib/eal/linux/eal_memalloc.c @@ -38,6 +38,8 @@ #include "eal_memcfg.h" #include "eal_private.h" +#include "malloc_elem.h" + const int anonymous_hugepages_supported = #ifdef MAP_HUGE_SHIFT 1; @@ -636,6 +638,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, goto mapped; } + /* Ensure the prefault doesn't trigger ASAN errors */ + asan_set_zone(addr, alloc_sz, 0); + /* we need to trigger a write to the page to enforce page fault and * ensure that page is accessible to us, but we can't overwrite value * that is already there, so read the old value, and write itback.