- fix the unit test mmap detecting the MAP_NORESERVE flag support (but NetBSD does not implement it).
Details
- Reviewers
krytarowski slthakur eugenis
Diff Detail
Event Timeline
test/msan/mmap.cc | ||
---|---|---|
67 | ifdef MAP_NORESERVE |
$ grep -r MAP_NORESERVE /usr/include/sys /usr/include/sys/mman.h:#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ $ uname -a NetBSD rugged 8.99.14 NetBSD 8.99.14 (GENERIC) #1: Thu Apr 26 15:16:44 CEST 2018 root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
The code looks fine.. but I don't like the description.
NetBSD has the flag available, but it does not support/implement it. It's dummy.
Does it look better to you now ? It s ok I won t bother you more than that I have commit access now :-)
Two questions,
- How does MSan work at all if MAP_NORESERVE is not implemented? Is it actually the default setting, and it's the opposite behavior that is not implemented?
- If the flag is defined in the headers but ignored by the kernel, then what is the purpose of this patch?
This patch is more for systems not implementing it (as NetBSD) or even not having this flag (as FreeBSD).
However the flag is defined for FreeBSD into lib sanitizer (sanitizer_posix_libcdep.cc line 45) for MmapFixedNoReserve.
OK, fine.
Just keep in mind that this test tries to exhaust the address space, but, without NORESERVE semantics, it would exhaust physical RAM instead and may DOS the entire system.
i.e. unless you've tested it on one of those systems, it might be safer to disable the test instead
This design is most likely the same on all current BSDs. OpenBSD borrowed UVM from NetBSD. FreeBSD has its distinct memory subsystem.
ifdef MAP_NORESERVE