mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Rich Felker <dalias@libc.org>
Cc: Nihal Jere <nihal@nihaljere.xyz>,  musl@lists.openwall.com
Subject: Re: [musl] Dynamic linker segfault
Date: Wed, 05 Jan 2022 09:56:25 +0100	[thread overview]
Message-ID: <8735m2ftmu.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20220104214211.GC7074@brightrain.aerifal.cx> (Rich Felker's message of "Tue, 4 Jan 2022 16:42:12 -0500")

* Rich Felker:

> This is a malformed program file not compatible with the machine page
> size (4k). Arguably it should be detected as p_align < PAGESIZE -- in
> a sense, p_align for LOAD segments is the maximum supported page size
> for the program file, and machines not capable of providing a page
> size that small can't map/run it. In theory the loader could allow
> this if all the differences between segments satisfy the right
> congruences and have matching permissions where the maps would
> overlap, but I'm not sure that's useful.

We've been looking at this on the glibc side recently.  The use case is
supporting large data alignments (greater than the kernel page size)
while not pessimizing multi-page-size targets such as POWER and AArch64.
With a p_align < PAGESIZE check, binaries need to specify p_align as the
largest support kernel page size (64K on those targets).  On a 64K page
kernel, this alignment happens naturally, but on a 4K (or 16K) kernel,
the loader needs to carve out a larger memory area and align it manually
to achieve 64K alignment (because that's what p_align says).  So far
this didn't happen because we only checked p_align against the kernel
size, we did not actually use it for aligning the mappings …

Thanks,
Florian


  reply	other threads:[~2022-01-05  8:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 21:27 Nihal Jere
2022-01-04 21:42 ` Rich Felker
2022-01-05  8:56   ` Florian Weimer [this message]
2022-01-05 13:49     ` Rich Felker
2022-01-05 14:00       ` Florian Weimer
2022-01-05 15:00         ` Rich Felker
2022-01-07 13:58           ` Florian Weimer
2022-01-07 17:35             ` Rich Felker
2022-01-10 13:30               ` Florian Weimer

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=8735m2ftmu.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nihal@nihaljere.xyz \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).