linux/arch/x86
Sean Christopherson 5ef1d8c1dd KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region()
Do the cache flush of converted pages in svm_register_enc_region() before
dropping kvm->lock to fix use-after-free issues where region and/or its
array of pages could be freed by a different task, e.g. if userspace has
__unregister_enc_region_locked() already queued up for the region.

Note, the "obvious" alternative of using local variables doesn't fully
resolve the bug, as region->pages is also dynamically allocated.  I.e. the
region structure itself would be fine, but region->pages could be freed.

Flushing multiple pages under kvm->lock is unfortunate, but the entire
flow is a rare slow path, and the manual flush is only needed on CPUs that
lack coherency for encrypted memory.

Fixes: 19a23da539 ("Fix unsynchronized access to sev members through svm_register_enc_region")
Reported-by: Gabe Kirkpatrick <gkirkpatrick@google.com>
Cc: Josh Eads <josheads@google.com>
Cc: Peter Gonda <pgonda@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20240217013430.2079561-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-02-23 03:55:59 -05:00
..
boot x86/efistub: Use 1:1 file:memory mapping for PE/COFF .compat section 2024-02-05 10:24:51 +00:00
coco - Add support managing TDX host hardware 2024-01-18 13:41:48 -08:00
configs hardening updates for v6.7-rc1 2023-10-30 19:09:55 -10:00
crypto This update includes the following changes: 2024-01-10 12:23:43 -08:00
entry asm-generic cleanups for 6.8 2024-01-10 18:13:44 -08:00
events Performance events changes for v6.8 are: 2024-01-08 19:37:20 -08:00
hyperv x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
ia32
include work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
kernel - Correct the minimum CPU family for Transmeta Crusoe in Kconfig so that 2024-02-11 11:41:51 -08:00
kvm KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region() 2024-02-23 03:55:59 -05:00
lib x86/lib: Revert to _ASM_EXTABLE_UA() for {get,put}_user() fixups 2024-01-29 11:40:41 +01:00
math-emu x86/fpu: Include asm/fpu/regset.h 2023-05-18 11:56:18 -07:00
mm Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
net Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
pci pci-v6.8-changes 2024-01-17 16:23:17 -08:00
platform x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
power x86/topology: Remove CPU0 hotplug option 2023-05-15 13:44:49 +02:00
purgatory x86/purgatory: Remove LTO flags 2023-09-17 09:49:03 +02:00
ras
realmode x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
tools x86/build changes for v6.8: 2024-01-08 17:22:02 -08:00
um This pull request contains the following changes for UML: 2024-01-17 10:44:34 -08:00
video fbdev: Replace fb_pgprotect() with pgprot_framebuffer() 2023-10-12 09:20:46 +02:00
virt x86/mce: Differentiate real hardware #MCs from TDX erratum ones 2023-12-12 08:46:46 -08:00
xen x86/cleanups changes for v6.8: 2024-01-08 17:23:32 -08:00
.gitignore
Kbuild
Kconfig IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
Kconfig.assembler x86/shstk: Add Kconfig option for shadow stack 2023-07-11 14:12:18 -07:00
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-09 16:28:19 +01:00
Kconfig.debug docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
Makefile kbuild: Replace tabs with spaces when followed by conditionals 2024-01-31 23:24:27 +09:00
Makefile_32.cpu
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-04-04 09:57:05 +02:00