linux-stable/arch/x86/kvm/svm
Ashish Kalra bbdcc644b5 KVM: SVM: Use kzalloc for sev ioctl interfaces to prevent kernel data leak
commit d22d2474e3 upstream.

For some sev ioctl interfaces, the length parameter that is passed maybe
less than or equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data
that PSP firmware returns. In this case, kmalloc will allocate memory
that is the size of the input rather than the size of the data.
Since PSP firmware doesn't fully overwrite the allocated buffer, these
sev ioctl interface may return uninitialized kernel slab memory.

Reported-by: Andy Nguyen <theflow@google.com>
Suggested-by: David Rientjes <rientjes@google.com>
Suggested-by: Peter Gonda <pgonda@google.com>
Cc: kvm@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Fixes: eaf78265a4 ("KVM: SVM: Move SEV code to separate file")
Fixes: 2c07ded064 ("KVM: SVM: add support for SEV attestation command")
Fixes: 4cfdd47d6d ("KVM: SVM: Add KVM_SEV SEND_START command")
Fixes: d3d1af85e2 ("KVM: SVM: Add KVM_SEND_UPDATE_DATA command")
Fixes: eba04b20e4 ("KVM: x86: Account a variety of miscellaneous allocations")
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Reviewed-by: Peter Gonda <pgonda@google.com>
Message-Id: <20220516154310.3685678-1-Ashish.Kalra@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06 08:47:53 +02:00
..
avic.c KVM: SVM: fix panic on out-of-bounds guest IRQ 2022-04-08 13:58:52 +02:00
nested.c KVM: x86: Drop WARNs that assert a triple fault never "escapes" from L2 2022-06-06 08:47:53 +02:00
pmu.c KVM: x86/svm: Account for family 17h event renumberings in amd_pmc_perf_hw_id 2022-05-12 12:32:17 +02:00
sev.c KVM: SVM: Use kzalloc for sev ioctl interfaces to prevent kernel data leak 2022-06-06 08:47:53 +02:00
svm.c KVM: x86: nSVM: disallow userspace setting of MSR_AMD64_TSC_RATIO to non default value when tsc scaling disabled 2022-02-24 13:04:47 -05:00
svm.h KVM: SVM: Fix kvm_cache_regs.h inclusions for is_guest_mode() 2022-04-13 19:27:07 +02:00
svm_onhyperv.c KVM: SVM: Fix kvm_cache_regs.h inclusions for is_guest_mode() 2022-04-13 19:27:07 +02:00
svm_onhyperv.h KVM: SVM: drop unnecessary code in svm_hv_vmcb_dirty_nested_enlightenments() 2022-01-26 12:15:03 -05:00
svm_ops.h x86/kvm: Always inline vmload() / vmsave() 2021-09-15 15:51:45 +02:00
vmenter.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00