Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2507a4

Browse files
pa1guptagregkh
authored andcommitted
x86/entry_32: Clear CPU buffers after register restore in NMI return
commit 48a2440 upstream. CPU buffers are currently cleared after call to exc_nmi, but before register state is restored. This may be okay for MDS mitigation but not for RDFS. Because RDFS mitigation requires CPU buffers to be cleared when registers don't have any sensitive data. Move CLEAR_CPU_BUFFERS after RESTORE_ALL_NMI. Fixes: a0e2dab ("x86/entry_32: Add VERW just before userspace transition") Suggested-by: Dave Hansen <[email protected]> Signed-off-by: Pawan Gupta <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Cc:[email protected] Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-2-1de0daca2d42%40linux.intel.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 94af6b5 commit d2507a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/entry/entry_32.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ SYM_CODE_START(asm_exc_nmi)
11491149

11501150
/* Not on SYSENTER stack. */
11511151
call exc_nmi
1152-
CLEAR_CPU_BUFFERS
11531152
jmp .Lnmi_return
11541153

11551154
.Lnmi_from_sysenter_stack:
@@ -1170,6 +1169,7 @@ SYM_CODE_START(asm_exc_nmi)
11701169

11711170
CHECK_AND_APPLY_ESPFIX
11721171
RESTORE_ALL_NMI cr3_reg=%edi pop=4
1172+
CLEAR_CPU_BUFFERS
11731173
jmp .Lirq_return
11741174

11751175
#ifdef CONFIG_X86_ESPFIX32
@@ -1211,6 +1211,7 @@ SYM_CODE_START(asm_exc_nmi)
12111211
* 1 - orig_ax
12121212
*/
12131213
lss (1+5+6)*4(%esp), %esp # back to espfix stack
1214+
CLEAR_CPU_BUFFERS
12141215
jmp .Lirq_return
12151216
#endif
12161217
SYM_CODE_END(asm_exc_nmi)

0 commit comments

Comments
 (0)