All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@linux.intel.com>
To: Jiri Kosina <jkosina@suse.cz>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Salman Qazi <sqazi@google.com>, Ingo Molnar <mingo@elte.hu>,
	Michal Hocko <mhocko@suse.cz>, Borislav Petkov <bp@alien8.de>,
	Vojtech Pavlik <vojtech@suse.cz>, Petr Tesarik <ptesarik@suse.cz>,
	Petr Mladek <pmladek@suse.cz>
Subject: Re: 64bit x86: NMI nesting still buggy?
Date: Tue, 29 Apr 2014 06:29:04 -0700	[thread overview]
Message-ID: <535FA920.9080503@linux.intel.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1404291150200.8903@pobox.suse.cz>

On 04/29/2014 06:05 AM, Jiri Kosina wrote:
> 
> We were not able to come up with any other fix than avoiding using IST 
> completely on x86_64, and instead going back to stack switching in 
> software -- the same way 32bit x86 does.
> 

This is not possible, though, because there are several windows during
which if we were to take an exception which doesn't do IST, e.g. NMI, we
are worse than dead -- we are in fact rootable.  Right after SYSCALL in
particular.

> So basically, I have two questions:
> 
> (1) is the above analysis correct? (if not, why?)
> (2) if it is correct, is there any other option for fix than avoiding 
>     using IST for exception stack switching, and having kernel do the 
>     legacy task switching (the same way x86_32 is doing)?

It is not an option, see above.

> [1] http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-manual-325462.pdf
> 
> [2] 	"A special case can occur if an SMI handler nests inside an NMI 
> 	 handler and then another NMI occurs. During NMI interrupt 
> 	 handling, NMI interrupts are disabled, so normally NMI interrupts 
>  	 are serviced and completed with an IRET instruction one at a 
> 	 time. When the processor enters SMM while executing an NMI 
> 	 handler, the processor saves the SMRAM state save map but does 
> 	 not save the attribute to keep NMI interrupts disabled. 
> 	 Potentially, an NMI could be latched (while in SMM or upon exit) 
> 	 and serviced upon exit of SMM even though the previous NMI  
> 	 handler has still not completed."

I believe [2] only applies if there is an IRET executing inside the SMM
handler, which should not normally be the case.  It might also have been
addressed since that was written, but I don't know.

	-hpa




  reply	other threads:[~2014-04-29 13:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 13:05 64bit x86: NMI nesting still buggy? Jiri Kosina
2014-04-29 13:29 ` H. Peter Anvin [this message]
2014-04-29 14:06   ` Steven Rostedt
2014-04-29 14:28     ` H. Peter Anvin
2014-04-29 14:31   ` Petr Tesarik
2014-04-30 22:10   ` Jiri Kosina
2014-04-30 22:46     ` H. Peter Anvin
2014-04-29 14:03 ` Steven Rostedt
2014-04-29 15:24   ` Jiri Kosina
2014-04-29 15:41     ` Vojtech Pavlik
2014-04-29 16:09     ` Steven Rostedt
2014-04-29 16:19       ` Steven Rostedt
2014-04-29 16:51       ` Jiri Kosina
2014-04-29 17:12         ` Steven Rostedt
2014-04-29 18:48           ` Jiri Kosina
2014-04-29 19:16             ` Steven Rostedt
2014-05-06 10:02     ` Ingo Molnar
2014-05-21 13:42   ` Jiri Kosina
2014-05-21 14:20     ` Borislav Petkov
2014-05-21 14:58       ` Vojtech Pavlik
2014-05-21 15:22         ` 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=535FA920.9080503@linux.intel.com \
    --to=hpa@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@elte.hu \
    --cc=pmladek@suse.cz \
    --cc=ptesarik@suse.cz \
    --cc=rostedt@goodmis.org \
    --cc=sqazi@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vojtech@suse.cz \
    --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.