|
Message-ID: <4be8dc73-4873-44e5-8ef6-62e55d5023a7@sirena.org.uk>
Date: Wed, 21 Feb 2024 00:40:16 +0000
From: Mark Brown <broonie@...nel.org>
To: Stefan O'Rear <sorear@...tmail.com>
Cc: Rick P Edgecombe <rick.p.edgecombe@...el.com>,
Rich Felker <dalias@...c.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Szabolcs Nagy <Szabolcs.Nagy@....com>,
"musl@...ts.openwall.com" <musl@...ts.openwall.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
Catalin Marinas <catalin.marinas@....com>,
Jonathan Corbet <corbet@....net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
Oliver Upton <oliver.upton@...ux.dev>,
Palmer Dabbelt <palmer@...belt.com>, debug <debug@...osinc.com>,
Albert Ou <aou@...s.berkeley.edu>,
"shuah@...nel.org" <shuah@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Marc Zyngier <maz@...nel.org>,
"oleg@...hat.com" <oleg@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
Kees Cook <keescook@...omium.org>,
James Morse <james.morse@....com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Will Deacon <will@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Thiago Jung Bauermann <thiago.bauermann@...aro.org>,
"H.J. Lu" <hjl.tools@...il.com>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Ard Biesheuvel <ardb@...nel.org>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>
Subject: Re: Re: [PATCH v8 00/38] arm64/gcs: Provide support for GCS
in userspace
On Tue, Feb 20, 2024 at 06:59:58PM -0500, Stefan O'Rear wrote:
> On Tue, Feb 20, 2024, at 6:30 PM, Edgecombe, Rick P wrote:
> > Maybe I'm misunderstanding. I thought the proposal included allowing
> > shadow stack access to convert normal address ranges to shadow stack,
> > and normal writes to convert shadow stack to normal.
> Ideally for riscv only writes would cause conversion, an incssp underflow
> which performs shadow stack reads would be able to fault early.
> For arm, since a syscall is needed anyway to set up the token in a new
> shadow stack region, it would make sense for conversion from non-shadow
> to shadow usage to never be automatic.
Well, we only need the token to pivot in userspace so we could
*potentially* work something out as part of the conversion process.
It's not filling me with enthusiasm though, and I've certainly not
actually thought it through yet.
> > I agree though that the late allocation failures are not great. Mark is
> > working on clone3 support which should allow moving the shadow stack
> > allocation to happen in userspace with the normal stack. Even for riscv
> > though, doesn't it need to update a new register in stack switching?
> > BTW, x86 shadow stack has a mode where the shadow stack is writable
> > with a special instruction (WRSS). It enables the SSP to be set
> > arbitrarily by writing restore tokens. We discussed this as an option
> > to make the existing longjmp() and signal stuff work more transparently
> > for glibc.
We have this feature on arm64 too, plus a separately controllable push
instruction (though that's less useful here).
> > BTW, when I talk about "not supporting" I don't mean the app should
> > crash. I mean it should instead run normally, just without shadow stack
> > enabled. Not sure if that was clear. Since shadow stack is not
> > essential for an application to function, it is only security hardening
> > on top.
> I appreciate that. How far can we go in that direction? If we can
> automatically disable shadow stacks on any call to makecontext, sigaltstack,
> or pthread_attr_setstack without causing other threads to crash if they were
> in the middle of shadow stack maintenance we can probably simplify this
> proposal, although I need to think more about what's possible.
Aside from concerns about disabling over all the threads in the process
(which should be solvable if annoying) this would be incompatible with
policies which prevent disabling of shadow stacks, and it feels like it
might end up being a gadget people could use which will concern some
people. There's a tension here between compatibility and the security
applications of these features.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.