From: "Holger Hoffstätte" <holger@applied-asynchrony.com>
To: linux-mm <linux-mm@kvack.org>
Subject: mmap in 6.0 vs. 6.1: apparent behaviour change wrt. MAP_FAILED & errno
Date: Tue, 10 Jan 2023 21:58:11 +0100 [thread overview]
Message-ID: <6c1932ac-3cea-5ccf-202d-38358b08deec@applied-asynchrony.com> (raw)
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
reply other threads:[~2023-01-10 20:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c1932ac-3cea-5ccf-202d-38358b08deec@applied-asynchrony.com \
--to=holger@applied-asynchrony.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox