[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whVa=nm_GW=NVfPHqcxDbWt4JjjK1YWb0cLjO4ZSGyiDA@mail.gmail.com>
Date: Fri, 25 Jun 2021 19:05:58 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT
On Fri, Jun 25, 2021 at 4:30 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> I can't imagine who added this to load_elf_binary():
>
> if (current->personality & MMAP_PAGE_ZERO) {
> /* 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. */
> error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
> MAP_FIXED | MAP_PRIVATE, 0);
> }
>
> I think it was there before most of us were born. The comment has a
> torvaldsy/viroey feel to it.
Heh.
It goes back to at least 1.1.14 (1994, I think) and originates in the
ibcs code (Intel Binary Compatibility Specification 2), back in the
dark ages when we thought that mattered.
Native Linux binaries were still a.out at that point. When ELF then
became a native thing, we just moved (or copied) the old iBCS2 code
over, and that "map zeroes at NULL" came along.
And I think it's actually Eric Youngdale who did that code. See
https://www.linuxjournal.com/article/2809
and
https://www.linuxjournal.com/article/1059
https://www.linuxjournal.com/article/1060
> Do we really care about userspace which relies upon an SVR4 quirk? I
> guess it's too hard to prove the no case, so it stays.
I think we can safely remove it. Doing a mmap() at address zero will
not actually work anyway in any half-way modern Linux environment.
And I think the "map zeroes at NULL" wasn't even universal for SVr4.
_Some_ binaries may have expected it, but I suspect it was the
exception rather than the rule.
So I'd happily take a patch that just removes it. If nothing else, it
would be trivial to put back if somebody screams, but I seriously
doubt that is going to happen.
Linus
Powered by blists - more mailing lists