DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] eal/linux: clear asan after allocation and before prefaulting
@ 2024-07-23  8:34 Alex Michon
  2024-10-08  9:36 ` David Marchand
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Michon @ 2024-07-23  8:34 UTC (permalink / raw)
  To: Thomas Monjalon, Anatoly Burakov; +Cc: dev, Alex Michon

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






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] eal/linux: clear asan after allocation and before prefaulting
  2024-07-23  8:34 [PATCH] eal/linux: clear asan after allocation and before prefaulting Alex Michon
@ 2024-10-08  9:36 ` David Marchand
  0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2024-10-08  9:36 UTC (permalink / raw)
  To: Alex Michon; +Cc: Thomas Monjalon, Anatoly Burakov, dev

On Thu, Jul 25, 2024 at 9:25 AM Alex Michon <amichon@kalrayinc.com> wrote:
>
> Prefaulting may generate asan error.

I am a bit surprised of this fix.
Could you give details on how to reproduce this issue?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-08  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-23  8:34 [PATCH] eal/linux: clear asan after allocation and before prefaulting Alex Michon
2024-10-08  9:36 ` David Marchand

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).