From: Alex Michon <amichon@kalrayinc.com>
To: Thomas Monjalon <thomas@monjalon.net>,
Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, Alex Michon <amichon@kalrayinc.com>
Subject: [PATCH] eal/linux: clear asan after allocation and before prefaulting
Date: Tue, 23 Jul 2024 10:34:19 +0200 [thread overview]
Message-ID: <20240723083419.12435-1-amichon@kalrayinc.com> (raw)
Prefaulting may generate asan error.
Signed-off-by: Alex Michon <amichon@kalrayinc.com>
---
.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 <aik@ozlabs.ru>
Alex Kiselev <alex@bisonrouter.com> <alex@therouter.net>
Alex Marginean <alexandru.marginean@nxp.com>
Alex Markuze <alex@weka.io>
+Alex Michon <amichon@kalrayinc.com>
Alex Porosanu <alexandru.porosanu@nxp.com>
Alex Rosenbaum <alexr@nvidia.com> <alexr@mellanox.com>
Alex Vesker <valex@nvidia.com>
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.
--
2.17.1
next reply other threads:[~2024-07-25 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 8:34 Alex Michon [this message]
2024-10-08 9:36 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723083419.12435-1-amichon@kalrayinc.com \
--to=amichon@kalrayinc.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).