|
Message-ID: <20200422180153.GD3121@willie-the-truck> Date: Wed, 22 Apr 2020 19:01:53 +0100 From: Will Deacon <will@...nel.org> To: Kees Cook <keescook@...omium.org> Cc: Sami Tolvanen <samitolvanen@...gle.com>, Catalin Marinas <catalin.marinas@....com>, James Morse <james.morse@....com>, Steven Rostedt <rostedt@...dmis.org>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, Mark Rutland <mark.rutland@....com>, Masahiro Yamada <masahiroy@...nel.org>, Michal Marek <michal.lkml@...kovi.net>, Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>, Dave Martin <Dave.Martin@....com>, Laura Abbott <labbott@...hat.com>, Marc Zyngier <maz@...nel.org>, Masami Hiramatsu <mhiramat@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, Jann Horn <jannh@...gle.com>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, clang-built-linux@...glegroups.com, kernel-hardening@...ts.openwall.com, linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH v11 01/12] add support for Clang's Shadow Call Stack (SCS) On Wed, Apr 22, 2020 at 10:51:02AM -0700, Kees Cook wrote: > On Wed, Apr 22, 2020 at 06:39:47PM +0100, Will Deacon wrote: > > On Mon, Apr 20, 2020 at 02:18:30PM -0700, Sami Tolvanen wrote: > > > On Mon, Apr 20, 2020 at 06:17:28PM +0100, Will Deacon wrote: > > > > > + * The shadow call stack is aligned to SCS_SIZE, and grows > > > > > + * upwards, so we can mask out the low bits to extract the base > > > > > + * when the task is not running. > > > > > + */ > > > > > + return (void *)((unsigned long)task_scs(tsk) & ~(SCS_SIZE - 1)); > > > > > > > > Could we avoid forcing this alignment it we stored the SCS pointer as a > > > > (base,offset) pair instead? That might be friendlier on the allocations > > > > later on. > > > > > > The idea is to avoid storing the current task's shadow stack address in > > > memory, which is why I would rather not store the base address either. > > > > What I mean is that, instead of storing the current shadow stack pointer, > > we instead store a base and an offset. We can still clear the base, as you > > do with the pointer today, and I don't see that the offset is useful to > > an attacker on its own. > > > > But more generally, is it really worthwhile to do this clearing at all? Can > > you (or Kees?) provide some justification for it, please? We don't do it > > for anything else, e.g. the pointer authentication keys, so something > > feels amiss here. > > It's a hardening step to just reduce the lifetime of a valid address > exposed in memory. In fact, since there is a cache, I think it should be > wiped even in scs_release(). But we don't do this for /anything/ else and it forces alignment restrictions on the SCS allocation. Please either do it consistently, or not at all. Will
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.