linux/arch
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
..
alpha RTC for 6.8 2024-01-18 17:25:39 -08:00
arc work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
arm 21 hotfixes. 12 are cc:stable and the remainder pertain to post-6.7 2024-02-10 15:28:07 -08:00
arm64 KVM/arm64 fixes for 6.8, take #3 2024-02-21 05:18:56 -05:00
csky work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
hexagon asm-generic cleanups for 6.8 2024-01-10 18:13:44 -08:00
loongarch work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
m68k kbuild: Replace tabs with spaces when followed by conditionals 2024-01-31 23:24:27 +09:00
microblaze Microblaze patches for 6.8-rc1 2024-01-17 11:27:23 -08:00
mips work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
nios2 percpu: 2024-01-18 15:01:28 -08:00
openrisc OpenRISC updates for 6.6 2023-09-05 10:09:31 -07:00
parisc work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
powerpc work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
riscv KVM/riscv fixes for 6.8, take #1 2024-02-14 12:35:40 -05:00
s390 work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
sh sh updates for v6.8 2024-01-20 09:24:06 -08:00
sparc work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
um work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
x86 KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region() 2024-02-23 03:55:59 -05:00
xtensa work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-01-25 23:52:21 -08:00