eal/linux: clear asan after allocation and before prefaulting
Checks
Commit Message
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(+)
Comments
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?
Hello David,
I ran some more tests and it turns out that this issue was already fixed by this commit:
4d8bdd8b56 malloc: fix ASan handling for unmapped memory
Sorry about the noise,
Alex
Hello Alex,
On Tue, Oct 22, 2024 at 5:40 PM Alex Michon <amichon@kalrayinc.com> wrote:
>
> I ran some more tests and it turns out that this issue was already fixed by this commit:
> 4d8bdd8b56 malloc: fix ASan handling for unmapped memory
>
> Sorry about the noise,
No problem.
Thanks for the update.
@@ -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>
@@ -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.