Re: [PATCH v4] x86/entry_32: Use stack segment selector for VERW operand

From: Jari Ruusu
Date: Thu Jul 11 2024 - 02:52:46 EST


On Wednesday, July 10th, 2024 at 22:06, Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> wrote:
> Fixes: a0e2dab44d22 ("x86/entry_32: Add VERW just before userspace transition")
> Cc: stable@xxxxxxxxxxxxxxx # 5.10+
> Reported-by: Robert Gill rtgill82@xxxxxxxxx
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218707
> Closes: https://lore.kernel.org/all/8c77ccfd-d561-45a1-8ed5-6b75212c7a58@xxxxxxxxxxxxx/
> Suggested-by: Dave Hansen dave.hansen@xxxxxxxxxxxxxxx
> Suggested-by: Brian Gerst brgerst@xxxxxxxxx # Use %ss
> Signed-off-by: Pawan Gupta pawan.kumar.gupta@xxxxxxxxxxxxxxx
>
> v4:
> - Further simplify the patch by using %ss for all VERW calls in 32-bit mode (Brian).
> - In NMI exit path move VERW after RESTORE_ALL_NMI that touches GPRs (Dave).
>
> v3: https://lore.kernel.org/r/20240701-fix-dosemu-vm86-v3-1-b1969532c75a@xxxxxxxxxxxxxxx
> - Simplify CLEAR_CPU_BUFFERS_SAFE by using %ss instead of %ds (Brian).
> - Do verw before popf in SYSEXIT path (Jari).
>
> v2: https://lore.kernel.org/r/20240627-fix-dosemu-vm86-v2-1-d5579f698e77@xxxxxxxxxxxxxxx
> - Safe guard against any other system calls like vm86() that might change %ds (Dave).
>
> v1: https://lore.kernel.org/r/20240426-fix-dosemu-vm86-v1-1-88c826a3f378@xxxxxxxxxxxxxxx

Pawan,
Your patch looks OK to me.

Greg,
I have verified that patch hunks go correct places on
kernel.org linux-5.10.221, linux-6.1.97 and linux-6.6.38
kernels. All tests run inside 32-bit VM. The patch fixes
show-stopper issues with virtual-8086 mode and dosemu. Once
the patch is accepted upstream, it should go to all 5.10+
stable kernels.

--
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189