From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>,
Nick Clifton <nickc@redhat.com>,
Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH v2] elf: Set p_align to the minimum page size if possible
Date: Fri, 24 Dec 2021 18:50:30 -0800 [thread overview]
Message-ID: <CAMe9rOrfO101Qq2Mz4XcBBDc9+sm5A6CQwVa4zg=2dOrHEndEw@mail.gmail.com> (raw)
In-Reply-To: <YcZt60iKcfgqm54A@squeak.grove.modra.org>
On Fri, Dec 24, 2021 at 5:03 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Dec 22, 2021 at 06:38:54AM -0800, H.J. Lu wrote:
> > I choose commonpagesize due to this glibc bug:
> >
> > https://sourceware.org/bugzilla/show_bug.cgi?id=28688
>
> This means we are stuck. Choosing commonpagesize or minpagesize will
> generate binaries that won't run with older glibc if the actual page
> size is maxpagesize (assuming maxpagesize != commonpagesize).
We can make this new behavior as opt-in since this is an optimization
for ld.so.
> I don't see a way to change DT_LOAD p_align that is backwards
> compatible, except perhaps using a p_align of zero if the required
> segment alignment (as calculated from section alignment) is less than
> maxpagesize. That horrible hack just happens to work for older glibc,
> but may break other loaders.
Neither 0 nor 1 work for older glibc:
if (__glibc_unlikely ((ph->p_align & (GLRO(dl_pagesize) - 1)) != 0))
{
errstring = N_("ELF load command alignment not page-aligned");
goto lose;
}
if (__glibc_unlikely (((ph->p_vaddr - ph->p_offset)
& (ph->p_align - 1)) != 0))
{
errstring
= N_("ELF load command address/offset not properly aligned");
goto lose;
}
--
H.J.
next prev parent reply other threads:[~2021-12-25 2:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 16:32 [PATCH] elf: Set p_align to the common " H.J. Lu
2021-12-16 8:52 ` Fangrui Song
2021-12-16 14:33 ` H.J. Lu
2021-12-20 16:36 ` Florian Weimer
2021-12-20 18:39 ` H.J. Lu
2021-12-20 18:51 ` Florian Weimer
2021-12-20 18:59 ` H.J. Lu
2021-12-20 19:25 ` Florian Weimer
2021-12-20 19:31 ` H.J. Lu
2021-12-20 19:51 ` Florian Weimer
2021-12-20 15:50 ` H.J. Lu
2021-12-22 8:57 ` Alan Modra
2021-12-22 14:38 ` [PATCH v2] elf: Set p_align to the minimum " H.J. Lu
2021-12-25 1:03 ` Alan Modra
2021-12-25 2:50 ` H.J. Lu [this message]
2021-12-25 3:04 ` Alan Modra
2021-12-25 3:08 ` H.J. Lu
2021-12-25 3:58 ` Alan Modra
[not found] ` <f64b9fb3-7d2d-7ff3-a8f6-795292af6744@redhat.com>
[not found] ` <CAMe9rOrvGXXEJAESEgTbhgQJee__Ak9+OvFwzWa0Nxv+m+OjLg@mail.gmail.com>
2022-01-05 10:17 ` [PATCH] elf: Set p_align to the common " Nick Clifton
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='CAMe9rOrfO101Qq2Mz4XcBBDc9+sm5A6CQwVa4zg=2dOrHEndEw@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=fweimer@redhat.com \
--cc=nickc@redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).