|
Message-ID: <CAGXu5j+OSzYx61-NN8XcBAVvMpCrPc2TFN66esK+-gFQtp_5pg@mail.gmail.com> Date: Thu, 18 Jan 2018 13:13:33 -0800 From: Kees Cook <keescook@...omium.org> To: Alexander Popov <alex.popov@...ux.com> Cc: kernel-hardening@...ts.openwall.com, PaX Team <pageexec@...email.hu>, Brad Spengler <spender@...ecurity.net>, Ingo Molnar <mingo@...nel.org>, Andy Lutomirski <luto@...nel.org>, Tycho Andersen <tycho@...ho.ws>, Laura Abbott <labbott@...hat.com>, Mark Rutland <mark.rutland@....com>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, Borislav Petkov <bp@...en8.de>, Thomas Gleixner <tglx@...utronix.de>, "H . Peter Anvin" <hpa@...or.com>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, "Dmitry V . Levin" <ldv@...linux.org>, X86 ML <x86@...nel.org> Subject: Re: [PATCH RFC v7 0/6] Introduce the STACKLEAK feature and a test for it On Thu, Jan 18, 2018 at 5:09 AM, Alexander Popov <alex.popov@...ux.com> wrote: > Hello Kees, > > On 17.01.2018 14:37, Alexander Popov wrote: >> On 15.01.2018 22:59, Kees Cook wrote: >>> On Fri, Jan 12, 2018 at 6:19 AM, Alexander Popov <alex.popov@...ux.com> wrote: >>>> This is the 7th version of the patch series introducing STACKLEAK to the >>>> mainline kernel. STACKLEAK is a security feature developed by Grsecurity/PaX >>>> (kudos to them), which: >>>> - reduces the information that can be revealed through kernel stack leak bugs; >>>> - blocks some uninitialized stack variable attacks (e.g. CVE-2010-2963); >>>> - introduces some runtime checks for kernel stack overflow detection. >>> >>> I think this is really looking good. I had some thoughts while reading >>> through the patches: >>> >>> There are really three features in this series, and it might make >>> sense to separate them a bit more clearly (at least with CONFIG >>> choices): >>> >>> 1) stack clearing (with depth searching) >>> >>> 2) runtime stack depth tracking (making 1 much more efficient) >>> >>> 3) alloca checking (an additional feature, not strictly part of >>> clearing, but needs the same plugin infrastructure) >>> >>> It seems like it should be possible to get 1 without 2 and 3 (both of >>> which happen in the gcc plugin), and might be good to separate for >>> builds that don't have gcc plugins. >>> >>> Once compilers are doing alloca checking (or all VLAs are removed from >>> the kernel), it'd be nice to be able to avoid the redundancy of 3. >> >> Agree with your point. I'll make this separation in the next version. > > I have more thoughts about this separation. > > Splitting (1) from (2) > ---------------------- > > It makes the stack erasing not only slow but also unreliable. For example, an > attacker can craft some STACKLEAK_POISON values on the thread stack to deceive > the poison search during the erasing. > > Of course, I can increase STACKLEAK_POISON_CHECK_DEPTH or change the default > value of lowest_stack. It will make the stack erasing even slower, but will not > give guarantees. Yeah, that's true. I was hoping the depth check was sufficient. > So I don't think that (1) without (2) is actually a good feature. I would > propose to refrain from separating the stack erasing and the lowest_stack tracking. How about an option to clear the _entire_ stack, then, when the plugin isn't available? That gives us a range of options and provides an easy way to compare the performance of the tracking. i.e. can compare off, full, and smart. > Splitting (2) and (3) > --------------------- > > The STACKLEAK gcc plugin needs to search for alloca anyway (for the correct > lowest_stack tracking). But I can introduce the "no-check-alloca" plugin > parameter for disabling the check_alloca() call insertion. > > Is it worth providing something like CONFIG_GCC_PLUGIN_STACKLEAK_NO_CHECK_ALLOCA > in the Kconfig? Nah, we can cross that bridge when the compilers have sane alloca checking. -Kees -- Kees Cook Pixel Security
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.