{"id":"CVE-2026-63950","published":"2026-07-19T14:55:43Z","modified":"2026-08-05T12:37:35Z","title":"mm/rmap: initialize nr_pages to 1 at loop start in try_to_unmap_one","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/rmap: initialize nr_pages to 1 at loop start in try_to_unmap_one\n\nInitialize nr_pages to 1 at the start of each loop iteration, like\nfolio_referenced_one() does.\n\nWithout this, nr_pages computed by a previous folio_unmap_pte_batch() call\ncan be reused on a later iteration that does not run\nfolio_unmap_pte_batch() again.\n\nmmap a 64K large folio with MAP_ANONYMOUS | MAP_DROPPABLE, then call\nmadvise(MADV_FREE), then make the last page device-exclusive via\nHMM_DMIRROR_EXCLUSIVE.\n\nTrigger node reclaim through sysfs.  Now, in try_to_unmap_one(), we will\nfirst clear the first 15 out of 16 entries mapping the lazyfree folio. \nThis will set nr_pages to 15.  In the next pvmw walk, this nr_pages gets\nreused on a device-exclusive pte, thus potentially corrupting folio\nrefcount/mapcount.\n\nAt the moment, I have a userspace program which can make the kernel spit\nout a trace, but the blow up is in folio_referenced_one(), because there\nare existing bugs in the interaction between device-private and rmap\n(which too I am investigating).  I did a one liner kernel change to avoid\ngoing into folio_referenced_one(), and the kernel blows up at\nfolio_remove_rmap_ptes in try_to_unmap_one which is what I wanted.\n\nNote that the bug is there not since file folio batching but lazyfree\nfolio batching, since device-exclusive only works for anonymous folios.\n\nUserspace visible effect is simply kernel crashing somewhere due to\nrefcount/mapcount corruption.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00173,"percentile":0.03948,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/0fcc34d0d8fefca4fea349e45c10e3a3d90350eb","tags":[]},{"url":"https://git.kernel.org/stable/c/f611db9b771b2b6775357555d2517af044fca4f0","tags":[]},{"url":"https://git.kernel.org/stable/c/3f8968e9cbf95d5d87d32218906cab0b9b9eddbe","tags":[]}],"priority":{"score":6.2,"factors":[{"name":"EPSS percentile","points":0.79},{"name":"CVSS severity","points":5.46}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= 354dffd29575cdf13154e8fb787322354aa9efc4, < 0fcc34d0d8fefca4fea349e45c10e3a3d90350eb",">= 354dffd29575cdf13154e8fb787322354aa9efc4, < f611db9b771b2b6775357555d2517af044fca4f0",">= 354dffd29575cdf13154e8fb787322354aa9efc4, < 3f8968e9cbf95d5d87d32218906cab0b9b9eddbe"]},{"vendor":"Linux","product":"Linux","versions":["6.15"]}],"euvd":{"id":"EUVD-2026-45723","exploited":false,"provenance":"source"}}