Skip to contentSkip to conversation

CVE-2022-49556: KVM: SVM: Use kzalloc for sev ioctl interfaces to prevent kernel data leak

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 26, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

KVM: SVM: Use kzalloc for sev ioctl interfaces to prevent kernel data leak

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.

The Linux kernel CVE team has assigned CVE-2022-49556 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.7 with commit eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 and fixed in 5.10.124 with commit 401bef1f95de92c3a8c6eece46e02fa88d7285ee
	Issue introduced in 5.7 with commit eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 and fixed in 5.15.45 with commit d8fdb4b24097472ff6b3c0559448200d420b1418
	Issue introduced in 5.7 with commit eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 and fixed in 5.17.13 with commit bbdcc644b59e01e98c68894a9fab42b9687f42b0
	Issue introduced in 5.7 with commit eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 and fixed in 5.18.2 with commit 57a01725339f9d82b099102ba2751621b1caab93
	Issue introduced in 5.7 with commit eaf78265a4ab33935d3a0f1407ce4a91aac4d4d5 and fixed in 5.19 with commit d22d2474e3953996f03528b84b7f52cc26a39403

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-49556

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:

	arch/x86/kvm/svm/sev.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/401bef1f95de92c3a8c6eece46e02fa88d7285ee
	https://git.kernel.org/stable/c/d8fdb4b24097472ff6b3c0559448200d420b1418
	https://git.kernel.org/stable/c/bbdcc644b59e01e98c68894a9fab42b9687f42b0
	https://git.kernel.org/stable/c/57a01725339f9d82b099102ba2751621b1caab93
	https://git.kernel.org/stable/c/d22d2474e3953996f03528b84b7f52cc26a39403