From: Dave Martin <Dave.Martin@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Joey Gouly <joey.gouly@arm.com>
Subject: Re: [PATCH] arm64: signal: Update sigcontext reservations table
Date: Tue, 30 Jul 2024 16:07:22 +0100 [thread overview]
Message-ID: <ZqkBqvmRS/DMbODp@e133380.arm.com> (raw)
In-Reply-To: <ce031548-15c5-453d-8a2e-46d533c4a4f8@sirena.org.uk>
On Tue, Jul 30, 2024 at 02:22:47PM +0100, Mark Brown wrote:
> On Tue, Jul 30, 2024 at 01:51:22PM +0100, Dave Martin wrote:
> > On Mon, Jul 29, 2024 at 06:01:02PM +0100, Mark Brown wrote:
>
> > > Hrm, indeed. I think while you're at clarifying this it'd be good to
> > > clarify what we're thinking of as opting in - is it userspace as a whole
> > > we're thinking of or is it a specific dynamically linked binary?
> > > There's also things like the dynamic linker and code generation options
> > > in the compiler to worry about here...
>
> > I think that the opt-in has to be per running process.
>
> Yes, I tend to agree.
>
> > Since making the opt-in decision correctly requires some effort, I
> > expected that most programs just won't bother and won't opt in unless
> > they actually need a given feature in order to work at all.
>
> Well, it only requires thought if you do something that pays attention
> to the signal frame layout - an awful lot of programs simply don't look
> at the frame and so don't care. There are things like userspace threads
> which are particularly likely to be impacted but there's also a lot of
> code that just handles a signal and returns without ever looking at the
> frame.
A program can't not pay attention to the sigframe _size_, i.e., even if
you ignore the sigcontext, you still have to have allocated your stack
big enough for it.
That's the fundamental issue here.
> > Ideally, the toolchain would mark binaries with the features they are
> > compatible with, and try to load only compatible objects into the same
> > process. The ELF properties (as used for BTI etc.) provide a generic
> > mechanism for this, but maybe we need to start pushing for labelling
> > for other properties too. The "can it trigger an oversized sigframe"
> > property of an arch feature won't be obvious to the toolchain folks.
>
> Hrm. I can see this being fun with working out how the various
> extensions compose with each other and how to turn things that the
> toolchain usually wouldn't be aware of on.
That's why I went for a simplified model:
If a program exercises no opt-ins at all, then the sigframe must fit in
MINSIGSTKSZ bytes.
If the program exercises any opt-in at all, the sigframe is not
guaranteed to fit in MINSIGSTKSZ bytes. It's then the program's
responsibility to pay attention to the real worst-case size advertised
in AT_MINSIGSTKSZ in the auxv.
As noted in the references, programs built against glibc-2.34 or later
with -D_GNU_SOURCE (or -D_DYNAMIC_STACK_SIZE_SOURCE) will actually be
using values based on the AT_MINSIGSTKSZ parameter rather than the old
constant; uses of MINSIGSTKSZ and SIGSTKSZ that require it to be
compile-time constant won't compile.
The idea of the table in sigcontext.h was to help us track where opt-
ins are needed, and what opt-in conditions exist. This maybe wasn't as
clear as it could have been.
Cheers
---Dave
next prev parent reply other threads:[~2024-07-30 15:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 14:41 [PATCH] arm64: signal: Update sigcontext reservations table Dave Martin
2024-07-29 14:53 ` Mark Brown
2024-07-29 15:51 ` Dave Martin
2024-07-29 17:01 ` Mark Brown
2024-07-30 12:51 ` Dave Martin
2024-07-30 13:22 ` Mark Brown
2024-07-30 15:07 ` Dave Martin [this message]
2024-07-30 16:00 ` Mark Brown
2024-07-31 10:38 ` Dave Martin
2024-07-31 11:49 ` Mark Brown
2024-07-31 14:38 ` Dave Martin
2024-07-31 14:58 ` Mark Brown
2024-07-31 16:09 ` Dave Martin
2024-07-31 16:14 ` Mark Brown
2024-07-31 16:23 ` Dave Martin
2024-08-20 13:37 ` Will Deacon
2024-08-20 14:38 ` Dave Martin
2024-08-23 11:46 ` Will Deacon
2024-09-03 14:18 ` Dave Martin
2024-09-03 18:26 ` Mark Brown
2024-09-04 11:24 ` Dave Martin
2024-09-04 11:49 ` Mark Brown
2024-09-05 10:59 ` Dave Martin
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=ZqkBqvmRS/DMbODp@e133380.arm.com \
--to=dave.martin@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.