Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 0c6a7e2

Browse files
pa1guptagregkh
authored andcommitted
x86/entry_32: Do not clobber user EFLAGS.ZF
commit 2e2e514 upstream. Opportunistic SYSEXIT executes VERW to clear CPU buffers after user EFLAGS are restored. This can clobber user EFLAGS.ZF. Move CLEAR_CPU_BUFFERS before the user EFLAGS are restored. This ensures that the user EFLAGS.ZF is not clobbered. Closes: https://lore.kernel.org/lkml/yVXwe8gvgmPADpRB6lXlicS2fcHoV5OHHxyuFbB_MEleRPD7-KhGe5VtORejtPe-KCkT8Uhcg5d7-IBw4Ojb4H7z5LQxoZylSmJ8KNL3A8o=@protonmail.com/ Fixes: a0e2dab ("x86/entry_32: Add VERW just before userspace transition") Reported-by: Jari Ruusu <jariruusu@protonmail.com> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc:stable@vger.kernel.org Link: https://lore.kernel.org/all/20240925-fix-dosemu-vm86-v7-1-1de0daca2d42%40linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c8170b5 commit 0c6a7e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/entry/entry_32.S

+2-1
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ SYM_FUNC_START(entry_SYSENTER_32)
875875

876876
/* Now ready to switch the cr3 */
877877
SWITCH_TO_USER_CR3 scratch_reg=%eax
878+
/* Clobbers ZF */
879+
CLEAR_CPU_BUFFERS
878880

879881
/*
880882
* Restore all flags except IF. (We restore IF separately because
@@ -885,7 +887,6 @@ SYM_FUNC_START(entry_SYSENTER_32)
885887
BUG_IF_WRONG_CR3 no_user_check=1
886888
popfl
887889
popl %eax
888-
CLEAR_CPU_BUFFERS
889890

890891
/*
891892
* Return back to the vDSO, which will pop ecx and edx.

0 commit comments

Comments
 (0)