From 12bd6e12a208bf68a1dac5dcb4f0124a3a811d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 2 May 2020 18:54:22 +0200 Subject: [PATCH] mmap: using PROT_NONE usually means the memory isn't actually used. A program can mmap virtual memory which will only trigger signal handlers. This is for instance needed for ASAN. Change-Id: I4a42b4860b5acab17465683e9cf73c486bea7d40 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2554 Reviewed-by: waddlesplash --- src/system/libroot/posix/sys/mman.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/libroot/posix/sys/mman.cpp b/src/system/libroot/posix/sys/mman.cpp index bcbaee9ed5..8de57a3dd7 100644 --- a/src/system/libroot/posix/sys/mman.cpp +++ b/src/system/libroot/posix/sys/mman.cpp @@ -131,6 +131,8 @@ mmap(void* address, size_t length, int protection, int flags, int fd, areaProtection |= B_WRITE_AREA; if ((protection & PROT_EXEC) != 0) areaProtection |= B_EXECUTE_AREA; + if (protection == PROT_NONE) + areaProtection = B_OVERCOMMITTING_AREA; // create a name for this area based on calling image void* addr = __builtin_return_address(0);