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 <waddlesplash@gmail.com>
This commit is contained in:
Jérôme Duval 2020-05-02 18:54:22 +02:00 committed by waddlesplash
parent 65b777592a
commit 12bd6e12a2

View File

@ -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);