Commit b30c14c
hugetlb: unshare some PMDs when splitting VMAs
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]>1 parent a1193de commit b30c14c
1 file changed
+35
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
4834 | 4836 | | |
4835 | 4837 | | |
4836 | 4838 | | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
| 4851 | + | |
| 4852 | + | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
4837 | 4858 | | |
4838 | 4859 | | |
4839 | 4860 | | |
| |||
7322 | 7343 | | |
7323 | 7344 | | |
7324 | 7345 | | |
7325 | | - | |
7326 | | - | |
7327 | | - | |
7328 | | - | |
7329 | | - | |
| 7346 | + | |
| 7347 | + | |
| 7348 | + | |
7330 | 7349 | | |
7331 | 7350 | | |
7332 | 7351 | | |
7333 | 7352 | | |
7334 | 7353 | | |
7335 | | - | |
| 7354 | + | |
7336 | 7355 | | |
7337 | 7356 | | |
7338 | 7357 | | |
7339 | 7358 | | |
7340 | 7359 | | |
7341 | 7360 | | |
7342 | | - | |
7343 | | - | |
7344 | | - | |
7345 | 7361 | | |
7346 | 7362 | | |
7347 | 7363 | | |
| |||
7373 | 7389 | | |
7374 | 7390 | | |
7375 | 7391 | | |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
| 7398 | + | |
| 7399 | + | |
| 7400 | + | |
| 7401 | + | |
7376 | 7402 | | |
7377 | 7403 | | |
7378 | 7404 | | |
| |||
0 commit comments