diff options
author | Jeff Xu <jeffxu@chromium.org> | 2024-08-06 23:49:27 +0200 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2024-08-14 18:56:48 +0200 |
commit | 44f65d900698278a8451988abe0d5ca37fd46882 (patch) | |
tree | dd9e6a1cc68db8ca862015ee1108ebf5a4f1a535 /mm/mseal.c | |
parent | binfmt_elf: Dump smaller VMAs first in ELF cores (diff) | |
download | linux-44f65d900698278a8451988abe0d5ca37fd46882.tar.xz linux-44f65d900698278a8451988abe0d5ca37fd46882.zip |
binfmt_elf: mseal address zero
In load_elf_binary as part of the execve(), when the current
task’s personality has MMAP_PAGE_ZERO set, the kernel allocates
one page at address 0. According to the comment:
/* Why this, you ask??? Well SVr4 maps page 0 as read-only,
and some applications "depend" upon this behavior.
Since we do not have the power to recompile these, we
emulate the SVr4 behavior. Sigh. */
At one point, Linus suggested removing this [1].
Code search in debian didn't see much use of MMAP_PAGE_ZERO [2],
it exists in util and test (rr).
Sealing this is probably safe, the comment doesn't say
the app ever wanting to change the mapping to rwx. Sealing
also ensures that never happens.
If there is a complaint, we can make this configurable.
Link: https://lore.kernel.org/lkml/CAHk-=whVa=nm_GW=NVfPHqcxDbWt4JjjK1YWb0cLjO4ZSGyiDA@mail.gmail.com/ [1]
Link: https://codesearch.debian.net/search?q=MMAP_PAGE_ZERO&literal=1&perpkg=1&page=1 [2]
Signed-off-by: Jeff Xu <jeffxu@chromium.org>
Link: https://lore.kernel.org/r/20240806214931.2198172-2-jeffxu@google.com
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'mm/mseal.c')
-rw-r--r-- | mm/mseal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mseal.c b/mm/mseal.c index bf783bba8ed0..7a40a84569c8 100644 --- a/mm/mseal.c +++ b/mm/mseal.c @@ -248,7 +248,7 @@ static int apply_mm_seal(unsigned long start, unsigned long end) * * unseal() is not supported. */ -static int do_mseal(unsigned long start, size_t len_in, unsigned long flags) +int do_mseal(unsigned long start, size_t len_in, unsigned long flags) { size_t len; int ret = 0; |