diff options
| author | Atish Patra <atishp@meta.com> | 2026-11-18 19:19:17 -0800 |
|---|---|---|
| committer | Borislav Petkov (AMD) <bp@alien8.de> | 2026-11-22 19:39:15 -0800 |
| commit | 86d477c009ed7f3a24b420b7f4aa314fabe36be3 (patch) | |
| tree | e5cb97da294d1d6abe5c6142623414821d8460a4 /tools/lib/python/kdoc | |
| parent | b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f (diff) | |
x86/entry: Make SafeRET robust also against NMIs
On NMI entry, the kernel copies three exception frames which are used in
crazy ways in order to be able to handle nested NMIs.
However, when that handler interrupts a SafeRET sequence of a #VC
exception, it would copy the SafeRET-unfixed rSP and rIP into those
frames.
paranoid_entry() later will fix up the original frame but the IRET frame
which is the one actually used to return from the NMI handler remains
unfixed, leaving the two frames inconsistent.
And because this is a #VC exception which gets to use
__sev_es_ist_enter() to handle NMIs raised in the #VC exception entry
code, that function will use the fixed up stack pointer from pt_regs.
However, in doing so, it will overwrite the return address which the
stale IRET frame still needs, leading up to the NMI returning to the
old, now stale VC stack slot.
Convert the SafeRET frame fixup code to asm and change it so that it
can get a frame passed in and it can correct it before it gets worked on
later.
And because it is an asm macro, it doesn't need the LFENCE speculation
stopper anymore.
Fixes: 7e7f81cf6f5c ("x86/bugs: Make Safe-RET robust against interrupt injection")
Signed-off-by: Atish Patra <atishp@meta.com>
Co-developed-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions
