Blob Blame History Raw
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date: Tue, 13 Feb 2024 18:22:08 -0800
Subject: x86/entry_32: Add VERW just before userspace transition
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Git-commit: a0e2dab44d22b913b4c228c8b52b2a104434b0b3
Patch-mainline: Queued in subsystem maintainer repo
References: git-fixes

As done for entry_64, add support for executing VERW late in exit to
user path for 32-bit mode.

Cc:  <stable@kernel.org>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Acked-by: Nikolay Borisov <nik.borisov@suse.com>
---
 arch/x86/entry/entry_32.S |    3 +++
 1 file changed, 3 insertions(+)

--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -278,6 +278,7 @@ ENTRY(schedule_tail_wrapper)
 	pushl	%eax
 	call	schedule_tail
 	popl	%eax
+	CLEAR_CPU_BUFFERS

 	FRAME_END
 	RET
@@ -565,6 +566,7 @@ restore_all:
 #endif
 .Lrestore_nocheck:
 	RESTORE_REGS 4				# skip orig_eax/error_code
+	CLEAR_CPU_BUFFERS
 .Lirq_return:
 	INTERRUPT_RETURN

@@ -1020,6 +1022,7 @@ ENTRY(nmi)

 	/* Not on SYSENTER stack. */
 	call	do_nmi
+	CLEAR_CPU_BUFFERS
 	jmp	.Lrestore_all_notrace

 .Lnmi_from_sysenter_stack: