diff options
| author | Dima Koziuk <dmytrokoziuk68@gmail.com> | 2026-10-02 23:05:07 +0300 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-08 23:06:24 -0700 |
| commit | f407a2401464997329b85bd4b4242600a2f9a953 (patch) | |
| tree | 2a433d982ce7a2e23c83a8a4a3fe976dffc16187 /tools/lib/python | |
| parent | fda9181f6a9b0e966ae06aef4d44169dee23ca2c (diff) | |
| download | linux-next-f407a2401464997329b85bd4b4242600a2f9a953.tar.gz linux-next-f407a2401464997329b85bd4b4242600a2f9a953.zip | |
mm: kmsan: fix iounmap metadata teardown
kmsan_vmalloc_to_page_or_null() rejects addresses outside the regular
vmalloc and module ranges, including the shadow and origin addresses
passed by its callers. As a result, iounmap does not free the metadata
backing pages. Also, the first iteration of the teardown loop unmaps the
entire metadata range, preventing subsequent iterations from finding their
pages even if the address lookup is fixed.
Factor the page-table walk out of vmalloc_to_page() into
__vmalloc_to_page(), keeping the address check in the public wrapper. Use
the unchecked helper in kmsan_vmalloc_to_page_or_null() and check for NULL
before converting the returned page to a PFN. Mark __vmalloc_to_page() as
__always_inline to avoid an additional function call in vmalloc_to_page().
Move metadata teardown into kmsan_iounmap_pages(). Free the backing
blocks while their mappings are still available, then unmap each metadata
range once and flush its TLB entries.
Link: https://lore.kernel.org/20261002200508.546-1-dmytrokoziuk68@gmail.com
Fixes: b073d7f8aee4 ("mm: kmsan: maintain KMSAN metadata for page operations")
Signed-off-by: Dima Koziuk <dmytrokoziuk68@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Alexander Potapenko <glider@google.com>
Link: https://lkml.iu.edu/2609.3/12748.html
Cc: Marco Elver <elver@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
