aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mem.h
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-02-07 11:58:16 +0100
committerBenoît Ganne <bganne@cisco.com>2020-02-07 12:00:48 +0100
commit1557d9a30dace17c5254d8abc5fad98776fef4c6 (patch)
treeb264c728a657401e025ef7549c99ee8c85db030d /src/vppinfra/mem.h
parentedf777272b211de3d54f5dc7b211ee84cdb31373 (diff)
misc: address sanitizer: fix vm instrumentation
Type: fix Change-Id: Ifd61c0683c85fe7340965c225ed23e46ec88e01a Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vppinfra/mem.h')
-rw-r--r--src/vppinfra/mem.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h
index 5492e106d91..c00c78ad9a4 100644
--- a/src/vppinfra/mem.h
+++ b/src/vppinfra/mem.h
@@ -363,6 +363,8 @@ clib_mem_vm_alloc (uword size)
mmap_addr = mmap (0, size, PROT_READ | PROT_WRITE, flags, -1, 0);
if (mmap_addr == (void *) -1)
mmap_addr = 0;
+ else
+ CLIB_MEM_UNPOISON (mmap_addr, size);
return mmap_addr;
}
@@ -371,6 +373,7 @@ always_inline void
clib_mem_vm_free (void *addr, uword size)
{
munmap (addr, size);
+ CLIB_MEM_POISON (addr, size);
}
always_inline void *
@@ -386,6 +389,8 @@ clib_mem_vm_unmap (void *addr, uword size)
mmap_addr = mmap (addr, size, PROT_NONE, flags, -1, 0);
if (mmap_addr == (void *) -1)
mmap_addr = 0;
+ else
+ CLIB_MEM_UNPOISON (mmap_addr, size);
return mmap_addr;
}
@@ -399,6 +404,8 @@ clib_mem_vm_map (void *addr, uword size)
mmap_addr = mmap (addr, size, (PROT_READ | PROT_WRITE), flags, -1, 0);
if (mmap_addr == (void *) -1)
mmap_addr = 0;
+ else
+ CLIB_MEM_UNPOISON (mmap_addr, size);
return mmap_addr;
}