linux-stable/arch/x86/xen
Jan Beulich 0594c58161 xen/x86: fix PV trap handling on secondary processors
The initial observation was that in PV mode under Xen 32-bit user space
didn't work anymore. Attempts of system calls ended in #GP(0x402). All
of the sudden the vector 0x80 handler was not in place anymore. As it
turns out up to 5.13 redundant initialization did occur: Once from
cpu_initialize_context() (through its VCPUOP_initialise hypercall) and a
2nd time while each CPU was brought fully up. This 2nd initialization is
now gone, uncovering that the 1st one was flawed: Unlike for the
set_trap_table hypercall, a full virtual IDT needs to be specified here;
the "vector" fields of the individual entries are of no interest. With
many (kernel) IDT entries still(?) (i.e. at that point at least) empty,
the syscall vector 0x80 ended up in slot 0x20 of the virtual IDT, thus
becoming the domain's handler for vector 0x20.

Make xen_convert_trap_info() fit for either purpose, leveraging the fact
that on the xen_copy_trap_info() path the table starts out zero-filled.
This includes moving out the writing of the sentinel, which would also
have lead to a buffer overrun in the xen_copy_trap_info() case if all
(kernel) IDT entries were populated. Convert the writing of the sentinel
to clearing of the entire table entry rather than just the address
field.

(I didn't bother trying to identify the commit which uncovered the issue
in 5.14; the commit named below is the one which actually introduced the
bad code.)

Fixes: f87e4cac4f ("xen: SMP guest support")
Cc: stable@vger.kernel.org
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/7a266932-092e-b68f-f2bb-1473b61adc6e@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
2021-09-21 09:40:30 +02:00
..
apic.c x86/apic: Cleanup destination mode 2020-10-28 20:26:25 +01:00
debugfs.c
debugfs.h
efi.c efi: x86/xen: switch to efi_get_secureboot_mode helper 2020-11-17 15:09:32 +01:00
enlighten.c kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
enlighten_hvm.c x86/xen: Don't register Xen IPIs when they aren't going to be used 2021-01-13 16:12:07 +01:00
enlighten_pv.c xen/x86: fix PV trap handling on secondary processors 2021-09-21 09:40:30 +02:00
enlighten_pvh.c
grant-table.c
irq.c x86/pv: Rework arch_local_irq_restore() to not use popf 2021-02-10 12:36:45 +01:00
Kconfig xen: Kconfig: remove X86_64 depends from XEN_512GB 2020-12-19 07:27:37 +01:00
Makefile x86/xen: Support objtool validation in xen-asm.S 2021-01-26 11:33:01 -06:00
mmu.c
mmu.h
mmu_hvm.c
mmu_pv.c xen: fix usage of pmd_populate in mremap for pv guests 2021-09-15 08:42:04 +02:00
multicalls.c
multicalls.h
p2m.c xen: fix setting of max_pfn in shared_info 2021-08-30 11:55:36 +02:00
pci-swiotlb-xen.c xen/pci-swiotlb: reduce visibility of symbols 2021-09-20 17:01:19 +02:00
platform-pci-unplug.c x86: xen: platform-pci-unplug: use pr_err() and pr_warn() instead of raw printk() 2021-08-30 12:09:54 +02:00
pmu.c
pmu.h
setup.c Revert "xen: fix p2m size in dom0 for disabled memory hotplug case" 2021-03-24 18:33:36 -05:00
smp.c
smp.h
smp_hvm.c x86/xen: fix 'nopvspin' build error 2021-01-18 07:22:20 +01:00
smp_pv.c xen/x86: drop redundant zeroing from cpu_initialize_context() 2021-09-20 16:55:54 +02:00
spinlock.c x86/xen: don't unbind uninitialized lock_kicker_irq 2020-11-09 07:43:45 -06:00
suspend.c
suspend_hvm.c
suspend_pv.c
time.c x86/paravirt: Switch time pvops functions to use static_call() 2021-03-11 16:17:52 +01:00
trace.c
vga.c
xen-asm.S objtool updates: 2021-02-23 09:56:13 -08:00
xen-head.S x86/xen: Support objtool vmlinux.o validation in xen-head.S 2021-01-26 11:33:02 -06:00
xen-ops.h x86/pv: Rework arch_local_irq_restore() to not use popf 2021-02-10 12:36:45 +01:00