Skip to contentSkip to conversation

CVE-2025-39910: mm/vmalloc, mm/kasan: respect gfp mask in kasan_populate_vmalloc()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 1, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

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

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

mm/vmalloc, mm/kasan: respect gfp mask in kasan_populate_vmalloc()

kasan_populate_vmalloc() and its helpers ignore the caller's gfp_mask and always allocate memory using the hardcoded GFP_KERNEL flag. This makes them inconsistent with vmalloc(), which was recently extended to support GFP_NOFS and GFP_NOIO allocations.

Page table allocations performed during shadow population also ignore the external gfp_mask. To preserve the intended semantics of GFP_NOFS and GFP_NOIO, wrap the apply_to_page_range() calls into the appropriate memalloc scope.

xfs calls vmalloc with GFP_NOFS, so this bug could lead to deadlock.

There was a report here
https://lkml.kernel.org/r/[email protected]

This patch:
- Extends kasan_populate_vmalloc() and helpers to take gfp_mask;
- Passes gfp_mask down to alloc_pages_bulk() and __get_free_page();
- Enforces GFP_NOFS/NOIO semantics with memalloc_*_save()/restore() around apply_to_page_range();
- Updates vmalloc.c and percpu allocator call sites accordingly.

The Linux kernel CVE team has assigned CVE-2025-39910 to this issue.

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

	Issue introduced in 5.17 with commit 451769ebb7e792c3404db53b3c2a422990de654e and fixed in 6.16.8 with commit 33b95d90427cb4babf32059e323a6d0c027610fe
	Issue introduced in 5.17 with commit 451769ebb7e792c3404db53b3c2a422990de654e and fixed in 6.17 with commit 79357cd06d41d0f5a11b17d7c86176e395d10ef2

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-2025-39910

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:
include/linux/kasan.h
mm/kasan/shadow.c
mm/vmalloc.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/33b95d90427cb4babf32059e323a6d0c027610fe
	https://git.kernel.org/stable/c/79357cd06d41d0f5a11b17d7c86176e395d10ef2