From: Ingo Molnar <mingo@kernel.org>
To: Alexander Popov <alex.popov@linux.com>
Cc: kernel-hardening@lists.openwall.com,
Kees Cook <keescook@chromium.org>,
PaX Team <pageexec@freemail.hu>,
Brad Spengler <spender@grsecurity.net>,
Andy Lutomirski <luto@kernel.org>,
Tycho Andersen <tycho@tycho.ws>,
Laura Abbott <labbott@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Borislav Petkov <bp@alien8.de>,
Richard Sandiford <richard.sandiford@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"Dmitry V . Levin" <ldv@altlinux.org>,
Emese Revfy <re.emese@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Thomas Garnier <thgarnie@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexei Starovoitov <ast@kernel.org>, Josef Bacik <jbacik@fb.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Nicholas Piggin <npiggin@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Ding Tianhong <dingtianhong@huawei.com>,
David Woodhouse <dwmw@amazon.co.uk>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Dominik Brodowski <linux@dominikbrodowski.net>,
Juergen Gross <jgross@suse.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dan Williams <dan.j.williams@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Mathias Krause <minipli@googlemail.com>,
Vikas Shivappa <vikas.shivappa@linux.intel.com>,
Kyle Huey <me@kylehuey.com>,
Dmitry Safonov <dsafonov@virtuozzo.com>,
Will Deacon <will.deacon@arm.com>, Arnd Bergmann <arnd@arndb.de>,
Florian Weimer <fweimer@redhat.com>,
Boris Lukashev <blukashev@sempervictus.com>,
Andrey Konovalov <andreyknvl@google.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v13 (resend) 2/6] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls
Date: Fri, 6 Jul 2018 00:20:06 +0200 [thread overview]
Message-ID: <20180705222006.GA5410@gmail.com> (raw)
In-Reply-To: <45db2e83-5b87-0083-924f-f1ce7c89fe73@linux.com>
* Alexander Popov <alex.popov@linux.com> wrote:
> 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.
Or we could use what every other performance critical instrumentation feature uses
to reduce overhead (ftrace, perf): kernel patching.
> > 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;
Only in text mode - very few users are using text mode.
> 2. WARN_ON() here gives absolutely same 'PANIC: double fault' here.
that should only happen if the kernel is otherwise already fatally corrupted,
right?
Thanks,
Ingo
next prev parent reply other threads:[~2018-07-05 22:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 16:58 [PATCH v13 (resend) 0/6] Introduce the STACKLEAK feature and a test for it Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 1/6] gcc-plugins: Clean up the cgraph_create_edge* macros Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 2/6] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls Alexander Popov
2018-06-22 18:58 ` Laura Abbott
2018-06-27 0:13 ` Kees Cook
2018-06-27 0:21 ` Kees Cook
2018-06-27 0:55 ` Laura Abbott
2018-07-05 8:12 ` Ingo Molnar
2018-07-05 10:00 ` Peter Zijlstra
2018-07-05 10:35 ` Ingo Molnar
2018-07-05 21:55 ` Alexander Popov
2018-07-05 22:20 ` Ingo Molnar [this message]
2018-07-06 11:46 ` Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 3/6] gcc-plugins: Add STACKLEAK plugin for tracking the kernel stack Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 4/6] lkdtm: Add a test for STACKLEAK Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 5/6] fs/proc: Show STACKLEAK metrics in the /proc file system Alexander Popov
2018-06-22 16:58 ` [PATCH v13 (resend) 6/6] doc: self-protection: Add information about STACKLEAK feature Alexander Popov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180705222006.GA5410@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=alex.popov@linux.com \
--cc=andreyknvl@google.com \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=aryabinin@virtuozzo.com \
--cc=ast@kernel.org \
--cc=blukashev@sempervictus.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dingtianhong@huawei.com \
--cc=dsafonov@virtuozzo.com \
--cc=dwmw@amazon.co.uk \
--cc=fweimer@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jbacik@fb.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=labbott@redhat.com \
--cc=ldv@altlinux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=luto@kernel.org \
--cc=mark.rutland@arm.com \
--cc=me@kylehuey.com \
--cc=mhiramat@kernel.org \
--cc=minipli@googlemail.com \
--cc=npiggin@gmail.com \
--cc=pageexec@freemail.hu \
--cc=re.emese@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=rostedt@goodmis.org \
--cc=spender@grsecurity.net \
--cc=tglx@linutronix.de \
--cc=thgarnie@google.com \
--cc=torvalds@linux-foundation.org \
--cc=tycho@tycho.ws \
--cc=vikas.shivappa@linux.intel.com \
--cc=viro@zeniv.linux.org.uk \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.