Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "KVM: x86: work around leak of uninitialized stack contents"

handle_vmptrst()/handle_vmread() stopped injecting #PF unconditionally
and switched to nested_vmx_handle_memory_failure() which just kills the
guest with KVM_EXIT_INTERNAL_ERROR in case of MMIO access, zeroing
'exception' in kvm_write_guest_virt_system() is not needed anymore.

This reverts commit 541ab2aeb28251bf7135c7961f3a6080eebcc705.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200605115906.532682-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Vitaly Kuznetsov and committed by
Paolo Bonzini
25597f64 7a35e515

-7
-7
arch/x86/kvm/x86.c
··· 5647 5647 /* kvm_write_guest_virt_system can pull in tons of pages. */ 5648 5648 vcpu->arch.l1tf_flush_l1d = true; 5649 5649 5650 - /* 5651 - * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED 5652 - * is returned, but our callers are not ready for that and they blindly 5653 - * call kvm_inject_page_fault. Ensure that they at least do not leak 5654 - * uninitialized kernel stack memory into cr2 and error code. 5655 - */ 5656 - memset(exception, 0, sizeof(*exception)); 5657 5650 return kvm_write_guest_virt_helper(addr, val, bytes, vcpu, 5658 5651 PFERR_WRITE_MASK, exception); 5659 5652 }