Skip to content

Commit db8be66

Browse files
committed
mm/rmap: fix two comments related to huge_pmd_unshare()
jira VULN-46930 cve-bf CVE-2024-57883 commit-author David Hildenbrand (Red Hat) <david@kernel.org> commit a8682d5 PMD page table unsharing no longer touches the refcount of a PMD page table. Also, it is not about dropping the refcount of a "PMD page" but the "PMD page table". Let's just simplify by saying that the PMD page table was unmapped, consequently also unmapping the folio that was mapped into this page. This code should be deduplicated in the future. Link: https://lkml.kernel.org/r/20251223214037.580860-4-david@kernel.org Fixes: 59d9094 ("mm: hugetlb: independent PMD page table shared count") Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org> Reviewed-by: Rik van Riel <riel@surriel.com> Tested-by: Laurence Oberman <loberman@redhat.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: Oscar Salvador <osalvador@suse.de> Cc: Liu Shixin <liushixin2@huawei.com> Cc: Harry Yoo <harry.yoo@oracle.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: "Uschakow, Stanislav" <suschako@amazon.de> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit a8682d5) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent e5bda32 commit db8be66

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

mm/rmap.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,14 +1556,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
15561556
flush_tlb_range(vma,
15571557
range.start, range.end);
15581558
/*
1559-
* The ref count of the PMD page was
1560-
* dropped which is part of the way map
1561-
* counting is done for shared PMDs.
1562-
* Return 'true' here. When there is
1563-
* no other sharing, huge_pmd_unshare
1564-
* returns false and we will unmap the
1565-
* actual page and drop map count
1566-
* to zero.
1559+
* The PMD table was unmapped,
1560+
* consequently unmapping the folio.
15671561
*/
15681562
page_vma_mapped_walk_done(&pvmw);
15691563
break;
@@ -1926,14 +1920,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma,
19261920
range.start, range.end);
19271921

19281922
/*
1929-
* The ref count of the PMD page was
1930-
* dropped which is part of the way map
1931-
* counting is done for shared PMDs.
1932-
* Return 'true' here. When there is
1933-
* no other sharing, huge_pmd_unshare
1934-
* returns false and we will unmap the
1935-
* actual page and drop map count
1936-
* to zero.
1923+
* The PMD table was unmapped,
1924+
* consequently unmapping the folio.
19371925
*/
19381926
page_vma_mapped_walk_done(&pvmw);
19391927
break;

0 commit comments

Comments
 (0)