From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "broonie@kernel.org" <broonie@kernel.org>
Cc: "adhemerval.zanella@linaro.org" <adhemerval.zanella@linaro.org>,
"nsz@port70.net" <nsz@port70.net>,
"brauner@kernel.org" <brauner@kernel.org>,
"shuah@kernel.org" <shuah@kernel.org>,
"debug@rivosinc.com" <debug@rivosinc.com>,
"fweimer@redhat.com" <fweimer@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"dalias@libc.org" <dalias@libc.org>,
"jeffxu@google.com" <jeffxu@google.com>,
"will@kernel.org" <will@kernel.org>,
"yury.khrustalev@arm.com" <yury.khrustalev@arm.com>,
"wilco.dijkstra@arm.com" <wilco.dijkstra@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"codonell@redhat.com" <codonell@redhat.com>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: [PATCH RFC 0/3] arm64/gcs: Allow reuse of user managed shadow stacks
Date: Fri, 26 Sep 2025 19:17:16 +0000 [thread overview]
Message-ID: <80f8389c5c136ce21d922be10e4978d1ae5f1139.camel@intel.com> (raw)
In-Reply-To: <5c616340-2767-48f0-8727-326deebf718f@sirena.org.uk>
On Fri, 2025-09-26 at 17:03 +0100, Mark Brown wrote:
> On Fri, Sep 26, 2025 at 03:39:46PM +0000, Edgecombe, Rick P wrote:
> > On Fri, 2025-09-26 at 16:07 +0100, Yury Khrustalev wrote:
>
> > > What do you mean by "a fuller solution from the glibc side"? A
> > > solution
> > > for re-using shadow stacks?
>
> > I mean some code or a fuller explained solution that uses this new
> > kernel functionality. I think the scheme that Florian suggested in
> > the
> > thread linked above (longjmp() to the start of the stack) will have
> > trouble if the thread pivots to a new shadow stack before exiting
> > (e.g.
> > ucontext).
>
> Is that supported even without user managed stacks?
IIUC longjmp() is sometimes used to implement user level thread
switching. So for non-shadow stack my understanding is that longjmp()
between user level threads is supported.
For shadow stack, I think user level threads are intended to be
supported. So I don't see why a thread could never exit from another
shadow stack? Is that what you are asking? Maybe we need to discuss
this with the glibc folks.
What I read in that thread you linked was that Florian was considering
using longjmp() as a way to inherit the solution to these unwinding
problems:
Not sure if it helps, but glibc always calls the exit system call from
the start routine, after unwinding the stack (with longjmp if
necessary).
https://marc.info/?l=glibc-alpha&m=175733266913483&w=2
Reading into the "...if necessary" a bit on my part. But if longjmp()
doesn't work to unwind from a non-thread shadow stack, then my question
would be how will glibc deal with if an app exits while on another
shadow stack? Just declare shadow stack re-use is not supported with
any user shadow stack pivoting? Does it need a new elf header bit then?
Again, I'm just thinking that we should vet the solution a bit more
before actually adding this to the kernel. If the combined shadow stack
effort eventually throws its hands up in frustration and goes with
WRSS/GCSSTR for apps that want to do more advanced threading patterns,
then we are already done on the kernel side.
next prev parent reply other threads:[~2025-09-26 19:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-21 13:21 Mark Brown
2025-09-21 13:21 ` [PATCH RFC 1/3] arm64/gcs: Support reuse of GCS for exited threads Mark Brown
2025-09-25 16:46 ` Catalin Marinas
2025-09-25 17:01 ` Mark Brown
2025-09-25 18:36 ` Catalin Marinas
2025-09-25 19:00 ` Mark Brown
2025-09-26 11:14 ` Catalin Marinas
2025-09-26 11:37 ` Mark Brown
2025-09-21 13:21 ` [PATCH RFC 2/3] kselftest/arm64: Validate PR_SHADOW_STACK_EXIT_TOKEN in basic-gcs Mark Brown
2025-09-21 13:21 ` [PATCH RFC 3/3] kselftest/arm64: Add PR_SHADOW_STACK_EXIT_TOKEN to gcs-locking Mark Brown
2025-09-25 20:40 ` [PATCH RFC 0/3] arm64/gcs: Allow reuse of user managed shadow stacks Edgecombe, Rick P
2025-09-25 23:22 ` Mark Brown
2025-09-25 23:58 ` Edgecombe, Rick P
2025-09-26 0:44 ` Mark Brown
2025-09-26 15:46 ` Edgecombe, Rick P
2025-09-26 16:09 ` Mark Brown
2025-09-29 18:37 ` Deepak Gupta
2025-09-26 15:07 ` Yury Khrustalev
2025-09-26 15:39 ` Edgecombe, Rick P
2025-09-26 16:03 ` Mark Brown
2025-09-26 19:17 ` Edgecombe, Rick P [this message]
2025-09-29 15:47 ` Mark Brown
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=80f8389c5c136ce21d922be10e4978d1ae5f1139.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=adhemerval.zanella@linaro.org \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=codonell@redhat.com \
--cc=dalias@libc.org \
--cc=debug@rivosinc.com \
--cc=fweimer@redhat.com \
--cc=jeffxu@google.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nsz@port70.net \
--cc=shuah@kernel.org \
--cc=wilco.dijkstra@arm.com \
--cc=will@kernel.org \
--cc=yury.khrustalev@arm.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
all inboxes | Powered by JetHome®