mmap in 6.0 vs. 6.1: apparent behaviour change wrt. MAP_FAILED & errno

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a question about an unexplained behaviour change of mmap().

The llvm project has a test case [1] that runs mmap in order to verify
that address ranges can be accessed..or something; I don't really understand
what the purpose is, but that's also beside the point.

It was recently found that this test fails when run on 6.1 but succeeds
by booting back to 6.0 [2]. This made me curious and you can find the
investigation on the bug. What I would like to learn is the *intended*
value of errno for mmap() hitting mmap_min_addr and returning MAP_FAILED
when running as non-root.

As my last comment indicates it looks like errno was ENOMEM and is now
EPERM, failing the assert. IMHO EPERM makes sense but the exact side effects
of MAP_FAILED are not really well documented; hitting mmap_min_addr seems to
be a grey area. I poked around the mm subtree and found the EPERM addition
from (I think) 2019; maybe this test was never run since then?

The test can be run standalone by downloading mmap.c and test.h from the same
directory, and compiling with 'clang++ -fsanitize=memory mmap.cpp'.
Adding the perror() from my comment makes the behaviour a bit more visible.
Like I said, I don't know whether the test is even correct to begin with -
I'm just trying to add context to the bug so that a committer can fix it.

Thanks for any input!
Holger

[1] https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/msan/mmap.cpp
[2] https://github.com/llvm/llvm-project/issues/59717




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux