From: "alice" <alice@ayaya.dev>
To: "Rich Felker" <dalias@libc.org>
Cc: <musl@lists.openwall.com>
Subject: Re: [musl] [PATCH] fix MINSIGSTKSZ and SIGSTKSZ for powerpc64
Date: Thu, 29 Aug 2024 21:11:38 +0200 [thread overview]
Message-ID: <D3SMTQEDYREF.1RDFESZ8O5D45@ayaya.dev> (raw)
In-Reply-To: <20240829190348.GL10433@brightrain.aerifal.cx>
On Thu Aug 29, 2024 at 9:03 PM CEST, Rich Felker wrote:
> On Thu, Aug 29, 2024 at 06:00:52PM +0200, alice wrote:
> > On Thu Aug 29, 2024 at 2:57 PM CEST, Rich Felker wrote:
> > > On Thu, Aug 29, 2024 at 05:38:42AM +0200, psykose wrote:
> > > > since kernel commit 2f82ec19757f58549467db568c56e7dfff8af283
> > > > (https://github.com/torvalds/linux/commit/2f82ec19757f58549467db568c56e7dfff8af283)
> > > > the kernel has updated these minimum values. having these small values breaks
> > > > sysconf(_SC_MINSIGSTKSZ) too; it returns 4224 in musl currently which ends up
> > > > returning ENOMEM from the syscall made in sigaltstack.
> > > >
> > > > raising these to match the kernel fixes sigaltstack use on powerpc64(le).
> > > > caught by glib's 2.82 testsuite
> > >
> > > I don't follow how you're claiming sysconf(_SC_MINSIGSTKSZ) is broken.
> > > It will just return the kernel-provided value on new kernels that
> > > insist on having a larger stack. In particular I don't see where the
> > > value 4224 is supposed to be coming from. If there's something I'm
> > > missing, please explain.
> >
> > sysconf(_SC_MINSIGSTKSZ) returns 4224 on ppc64le (this is as far as i know
> > expected).
>
> I don't have a real system handy to test on, so I'm executing this
> mentally, and not seeing where 4224 comes from.
> sysconf(_SC_MINSIGSTKSZ) should return the kernel-provided value from
> __getauxval(AT_MINSIGSTKSZ) unless it's less than the fixed macro
> value MINSIGSTKSZ. Since that's 4096, the only way I can see this
> happening is if the kernel filled in AT_MINSIGSTKSZ as 4224, which
> would be a kernel bug...?
yes, that getauxval gives 4224.
feel free to forward it to the right place if you think it's a kernel bug :)
(it might just be an oversight since it was coordinated with glibc and so no
programs ever hit this as glibc made the minimum match the 8192 correctly..)
> > setting stack.ss_size = 4224 (from that call) and passing it to sigaltstack
> > returns ENOMEM because it is smaller than 8192 which the kernel enforces.
> >
> > ...so the normal way of using sigaltstack with the smallest size (with sysconf or
> > the macros) is broken.
> > making the MINSIGSTKSZ match the actual value the kernel enforces fixes it.
>
> What the kernel enforces varies by version and possibly also hardware
> capabilities.
evidently it's enforcing exactly what that commit says that minsigstksz is (now)
on ppc64*, since setting ss_size to 8191 gives ENOMEM and setting it to 8192
works.
you can wait for a hypothetical fix to __getauxval(AT_MINSIGSTKSZ) to also
return 8192 if you want, but programs that use the macro defined value will
remain broken if it isn't changed and clearly that is the minimum value on new
kernels :)
i'll keep the patch downstream in any case
>
> Rich
next prev parent reply other threads:[~2024-08-29 19:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 3:38 psykose
2024-08-29 12:57 ` Rich Felker
2024-08-29 16:00 ` alice
2024-08-29 19:03 ` Rich Felker
2024-08-29 19:11 ` alice [this message]
2024-08-29 20:23 ` Rich Felker
2024-08-31 16:33 ` Rich Felker
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=D3SMTQEDYREF.1RDFESZ8O5D45@ayaya.dev \
--to=alice@ayaya.dev \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.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.
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).