{"id":11233,"date":"2026-09-04T18:51:46","date_gmt":"2026-09-04T10:51:46","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-74632"},"modified":"2026-09-04T18:51:46","modified_gmt":"2026-09-04T10:51:46","slug":"cve-2026-74632","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-74632","title":{"rendered":"CVE-2026-74632 [HIGH] &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nmm\/huge_memory: fix h"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>mm\/huge_memory: fix huge_zero_pfn race<\/p>\n<p>Patch series &#8220;mm\/huge_memory: fix huge_zero_pfn race&#8221;, v2.<\/p>\n<p>There is a subtle race in the reference-counted huge_zero_folio<br \/>\nimplementation.<\/p>\n<p>The fast path atomic logic fails to account for the fact that the shrinker<br \/>\n(which drops the final huge_zero_refcount pin) can overwrite huge_zero_pfn<br \/>\nwith the ~0UL sentinel value in shrink_huge_zero_folio_scan() after a<br \/>\nracing get_huge_zero_folio() installed a valid value there.<\/p>\n<p>This results in huge_zero_folio being correctly set but huge_zero_pfn<br \/>\nbeing set incorrectly and thus is_huge_zero_pfn() and consequently<br \/>\nis_huge_zero_pmd() will misidentify the huge zero folio as being an<br \/>\nordinary THP folio.<\/p>\n<p>This can result in the huge zero folio being split and otherwise treated<br \/>\nincorrectly.<\/p>\n<p>The solution to this is very subtle as there is an atomic fast path, and<br \/>\nthus ordering in weakly ordered architectures has to be treated very<br \/>\ncarefully.<\/p>\n<p>The first commit fixes the issue by introducing a spinlock around<br \/>\nhuge_zero_[pfn, folio, refcount] write, with careful consideration paid to<br \/>\nload\/store ordering in the fast path.  It is placed first and kept as<br \/>\nsmall as possible so that it can be backported on its own.<\/p>\n<p>The second commit is a pure cleanup which reworks the<br \/>\nCONFIG_PERSISTENT_HUGE_ZERO_FOLIO logic to better separate the persistent<br \/>\nlogic from the dynamically allocated one.<\/p>\n<p>This patch (of 2):<\/p>\n<p>If !CONFIG_PERSISTENT_HUGE_ZERO_FOLIO, the huge_zero_folio is refcounted<br \/>\nby huge_zero_refcount and returned by mm_get_huge_zero_folio().<\/p>\n<p>When the caller is done with the huge zero page, its reference count is<br \/>\ndecremented.  Only a shrinker can set the reference count to zero.<\/p>\n<p>A race can unfortunately occur between a shrinker decrementing the<br \/>\nreference count to zero and a concurrent page fault.<\/p>\n<p>This is because shrink_huge_zero_folio_scan() might, if very unlucky, be<br \/>\npreempted between setting huge_zero_refcount to zero and writing an<br \/>\ninvalid value.<\/p>\n<p>During this time get_huge_zero_folio() could write to huge_zero_pfn before<br \/>\nshrink_huge_zero_folio_scan() resumes.<\/p>\n<p>In this event the huge zero folio will be persistently misidentified<br \/>\ncausing the THP code path to be entered inappropriately for the huge zero<br \/>\nfolio:<\/p>\n<p>                CPU 0                                   CPU 1<br \/>\n=======================================|=================================<br \/>\nshrink_huge_zero_folio_scan()          |<br \/>\n   atomic_cmpxchg() sets refcount to 0 |<br \/>\n   xchg() sets huge_zero_folio to NULL | get_huge_zero_folio()<br \/>\n                 |                     |    atomic_inc_not_zero() -&gt; zero<br \/>\n      preempted for a long time        |    Allocate new huge zero folio<br \/>\n                 |                     |    Write valid huge_zero_folio<br \/>\n                 v                     |    Write valid huge_zero_pfn<br \/>\n  Overwrite huge_zero_pfn with ~0UL   &lt;&#8212; Invalid overwrite!<\/p>\n<p>This results in is_huge_zero_pfn() and is_huge_zero_pmd() incorrectly<br \/>\nreturning false for a huge zero page which could result in issues like the<br \/>\nhuge zero folio being incorrectly split.<\/p>\n<p>Note that the issue is with huge_zero_pfn not huge_zero_folio, as<br \/>\nget_huge_zero_folio() uses cmpxchg() gated on huge_zero_folio being NULL<br \/>\nwith a retry loop and shrink_huge_zero_folio_scan() uses xchg() to set<br \/>\nhuge_zero_folio.<\/p>\n<p>Fix the issue by introducing a spinlock, huge_zero_lock, to prevent<br \/>\nconcurrent write of huge_zero_folio, huge_zero_pfn and huge_zero_refcount.<\/p>\n<p>There needs to be significant care taken here to ensure correctness:<\/p>\n<p>The fast path in get_huge_zero_folio() uses atomic_inc_not_zero(), which<br \/>\nis outside of the critical section, and means huge zero allocation is<br \/>\ngated on zero huge_zero_refcount.<\/p>\n<p>The fast path doesn&#039;t use huge_zero_lock, so the critical section is<br \/>\nirrelevant to it.<\/p>\n<p>So invariants are required &#8211; huge_zero_refcount MUST:<\/p>\n<p>* Only be set in the huge_zero_lock critical section to ensure<br \/>\n  serialisation of huge_zero_pfn, huge_zero_folio and<br \/>\n&#8212;truncated&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>mm\/huge_memory: fix huge_zero_pfn race<\/p>\n<p>Patch series &#8220;mm\/huge_memory: fix huge_zero_pfn race&#8221;, v2.<\/p>\n<p>There is a subtle race in the r<\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-11233","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/11233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/vuln"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}