Commit 4d6cb25
committed
mm/hugetlb: fix missing hugetlb_lock for resv uncharge
jira LE-1907
cve CVE-2024-36000
Rebuild_History Non-Buildable kernel-5.14.0-427.35.1.el9_4
commit-author Peter Xu <peterx@redhat.com>
commit b76b469
There is a recent report on UFFDIO_COPY over hugetlb:
https://lore.kernel.org/all/000000000000ee06de0616177560@google.com/
350: lockdep_assert_held(&hugetlb_lock);
Should be an issue in hugetlb but triggered in an userfault context, where
it goes into the unlikely path where two threads modifying the resv map
together. Mike has a fix in that path for resv uncharge but it looks like
the locking criteria was overlooked: hugetlb_cgroup_uncharge_folio_rsvd()
will update the cgroup pointer, so it requires to be called with the lock
held.
Link: https://lkml.kernel.org/r/20240417211836.2742593-3-peterx@redhat.com
Fixes: 79aa925 ("hugetlb_cgroup: fix reservation accounting")
Signed-off-by: Peter Xu <peterx@redhat.com>
Reported-by: syzbot+4b8077a5fccc61c385a1@syzkaller.appspotmail.com
Reviewed-by: Mina Almasry <almasrymina@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit b76b469)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>1 parent 2394be1 commit 4d6cb25
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3117 | 3117 | | |
3118 | 3118 | | |
3119 | 3119 | | |
3120 | | - | |
| 3120 | + | |
| 3121 | + | |
3121 | 3122 | | |
3122 | 3123 | | |
| 3124 | + | |
| 3125 | + | |
3123 | 3126 | | |
3124 | 3127 | | |
3125 | 3128 | | |
| |||
0 commit comments