Prefaulting may generate asan error.

Signed-off-by: Alex Michon <amic...@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 <a...@ozlabs.ru>
 Alex Kiselev <a...@bisonrouter.com> <a...@therouter.net>
 Alex Marginean <alexandru.margin...@nxp.com>
 Alex Markuze <a...@weka.io>
+Alex Michon <amic...@kalrayinc.com>
 Alex Porosanu <alexandru.poros...@nxp.com>
 Alex Rosenbaum <al...@nvidia.com> <al...@mellanox.com>
 Alex Vesker <va...@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





Reply via email to