All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org, X86 ML <x86@kernel.org>,
	hpa@zytor.com, stable@vger.kernel.org
Subject: Re: [RFC] x86, ia32entry: Use sysretl to return from sysenter
Date: Sat, 28 Mar 2015 09:35:33 +0100	[thread overview]
Message-ID: <20150328083533.GA1183@gmail.com> (raw)
In-Reply-To: <9414b4dfad7ad90b0315323be32d977867719bd4.1427493165.git.luto@kernel.org>


* Andy Lutomirski <luto@kernel.org> wrote:

> Sysexit is scary on 64-bit kernels -- sysexit must be invoked with
> usergs and IRQs on.  That means that we rely on sti to correctly
> mask interrupts for one instruction.  This is okay by itself, but
> the semantics with respect to NMIs are unclear.

At least judging by profiling output I think NMIs observe the STI 
window of one instruction non-execution as well. (But I'm not 100% 
sure.)

> Avoid the whole issue by using sysretl instead.  For background,
> Intel CPUs don't allow syscall from compat mode, but they do allow
> sysret back to compat mode.  Go figure.
> 
> Oddly this seems to be 30 cycles or so faster.  Avoiding popfq and
> sti will account for under half of that, I think, so my best guess
> is that Intel just optimizes sysret much better than sysexit.
> 
> Cc: stable@vger.kernel.org

I like it, but no way is this automatic -stable material ... if proven 
upstream we can forward it as a fix for SYSEXIT fragility, but not 
automatically, IMHO.

Thanks,

	Ingo

  reply	other threads:[~2015-03-28  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 21:54 [RFC] x86, ia32entry: Use sysretl to return from sysenter Andy Lutomirski
2015-03-28  8:35 ` Ingo Molnar [this message]
2015-03-28 15:17   ` Andy Lutomirski
2015-03-29 12:58     ` Borislav Petkov
2015-03-29 19:07 ` Denys Vlasenko
2015-03-29 21:16   ` Andy Lutomirski
2015-03-30  9:04     ` Borislav Petkov

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=20150328083533.GA1183@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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.