diff options
| author | Umang Pokhriyal <umangpokhriyall@gmail.com> | 2026-11-04 15:04:57 +0530 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-09 22:44:31 -0800 |
| commit | 28ae0385b638f095109d282b927ac1a51f75c530 (patch) | |
| tree | d56c3f22d4b774c60b0ef856ff4114476c052b4f /tools/perf/scripts/python | |
| parent | f51d35b81fb572c551e82ff72575d6dbb8e35ba9 (diff) | |
userfaultfd: validate the whole range before changing write protection
mwriteprotect_range() checks each VMA as it walks the range. When a later
VMA is not registered for write protection, or is a hugetlb VMA the range
is not aligned to, the call fails after the earlier VMAs were already
changed. When unprotecting, userfaultfd_writeprotect() then skips
wake_userfault(), so threads blocked on those pages are not woken although
the pages are writable again.
An unprivileged process can trigger this with a range that spans an
unregistered VMA. It hasn't been seen in practice; it was found while
reviewing the userfaultfd range ioctls with an LLM.
Validate the whole range first, as mrwprotect_range() already does.
Link: https://lore.kernel.org/20261104093457.152245-1-umangpokhriyall@gmail.com
Fixes: a1b92a3f1498 ("mm/userfaultfd: support WP on multiple VMAs")
Signed-off-by: Umang Pokhriyal <umangpokhriyall@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
