Skip to contentSkip to conversation

CVE-2024-35939: dma-direct: Leak pages on dma_set_decrypted() failure

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 19, 2024

lore
Share & tools
lore
#0 lore raw

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

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

dma-direct: Leak pages on dma_set_decrypted() failure

On TDX it is possible for the untrusted host to cause set_memory_encrypted() or set_memory_decrypted() to fail such that an error is returned and the resulting memory is shared. Callers need to take care to handle these errors to avoid returning decrypted (shared) memory to the page allocator, which could lead to functional or security issues.

DMA could free decrypted/shared pages if dma_set_decrypted() fails. This should be a rare case. Just leak the pages in this case instead of freeing them.

The Linux kernel CVE team has assigned CVE-2024-35939 to this issue.

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

	Fixed in 6.1.86 with commit 4e0cfb25d49d
	Fixed in 6.6.27 with commit 4031b72ca747
	Fixed in 6.8.6 with commit b57326c96b7b
	Fixed in 6.9 with commit b9fa16949d18

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-2024-35939

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:
kernel/dma/direct.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/4e0cfb25d49da2e6261ad582f58ffa5b5dd8c8e9
	https://git.kernel.org/stable/c/4031b72ca747a1e6e9ae4fa729e765b43363d66a
	https://git.kernel.org/stable/c/b57326c96b7bc7638aa8c44e12afa2defe0c934c
	https://git.kernel.org/stable/c/b9fa16949d18e06bdf728a560f5c8af56d2bdcaf