diff options
| author | Jose Fernandez (Anthropic) <jose.fernandez@linux.dev> | 2026-10-31 04:33:59 +0000 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-09 22:44:29 -0800 |
| commit | cf5518aa1832d82b391ac2492863ae6a7315827c (patch) | |
| tree | 963cc7b2b5374d289b967bc5fd3a2b7828e7f6ab /tools/perf/scripts/python | |
| parent | 043b024a416073c4e2927e25168ec640a0f30be7 (diff) | |
mm/filemap: stop fault-around when the walk steps back
filemap_map_pages() can dereference a PTE pointer outside the page table
it locked. KASAN has reported this as a use-after-free read [1]. The
same path can also write out of bounds. When the stray entry reads as
none, the fault-around loop maps a page there with set_pte_range().
Its fault-around loop walks the page cache and moves vmf->pte by the
change in index. A lower index moves it back. xas_find() can step back
to a lower index when a multi-index entry is split during the walk.
[1] fixes xas_find(), but the loop still relies on the walk never stepping
back. Stop the fault-around when the walk steps back. ->fault() maps the
faulting page if the loop did not.
Link: https://lore.kernel.org/20261031-jf-mm-filemap-map-pages-lower-bound-v2-1-21029744e589@linux.dev
Link: https://lore.kernel.org/20260904121301.200049-1-krystianmkaniewski@gmail.com [1]
Fixes: 6b24ca4a1a8d ("mm: Use multi-index entries in the page cache")
Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
