linux/arch
Josh Poimboeuf 2687c848e5 x86/vmware: Fix hypercall clobbers
Fedora QA reported the following panic:

  BUG: unable to handle page fault for address: 0000000040003e54
  #PF: supervisor write access in kernel mode
  #PF: error_code(0x0002) - not-present page
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20251119-3.fc43 11/19/2025
  RIP: 0010:vmware_hypercall4.constprop.0+0x52/0x90
  ..
  Call Trace:
   vmmouse_report_events+0x13e/0x1b0
   psmouse_handle_byte+0x15/0x60
   ps2_interrupt+0x8a/0xd0
   ...

because the QEMU VMware mouse emulation is buggy, and clears the top 32
bits of %rdi that the kernel kept a pointer in.

The QEMU vmmouse driver saves and restores the register state in a
"uint32_t data[6];" and as a result restores the state with the high
bits all cleared.

RDI originally contained the value of a valid kernel stack address
(0xff5eeb3240003e54).  After the vmware hypercall it now contains
0x40003e54, and we get a page fault as a result when it is dereferenced.

The proper fix would be in QEMU, but this works around the issue in the
kernel to keep old setups working, when old kernels had not happened to
keep any state in %rdi over the hypercall.

In theory this same issue exists for all the hypercalls in the vmmouse
driver; in practice it has only been seen with vmware_hypercall3() and
vmware_hypercall4().  For now, just mark RDI/RSI as clobbered for those
two calls.  This should have a minimal effect on code generation overall
as it should be rare for the compiler to want to make RDI/RSI live
across hypercalls.

Reported-by: Justin Forbes <jforbes@fedoraproject.org>
Link: https://lore.kernel.org/all/99a9c69a-fc1a-43b7-8d1e-c42d6493b41f@broadcom.com/
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-06 14:51:03 -08:00
..
alpha alpha updates for v6.19 2025-12-11 08:01:52 +09:00
arc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
arm ARM fixes for 6.19 / 7.0 2026-02-06 09:21:38 -08:00
arm64 Pin control fixes for the v6.19 series: 2026-01-28 08:03:11 -08:00
csky csky 6.19 Release Notes 2025-12-10 12:17:29 +09:00
hexagon This update includes the following changes: 2025-12-03 11:28:38 -08:00
loongarch LoongArch: KVM: Fix kvm_device leak in kvm_pch_pic_destroy() 2026-01-17 10:57:03 +08:00
m68k Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
microblaze arch: hookup listns() system call 2025-11-03 17:41:18 +01:00
mips mips: fix HIGHMEM initialization 2026-01-14 22:16:22 -08:00
nios2 arch/nios2: replace "__auto_type" and adjacent equivalent with "auto" 2025-12-08 15:32:15 -08:00
openrisc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
parisc TTY/Serial changes for 6.19-rc1 2025-12-06 18:38:19 -08:00
powerpc mm/zone_device: reinitialize large zone device private folios 2026-01-26 19:03:48 -08:00
riscv riscv: compat: fix COMPAT_UTS_MACHINE definition 2026-01-29 00:59:17 -07:00
s390 s390/boot/vmlinux.lds.S: Ensure bzImage ends with SecureBoot trailer 2026-01-22 15:15:50 +01:00
sh treewide: Update email address 2026-01-11 06:09:11 -10:00
sparc treewide: Update email address 2026-01-11 06:09:11 -10:00
um Address various objtool scalability bugs/inefficiencies exposed by 2025-12-06 11:56:51 -08:00
x86 x86/vmware: Fix hypercall clobbers 2026-02-06 14:51:03 -08:00
xtensa TTY/Serial changes for 6.19-rc1 2025-12-06 18:38:19 -08:00
.gitignore
Kconfig treewide: drop outdated compiler version remarks in Kconfig help texts 2025-11-12 10:00:14 -08:00