Commit 89824bf
hugetlb: unshare some PMDs when splitting VMAs
jira VULN-71585
cve-pre CVE-2025-38084
commit-author James Houghton <[email protected]>
commit b30c14c
upstream-diff Stable 5.15 backport bd9a23a
was used for the actual (clean) cherry-pick
PMD sharing can only be done in PUD_SIZE-aligned pieces of VMAs; however,
it is possible that HugeTLB VMAs are split without unsharing the PMDs
first.
Without this fix, it is possible to hit the uffd-wp-related WARN_ON_ONCE
in hugetlb_change_protection [1]. The key there is that
hugetlb_unshare_all_pmds will not attempt to unshare PMDs in
non-PUD_SIZE-aligned sections of the VMA.
It might seem ideal to unshare in hugetlb_vm_op_open, but we need to
unshare in both the new and old VMAs, so unsharing in hugetlb_vm_op_split
seems natural.
[1]: https://lore.kernel.org/linux-mm/CADrL8HVeOkj0QH5VZZbRzybNE8CG-tEGFshnA+bG9nMgcWtBSg@mail.gmail.com/
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 6dfeaff ("hugetlb/userfaultfd: unshare all pmds for hugetlbfs when register wp")
Signed-off-by: James Houghton <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Acked-by: Peter Xu <[email protected]>
Cc: Axel Rasmussen <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
(cherry picked from commit b30c14c)
Signed-off-by: Marcin Wcisło <[email protected]>1 parent 9f30757 commit 89824bf
1 file changed
+35
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
4628 | 4630 | | |
4629 | 4631 | | |
4630 | 4632 | | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
4631 | 4652 | | |
4632 | 4653 | | |
4633 | 4654 | | |
| |||
7036 | 7057 | | |
7037 | 7058 | | |
7038 | 7059 | | |
7039 | | - | |
7040 | | - | |
7041 | | - | |
7042 | | - | |
7043 | | - | |
| 7060 | + | |
| 7061 | + | |
| 7062 | + | |
7044 | 7063 | | |
7045 | 7064 | | |
7046 | 7065 | | |
7047 | 7066 | | |
7048 | 7067 | | |
7049 | | - | |
| 7068 | + | |
7050 | 7069 | | |
7051 | 7070 | | |
7052 | 7071 | | |
7053 | 7072 | | |
7054 | 7073 | | |
7055 | 7074 | | |
7056 | | - | |
7057 | | - | |
7058 | | - | |
7059 | 7075 | | |
7060 | 7076 | | |
7061 | 7077 | | |
| |||
7088 | 7104 | | |
7089 | 7105 | | |
7090 | 7106 | | |
| 7107 | + | |
| 7108 | + | |
| 7109 | + | |
| 7110 | + | |
| 7111 | + | |
| 7112 | + | |
| 7113 | + | |
| 7114 | + | |
| 7115 | + | |
| 7116 | + | |
7091 | 7117 | | |
7092 | 7118 | | |
7093 | 7119 | | |
| |||
0 commit comments