linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/1] binfmt_elf: seal address zero
@ 2024-08-01 17:08 jeffxu
  2024-08-01 17:08 ` [RFC PATCH v1 1/1] binfmt_elf: mseal " jeffxu
  2024-08-05 21:01 ` [RFC PATCH v1 0/1] binfmt_elf: seal " Kees Cook
  0 siblings, 2 replies; 5+ messages in thread
From: jeffxu @ 2024-08-01 17:08 UTC (permalink / raw)
  To: akpm, keescook, jannh, sroettger, adhemerval.zanella, ojeda, adobriyan
  Cc: linux-kernel, linux-mm, jorgelo, Jeff Xu

From: Jeff Xu <jeffxu@chromium.org>

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].

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.

[1] https://lore.kernel.org/lkml/CAHk-=whVa=nm_GW=NVfPHqcxDbWt4JjjK1YWb0cLjO4ZSGyiDA@mail.gmail.com/

Jeff Xu (1):
  binfmt_elf: mseal address zero

 fs/binfmt_elf.c    | 4 ++++
 include/linux/mm.h | 4 ++++
 mm/mseal.c         | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.46.0.rc1.232.g9752f9e123-goog



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-05 21:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-01 17:08 [RFC PATCH v1 0/1] binfmt_elf: seal address zero jeffxu
2024-08-01 17:08 ` [RFC PATCH v1 1/1] binfmt_elf: mseal " jeffxu
2024-08-05 21:05   ` Kees Cook
2024-08-05 21:33     ` Jeff Xu
2024-08-05 21:01 ` [RFC PATCH v1 0/1] binfmt_elf: seal " Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox