|
Message-ID: <CAGXu5jJ65i5nu7kZhSnE71ohuiz-FCxWvGapdktVzkvcf1FJfg@mail.gmail.com> Date: Wed, 20 Feb 2019 13:51:44 -0800 From: Kees Cook <keescook@...omium.org> To: Peter Zijlstra <peterz@...radead.org> Cc: "Reshetova, Elena" <elena.reshetova@...el.com>, "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, "luto@...nel.org" <luto@...nel.org>, "tglx@...utronix.de" <tglx@...utronix.de>, "mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de" <bp@...en8.de>, "tytso@....edu" <tytso@....edu> Subject: Re: [RFC PATCH] x86/entry/64: randomize kernel stack offset upon system call On Fri, Feb 8, 2019 at 6:26 AM Peter Zijlstra <peterz@...radead.org> wrote: > On Fri, Feb 08, 2019 at 01:20:09PM +0000, Reshetova, Elena wrote: > > > On Fri, Feb 08, 2019 at 02:15:49PM +0200, Elena Reshetova wrote: > > > > > > > Why can't we change the stack offset periodically from an interrupt or > > > so, and then have every later entry use that. > > > > Hm... This sounds more complex conceptually - we cannot touch > > stack when it is in use, so we have to periodically probe for a > > good time (when process is in userspace I guess) to change it from an interrupt? > > IMO trampoline stack provides such a good clean place for doing it and we > > have stackleak there doing stack cleanup, so would make sense to keep > > these features operating together. > > The idea was to just change a per-cpu (possible per-task if you ctxsw > it) offset that is used on entry to offset the stack. > > So only entries after the change will have the updated offset, any > in-progress syscalls will continue with their current offset and will be > unaffected. These defenses tend to need randomization between syscalls to actually disrupt an attack. (Take for example, the attack I demonstrated with uninitialized stack variables[1], which used back-to-back syscalls, one to prime the memory contents followed by one to use those values for an exploit.) (Though I would say that with CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y the uninitialized variables issue.) -Kees [1] https://www.defcon.org/images/defcon-19/dc-19-presentations/Cook/DEFCON-19-Cook-Kernel-Exploitation.pdf slide 21 -- Kees Cook
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.