mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f3f0e1d2150b2b99da2cbdfaad000089efe9bf30 · < 1a3f8c6cd29d9078cc81b29d39d0e9ae1d6a03c3| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths
Any codepath that zaps page table entries must invoke MMU notifiers to ensure that secondary MMUs (like KVM) don't keep accessing pages which aren't mapped anymore. Secondary MMUs don't hold their own references to pages that are mirrored over, so failing to notify them can lead to page use-after-free.
I'm marking this as addressing an issue introduced in commit f3f0e1d2150b ("khugepaged: add support of collapse for tmpfs/shmem pages"), but most of the security impact of this only came in commit 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP"), which actually omitted flushes for the removal of present PTEs, not just for the removal of empty page tables.
From the CVE record · Linux
The Linux kernel's shmem/file collapse paths can remove page-table entries without notifying secondary MMUs such as KVM. When a secondary MMU continues accessing a page that is no longer mapped, a page use-after-free can result. The input does not specify an attacker's access requirements or whether user interaction is needed.
Engineers running Linux kernels with the affected mm/khugepaged shmem/file collapse code should check their versions; no affected version range is provided.