Commit 98b74bb
mm/hugetlb.c: fix UAF of vma in hugetlb fault pathway
Syzbot reports a UAF in hugetlb_fault(). This happens because
vmf_anon_prepare() could drop the per-VMA lock and allow the current VMA
to be freed before hugetlb_vma_unlock_read() is called.
We can fix this by using a modified version of vmf_anon_prepare() that
doesn't release the VMA lock on failure, and then release it ourselves
after hugetlb_vma_unlock_read().
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 9acad7b ("hugetlb: use vmf_anon_prepare() instead of anon_vma_prepare()")
Reported-by: [email protected]
Closes: https://lore.kernel.org/linux-mm/[email protected]/
Signed-off-by: Vishal Moola (Oracle) <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 2a058ab commit 98b74bb
1 file changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6048 | 6048 | | |
6049 | 6049 | | |
6050 | 6050 | | |
6051 | | - | |
| 6051 | + | |
6052 | 6052 | | |
6053 | 6053 | | |
6054 | 6054 | | |
| |||
6247 | 6247 | | |
6248 | 6248 | | |
6249 | 6249 | | |
6250 | | - | |
| 6250 | + | |
6251 | 6251 | | |
6252 | 6252 | | |
6253 | 6253 | | |
| |||
6378 | 6378 | | |
6379 | 6379 | | |
6380 | 6380 | | |
| 6381 | + | |
| 6382 | + | |
| 6383 | + | |
| 6384 | + | |
| 6385 | + | |
| 6386 | + | |
| 6387 | + | |
| 6388 | + | |
6381 | 6389 | | |
6382 | 6390 | | |
6383 | 6391 | | |
| |||
6599 | 6607 | | |
6600 | 6608 | | |
6601 | 6609 | | |
| 6610 | + | |
| 6611 | + | |
| 6612 | + | |
| 6613 | + | |
| 6614 | + | |
| 6615 | + | |
| 6616 | + | |
| 6617 | + | |
6602 | 6618 | | |
6603 | 6619 | | |
6604 | 6620 | | |
| |||
0 commit comments