From: Mark Brown <broonie@kernel.org>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "bill.roberts@foss.arm.com" <bill.roberts@foss.arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"debug@rivosinc.com" <debug@rivosinc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>,
"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: Shadow Stack Locking Semantics between arch's
Date: Thu, 27 Aug 2026 22:41:45 +0100 [thread overview]
Message-ID: <apCvGct9U1yprAUE@sirena.org.uk> (raw)
In-Reply-To: <01b0fe86d5700847f78b0e6f839119f54ac88b04.camel@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
On Thu, Aug 27, 2026 at 09:27:06PM +0000, Edgecombe, Rick P wrote:
> On Thu, 2026-08-27 at 19:14 +0100, Mark Brown wrote:
> > On Thu, Aug 27, 2026 at 12:52:28PM -0500, Bill Roberts wrote:
> > > I am proposing and have questions over the following:
> > > 1. What should the behavior be if you had write locked and disable the
> > > shadow stack?
> > > - I can argue both ways here, -EPERM or success. I think I and most arches
> > > lead to failure.
> > Given that RISC-V doesn't support control of writes it's moot there
> > at the minute, and x86 currently uses arch_prctl() so will need an
> > additional API, it seems the path of least resistance is to allow it.
> > This also avoids locking writes (or pushes, for arm64) on effectively
> > also locking enable which seems neater.
> Hmm. I can't think of a reason to lock writes and not lock shadow stack too.
> Given likely no one is doing this, I wonder if we could change x86's behavior to
> match the others?
> The API would makes more sense to prevent disabling shadow stack if writes were
> enabled. It could return an EINVAL regardless if it is locked or not? Is that
> the arm behavior (forgetting about locked)?
arm64 currently treats each bit independently for simplicity. The main
use case I see for actually doing that is for preventing enabling writes
or pushes, though in practice I'd expect something doing locks to just
fully lock everything after having enabled the shadow stack. We can compose
the features easily enough so it seemed most straightforward to just let
userspace decide what it wants, it keeps the implementation simpler.
> > It has been on my list to look at this
> > repitition at some point, it had been held up by the clone3() stuff but
> > that seems to have died a death for now.
> Oh? What was the blocker?
Basically the glibc people weren't convinced they'd ever want to reuse a
shadow stack at which point having the kernel free and reallocate each time
is just as easy. It saves having to handle corner cases with threads that
didn't exit cleanly.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-08-27 21:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 17:15 Shadow Stack Locking Semantics between arch's Bill Roberts
2026-08-27 17:52 ` Bill Roberts
2026-08-27 18:14 ` Mark Brown
2026-08-27 21:27 ` Edgecombe, Rick P
2026-08-27 21:41 ` Mark Brown [this message]
2026-08-27 22:37 ` Edgecombe, Rick P
2026-08-28 13:27 ` Mark Brown
2026-08-28 16:48 ` Edgecombe, Rick P
2026-08-28 17:11 ` 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=apCvGct9U1yprAUE@sirena.org.uk \
--to=broonie@kernel.org \
--cc=bill.roberts@foss.arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=debug@rivosinc.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=rick.p.edgecombe@intel.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