Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 6 Jul 2018 00:55:48 +0300
From: Alexander Popov <>
To: Ingo Molnar <>
Cc:, Kees Cook <>,
 PaX Team <>, Brad Spengler <>,
 Andy Lutomirski <>, Tycho Andersen <>,
 Laura Abbott <>, Mark Rutland <>,
 Ard Biesheuvel <>, Borislav Petkov <>,
 Richard Sandiford <>,
 Thomas Gleixner <>, "H . Peter Anvin" <>,
 Peter Zijlstra <>, "Dmitry V . Levin"
 <>, Emese Revfy <>,
 Jonathan Corbet <>, Andrey Ryabinin <>,
 "Kirill A . Shutemov" <>,
 Thomas Garnier <>,
 Andrew Morton <>,
 Alexei Starovoitov <>, Josef Bacik <>,
 Masami Hiramatsu <>, Nicholas Piggin <>,
 Al Viro <>, "David S . Miller" <>,
 Ding Tianhong <>, David Woodhouse
 <>, Josh Poimboeuf <>,
 Steven Rostedt <>,
 Dominik Brodowski <>,
 Juergen Gross <>,
 Linus Torvalds <>,
 Greg Kroah-Hartman <>,
 Dan Williams <>,
 Dave Hansen <>,
 Mathias Krause <>,
 Vikas Shivappa <>, Kyle Huey
 <>, Dmitry Safonov <>,
 Will Deacon <>, Arnd Bergmann <>,
 Florian Weimer <>,
 Boris Lukashev <>,
 Andrey Konovalov <>,,
Subject: Re: [PATCH v13 (resend) 2/6] x86/entry: Add STACKLEAK erasing the
 kernel stack at the end of syscalls

Hello Ingo,

Thanks for your review! I'll fix the style issues you pointed at.

Please also see my answers below.

On 05.07.2018 11:12, Ingo Molnar wrote:
>> +	  The tradeoff is the performance impact: on a single CPU system kernel
>> +	  compilation sees a 1% slowdown, other systems and workloads may vary
>> +	  and you are advised to test this feature on your expected workload
>> +	  before deploying it.
> Is there a way to patch this out runtime? I.e. if a distro enabled it, is there an 
> easy way to disable much of the overhead without rebooting the kernel?

Hm. We can't completely disable STACKLEAK in runtime, since STACKLEAK gcc plugin
performs compile-time instrumentation of the kernel code. So we can only chop
off a part of functionality, for example, by introducing some variable and
checking it before every stack erasing (additional performance impact), but the
kernel will stay uselessly instrumented. It doesn't look reasonable to me.

>> +	BUG_ON(boundary - kstack_ptr >= THREAD_SIZE);
> Should never happen, right? 

Yes. It can happen only if 'current->lowest_stack' was corrupted.

> If so then please make this:
> 	if (WARN_ON(boundary - kstack_ptr >= THREAD_SIZE))
> 		return;
> or so, to make it non-fatal and to allow users to report it, should it trigger 
> against all expectations.

I've made an experiment. The results:
 1. BUG_ON() here doesn't freeze the kernel output - I see a full 'PANIC: double
fault' report;
 2. WARN_ON() here gives absolutely same 'PANIC: double fault' here.

So there is no reason to introduce the surplus "WARN_ON() + return" logic here.

> Overall I like the interface cleanups in v13, so if these nits are addressed and 
> it becomes possible for (root users) to disable the checking then I suppose this 
> is fine.

Thanks a lot for your positive attitude.

Best regards,

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.