All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: David Laight <David.Laight@aculab.com>
Cc: Andy Lutomirski <luto@kernel.org>,
	Elena Reshetova <elena.reshetova@intel.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Kees Cook <keescook@chromium.org>, Jann Horn <jannh@google.com>,
	"Perla, Enrico" <enrico.perla@intel.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [RFC PATCH] x86/entry/64: randomize kernel stack offset upon syscall
Date: Wed, 20 Mar 2019 07:51:01 -0700	[thread overview]
Message-ID: <25395187-837A-4689-9387-5ACCE78E4DF3@amacapital.net> (raw)
In-Reply-To: <30998bcd55a34ed38b681f9bb3e3fb87@AcuMS.aculab.com>


> On Mar 20, 2019, at 4:12 AM, David Laight <David.Laight@aculab.com> wrote:
> 
> From: Andy Lutomirski
>> Sent: 18 March 2019 20:16
> ...
>>> As a result this patch introduces 8 bits of randomness
>>> (bits 4 - 11 are randomized, bits 0-3 must be zero due to stack alignment)
>>> after pt_regs location on the thread stack.
>>> The amount of randomness can be adjusted based on how much of the
>>> stack space we wish/can trade for security.
>> 
>> Why do you need four zero bits at the bottom?  x86_64 Linux only
>> maintains 8 byte stack alignment.
> 
> ISTR that the gcc developers arbitrarily changed the alignment
> a few years ago.
> If the stack is only 8 byte aligned and you allocate a variable that
> requires 16 byte alignment you need gcc to generate the extra stack
> frame to align the stack.
> I don't remember seeing the relevant gcc options on the linux
> gcc command lines.
> 


On older gcc, you *can’t* set the relevant command line options because gcc was daft.  So we just crossed out fingers and hope led for the best.  On newer gcc, we set the options.  Fortunately, 32-byte stack variable alignment works regardless.

AFAIK x86_64 Linux has never aligned the stack to 16 bytes.

  reply	other threads:[~2019-03-20 14:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18  9:41 [RFC PATCH] x86/entry/64: randomize kernel stack offset upon syscall Elena Reshetova
2019-03-18 20:15 ` Andy Lutomirski
2019-03-18 21:07   ` Kees Cook
2019-03-26 10:35     ` Reshetova, Elena
2019-03-27  4:31       ` Andy Lutomirski
2019-03-28 15:45         ` Kees Cook
2019-03-28 16:29           ` Andy Lutomirski
2019-03-28 16:47             ` Kees Cook
2019-03-29  7:50               ` Reshetova, Elena
2019-03-18 23:31   ` Josh Poimboeuf
2019-03-20 12:10     ` Reshetova, Elena
2019-03-20 11:12   ` David Laight
2019-03-20 14:51     ` Andy Lutomirski [this message]
2019-03-20 12:04   ` Reshetova, Elena
2019-03-20  7:27 Elena Reshetova
2019-03-20  7:29 ` Reshetova, Elena
2019-03-29  8:13 Elena Reshetova
2019-04-03 21:17 ` Kees Cook
2019-04-04 11:41   ` Reshetova, Elena
2019-04-04 17:03     ` Kees Cook
2019-04-05 10:14       ` Reshetova, Elena
2019-04-05 13:14         ` Andy Lutomirski

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=25395187-837A-4689-9387-5ACCE78E4DF3@amacapital.net \
    --to=luto@amacapital.net \
    --cc=David.Laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=elena.reshetova@intel.com \
    --cc=enrico.perla@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jannh@google.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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.