Skip to content

RFC x86/entry/nmi: solidify userspace NMI entry

Lai Jiangshan lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86/entry/nmi: Switch to the entry stack before switching to the thread stackarch/x86/entry/entry_64.S arch/x86/kernel/asm-offsets.c+23 -010 replies
2/4x86/entry/nmi: Use normal idtentry macro for NMI from userspacearch/x86/entry/entry_64.S+6 -361 reply
3/4x86/entry: Remove parameter rdx from macro PUSH_AND_CLEAR_REGS and PUSH_REGSarch/x86/entry/calling.h+4 -40 replies
4/4x86/entry/nmi: unmask NMIs on userspace NMI when entry debuggingarch/x86/entry/entry_64.S+20 -161 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] x86/entry/nmi: solidify userspace NMI entry

From: Lai Jiangshan <[email protected]>

Current kernel has no code to enforce data breakpoint not on the thread stack. If there is any data breakpoint on the top area of the thread stack, there might be problem.

For example, when NMI hits on userspace in this setting, the code copies the exception frame from the NMI stack to the thread stack and it will cause #DB and after #DB is handled, the not yet copied portion on the NMI stack is in danger of corruption because the NMI is unmasked.

The similar problem happens when #DB hits on userspace with data breakpoint on the thread stack. We will also fix it for #DB when we agree on the problem on NMI and the way to fix it.

The way to fix for NMI is to switch to the entry stack before switching to the thread stack. It also paves the path to use idtentry_body macro for NMI since the huge refactor on entry code made idtentry macros really low level.

Lai Jiangshan (4):
x86/entry/nmi: Switch to the entry stack before switching to the
thread stack
x86/entry/nmi: Use normal idtentry macro for NMI from userspace x86/entry: Remove parameter rdx from macro PUSH_AND_CLEAR_REGS and
PUSH_REGS
x86/entry/nmi: unmask NMIs on userspace NMI when entry debugging

Cc Steven Rostedt (VMware) <[email protected]>
Cc Andy Lutomirski <[email protected]>,
Cc Thomas Gleixner <[email protected]>,
Cc Ingo Molnar <[email protected]>,
Cc Borislav Petkov <[email protected]>,
Cc "H. Peter Anvin" <[email protected]>
 arch/x86/entry/calling.h      |  8 ++--
 arch/x86/entry/entry_64.S     | 82 +++++++++++++++++------------------
 arch/x86/kernel/asm-offsets.c |  1 +
 3 files changed, 44 insertions(+), 47 deletions(-)
Signature · 1 line
2.19.1.6.gb485710b