kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
From: "Reshetova, Elena" <elena.reshetova@intel.com>
To: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	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>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg KH <gregkh@linuxfoundation.org>
Subject: RE: [RFC PATCH] x86/entry/64: randomize kernel stack offset upon syscall
Date: Fri, 5 Apr 2019 10:14:45 +0000	[thread overview]
Message-ID: <2236FBA76BA1254E88B949DDB74E612BA4C40185@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <CAGXu5j+05tZUOuka2YQy+5WPvVwHBrM-YEeto1iLzz2shCnANQ@mail.gmail.com>

> On Thu, Apr 4, 2019 at 4:41 AM Reshetova, Elena
> <elena.reshetova@intel.com> wrote:
> > What I still don't fully understand here (due to my little knowledge of
> > compilers) and afraid of is that the asm code that alloca generates (see my version)
> > and the alignment might differ on the different targets, etc.
> 
> I guess it's possible, but for x86_64, since appears to be consistent.

So, yes, I double checked this now with just printing all possible offsets I get for rsp
from do_syscall_64, it is indeed 33 different offsets, so it is indeed more like 5 bits of entropy. 
We can increase it, if we want and people are ok with losing a bit more stack space. 
 
> 
> > If you tried it on yours, can you send me the asm code that it produced for you?
> > Is it different from mine?
> 
> You can compare compiler outputs here. Here's gcc vs clang for this code:
> https://godbolt.org/z/WJSbN8
> You can adjust compiler versions, etc.

Oh, this is handy! Thank you for the link! 


So, should I resend to lkml (with some cosmetic fixes) or how to proceed with this?
I will also update the randomness bit info. 

Best Regards,
Elena.

  reply	other threads:[~2019-04-05 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29  8:13 [RFC PATCH] x86/entry/64: randomize kernel stack offset upon syscall 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 [this message]
2019-04-05 13:14         ` Andy Lutomirski
  -- strict thread matches above, loose matches on Subject: below --
2019-03-20  7:27 Elena Reshetova
2019-03-20  7:29 ` Reshetova, Elena

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=2236FBA76BA1254E88B949DDB74E612BA4C40185@IRSMSX102.ger.corp.intel.com \
    --to=elena.reshetova@intel.com \
    --cc=bp@alien8.de \
    --cc=enrico.perla@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jannh@google.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=luto@amacapital.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).