All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Popov <alex.popov@linux.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-hardening@lists.openwall.com, keescook@chromium.org,
	pageexec@freemail.hu, spender@grsecurity.net,
	Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	tycho@docker.com, Laura Abbott <labbott@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Subject: [kernel-hardening] Re: [PATCH RFC v5 2/5] gcc-plugins: Add STACKLEAK plugin for tracking the kernel stack
Date: Mon, 30 Oct 2017 21:06:30 +0300	[thread overview]
Message-ID: <586ee584-df0d-3c82-a254-16ac1573255a@linux.com> (raw)
In-Reply-To: <20171030173216.72y673m32gra4b55@hirez.programming.kicks-ass.net>

Hello Peter,

Thanks for your reply.

On 30.10.2017 20:32, Peter Zijlstra wrote:
> On Mon, Oct 30, 2017 at 07:51:33PM +0300, Alexander Popov wrote:
>> When the thread stack is exhausted, this BUG() is hit. But do_error_trap(),
>> which handles the exception, calls track_stack() itself again (since it is
>> instrumented by the gcc plugin). So this recursion proceeds with exhausting the
>> thread stack.
> 
> Add a __attribute__((nostacktrack)) on it?

Yes, I already tried some blacklisting in the plugin, but it didn't really help,
because:

1. there are other (more than 5) instrumented functions, that are called during
BUG() handling too;

2. decreasing CONFIG_STACKLEAK_TRACK_MIN_SIZE would add more instrumented
functions, which should be manually blacklisted (not good).

I guess handling BUG() in another stack would be a solution. For example, Andy
Lutomirski calls handle_stack_overflow in the DOUBLEFAULT_STACK
(arch/x86/mm/fault.c). Should I do something similar?

Thanks!

Best regards,
Alexander

  reply	other threads:[~2017-10-30 18:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22  0:22 [kernel-hardening] [PATCH RFC v5 0/5] Introduce the STACKLEAK feature and a test for it Alexander Popov
2017-10-22  0:22 ` [kernel-hardening] [PATCH RFC v5 1/5] x86/entry: Add STACKLEAK erasing the kernel stack at the end of syscalls Alexander Popov
2017-10-23 13:17   ` [kernel-hardening] " Tycho Andersen
2017-10-24 21:30     ` Alexander Popov
2017-10-31 15:20       ` Kees Cook
2017-11-10 16:59         ` Alexander Popov
2017-10-22  0:22 ` [kernel-hardening] [PATCH RFC v5 2/5] gcc-plugins: Add STACKLEAK plugin for tracking the kernel stack Alexander Popov
2017-10-30 16:51   ` [kernel-hardening] " Alexander Popov
2017-10-30 17:32     ` Peter Zijlstra
2017-10-30 18:06       ` Alexander Popov [this message]
2017-11-14 15:36         ` Alexander Popov
2017-11-14 16:13           ` Andy Lutomirski
2017-11-14 16:33             ` Mark Rutland
2017-11-14 21:09               ` Alexander Popov
2017-11-14 21:17                 ` Andy Lutomirski
2017-11-14 22:03                   ` Alexander Popov
2017-11-14 21:50             ` Alexander Popov
2017-10-22  0:22 ` [kernel-hardening] [PATCH RFC v5 3/5] lkdtm: Add a test for STACKLEAK Alexander Popov
2017-10-22  0:22 ` [kernel-hardening] [PATCH RFC v5 4/5] fs/proc: Show STACKLEAK metrics in the /proc file system Alexander Popov
2017-10-22  0:22 ` [kernel-hardening] [PATCH RFC v5 5/5] doc: self-protection: Add information about STACKLEAK feature Alexander Popov
2017-10-22 13:11 ` [kernel-hardening] Re: [PATCH RFC v5 0/5] Introduce the STACKLEAK feature and a test for it Peter Zijlstra
2017-10-23  9:08   ` Mark Rutland
2017-10-23 12:11     ` Alexander Popov
2017-10-23 11:21   ` 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=586ee584-df0d-3c82-a254-16ac1573255a@linux.com \
    --to=alex.popov@linux.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=pageexec@freemail.hu \
    --cc=peterz@infradead.org \
    --cc=spender@grsecurity.net \
    --cc=tglx@linutronix.de \
    --cc=tycho@docker.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.