* [PATCH mm v2] kasan: print virtual mapping info in reports
@ 2022-02-22 16:43 andrey.konovalov
0 siblings, 0 replies; only message in thread
From: andrey.konovalov @ 2022-02-22 16:43 UTC (permalink / raw)
To: Andrew Morton
Cc: Andrey Konovalov, Mark Rutland, Marco Elver, Alexander Potapenko,
Dmitry Vyukov, Andrey Ryabinin, kasan-dev, linux-mm,
linux-kernel, Andrey Konovalov
From: Andrey Konovalov <andreyknvl@google.com>
Print virtual mapping range and its creator in reports affecting virtual
mappings.
Also get physical page pointer for such mappings, so page information
gets printed as well.
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
Note: no need to merge this patch into any of the KASAN vmalloc patches
that are already in mm, better to keep it separate.
Changes v1->v2:
- Add find_vm_area() return value NULL check as suggested by Mark Rutland.
---
mm/kasan/report.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 137c2c0b09db..f64352008bb8 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -260,8 +260,21 @@ static void print_address_description(void *addr, u8 tag)
pr_err(" %pS\n", addr);
}
+ if (is_vmalloc_addr(addr)) {
+ struct vm_struct *va = find_vm_area(addr);
+
+ if (va) {
+ pr_err("The buggy address belongs to the virtual mapping at\n"
+ " [%px, %px) created by:\n"
+ " %pS\n",
+ va->addr, va->addr + va->size, va->caller);
+
+ page = vmalloc_to_page(page);
+ }
+ }
+
if (page) {
- pr_err("The buggy address belongs to the page:\n");
+ pr_err("The buggy address belongs to the physical page:\n");
dump_page(page, "kasan: bad access detected");
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-22 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 16:43 [PATCH mm v2] kasan: print virtual mapping info in reports andrey.konovalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).