CVE-2025-38207: mm: fix uprobe pte be overwritten when expanding vma
In the Linux kernel, the following vulnerability has been resolved:
mm: fix uprobe pte be overwritten when expanding vma
Patch series "Fix uprobe pte be overwritten when expanding vma".
This patch (of 4):
We encountered a BUG alert triggered by Syzkaller as follows: BUG: Bad rss-counter state mm:00000000b4a60fca type:MMANONPAGES val:1
And we can reproduce it with the following steps: 1. register uprobe on file at zero offset 2. mmap the file at zero offset: addr1 = mmap(NULL, 2 4096, PROTNONE, MAPPRIVATE, fd, 0); 3. mremap part of vma1 to new vma2: addr2 = mremap(addr1, 4096, 2 4096, MREMAPMAYMOVE); 4. mremap back to orig addr1: mremap(addr2, 4096, 4096, MREMAPMAYMOVE | MREMAPFIXED, addr1);
In step 3, the vma1 range [addr1, addr1 + 4096] will be remap to new vma2 with range [addr2, addr2 + 8192], and remap uprobe anon page from the vma1 to vma2, then unmap the vma1 range [addr1, addr1 + 4096].
In step 4, the vma2 range [addr2, addr2 + 4096] will be remap back to the addr range [addr1, addr1 + 4096]. Since the addr range [addr1 + 4096, addr1 + 8192] still maps the file, it will take vmamergenewrange to expand the range, and then do uprobemmap in vmacomplete. Since the merged vma pgoff is also zero offset, it will install uprobe anon page to the merged vma. However, the upcomming movepagetables step, which use setpteat to remap the vma2 uprobe pte to the merged vma, will overwrite the newly uprobe pte in the merged vma, and lead that pte to be orphan.
Since the uprobe pte will be remapped to the merged vma, we can remove the unnecessary uprobemmap upon merged vma.
This problem was first found in linux-6.6.y and also exists in the community syzkaller: https://lore.kernel.org/all/000000000000ada39605a5e71711@google.com/T/
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-38207?
CVE-2025-38207 has a moderate severity level as it pertains to a potential memory corruption issue in the Linux kernel.
How do I fix CVE-2025-38207?
To fix CVE-2025-38207, you should apply the latest patches provided by the Linux kernel maintainers.
Which version of the Linux kernel is affected by CVE-2025-38207?
CVE-2025-38207 affects multiple versions of the Linux kernel prior to the application of the relevant patches.
What causes CVE-2025-38207?
CVE-2025-38207 is caused by a bug that triggers a memory corruption issue when expanding virtual memory areas with uprobe.
Is CVE-2025-38207 exploitable?
Yes, CVE-2025-38207 may be exploitable under certain conditions, potentially leading to system instability.