{"id":"CVE-2026-99461","aliases":["CVE-2026-99461"],"related":[],"kind":"vulnerability","state":"published","title":"mm: khugepaged: fix swap entry value to folio_pfn()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: khugepaged: fix swap entry value to folio_pfn()\n\nPatch series \"mm: khugepaged: fix tracepoint UAF\", v5.\n\nThe khugepaged tracepoints take a folio pointer and call folio_pfn(), but\nby then the folio may no longer be valid: freed after folio_put(),\nfolio_unlock() or pte_unmap_unlock(), or not a folio at all but an\nxarray-encoded swap entry.  On classic SPARSEMEM, dereferencing it oopses\nkhugepaged as soon as the trace event is enabled; on other memory models\nit merely prints a bogus pfn.\n\nPass the pfn to the tracepoints directly, captured while the folio is\nstill pinned, closing the use-after-free windows in\nmm_khugepaged_scan_file(), mm_khugepaged_scan_pmd() and\nmm_khugepaged_collapse_file().\n\n\nThis patch (of 3):\n\nWhen the swap entries found exceed max_ptes_swap, the loop is left via\nbreak with folio still holding the xarray value that encodes the swap\nentry, not valid folio pointer.\n\nThat value is passed to trace_mm_khugepaged_scan_file(), which feeds it to\nfolio_pfn().  On FLATMEM and SPARSEMEM_VMEMMAP, the page_to_pfn() is plain\npointer arithmetic, so the trace event merely prints bogus scan_pfn.  On\nclassic SPARSEMEM, the page_to_pfn() reads page->flags, dereferencing the\ntiny encoded integer and oopsing khugepaged whenever the trace event is\nenabled.\n\nSo when folio is the swap entry value, simply set pfn to -1, just like\nexhausted scan naturally.\n\nAnd the folio_put() has maybe dropped the last reference of folio.  The\ntrace_mm_khugepaged_scan_file() is left with a dangling folio pointer.  so\nusing the folio_pfn() before dropping the reference, closing\nuse-after-free window.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: khugepaged: fix swap entry value to folio_pfn()\n\nPatch series \"mm: khugepaged: fix tracepoint UAF\", v5.\n\nThe khugepaged tracepoints take a folio pointer and call folio_pfn(), but\nby then the folio may no longer be valid: freed after folio_put(),\nfolio_unlock() or pte_unmap_unlock(), or not a folio at all but an\nxarray-encoded swap entry.  On classic SPARSEMEM, dereferencing it oopses\nkhugepaged as soon as the trace event is enabled; on other memory models\nit merely prints a bogus pfn.\n\nPass the pfn to the tracepoints directly, captured while the folio is\nstill pinned, closing the use-after-free windows in\nmm_khugepaged_scan_file(), mm_khugepaged_scan_pmd() and\nmm_khugepaged_collapse_file().\n\n\nThis patch (of 3):\n\nWhen the swap entries found exceed max_ptes_swap, the loop is left via\nbreak with folio still holding the xarray value that encodes the swap\nentry, not valid folio pointer.\n\nThat value is passed to trace_mm_khugepaged_scan_file(), which feeds it to\nfolio_pfn().  On FLATMEM and SPARSEMEM_VMEMMAP, the page_to_pfn() is plain\npointer arithmetic, so the trace event merely prints bogus scan_pfn.  On\nclassic SPARSEMEM, the page_to_pfn() reads page->flags, dereferencing the\ntiny encoded integer and oopsing khugepaged whenever the trace event is\nenabled.\n\nSo when folio is the swap entry value, simply set pfn to -1, just like\nexhausted scan naturally.\n\nAnd the folio_put() has maybe dropped the last reference of folio.  The\ntrace_mm_khugepaged_scan_file() is left with a dangling folio pointer.  so\nusing the folio_pfn() before dropping the reference, closing\nuse-after-free window.","source":"cvelist"}],"published":"2026-11-19T14:42:08.945Z","modified":"2026-11-23T08:17:49.917Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"67d5822d6fbb93abcaae74853f4d125cb6118a46","status":"affected"},{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"72b6f93acb1518e811dfd4828ab917acacb32920","status":"affected"},{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"384c524e066459c91a8750a055fe70d56b334437","status":"affected"},{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"c4252273ead984541eb9313667f2924f2ff8d0e0","status":"affected"},{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"9efc8d0c9c81094cfa99667154f5682d487e9b63","status":"affected"},{"type":"git","introduced":"d41fd2016ed07a630da2817b76c98eeab7931e1e","fixed":"942c8ec27aa4ffc587511650718349964e1696e6","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.1","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.1","status":"unaffected"},{"type":"semver","introduced":"6.1.193","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.117","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.63","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.2","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/67d5822d6fbb93abcaae74853f4d125cb6118a46","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/72b6f93acb1518e811dfd4828ab917acacb32920","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/384c524e066459c91a8750a055fe70d56b334437","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c4252273ead984541eb9313667f2924f2ff8d0e0","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9efc8d0c9c81094cfa99667154f5682d487e9b63","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/942c8ec27aa4ffc587511650718349964e1696e6","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-99461","url":"https://www.cve.org/CVERecord?id=CVE-2026-99461","licence":"CVE Terms of Use","modified":"2026-11-23T08:03:07.461Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-99461","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99461","licence":"Public domain","modified":"2026-11-23T08:17:49.917Z"}],"updatedAt":"2026-11-25T22:59:52.079Z","epss":{"score":0.00206,"percentile":0.11284,"date":"2026-12-02T12:00:21.000Z"}}