Commit 038fd2b4 authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Linus Torvalds

kasan: more line breaks in reports

Add a line break after each part that describes the buggy address.
Improves readability of reports.

Link: https://lkml.kernel.org/r/8682c4558e533cd0f99bdb964ce2fe741f2a9212.1646237226.git.andreyknvl@google.comSigned-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7131c883
...@@ -250,11 +250,13 @@ static void print_address_description(void *addr, u8 tag) ...@@ -250,11 +250,13 @@ static void print_address_description(void *addr, u8 tag)
void *object = nearest_obj(cache, slab, addr); void *object = nearest_obj(cache, slab, addr);
describe_object(cache, object, addr, tag); describe_object(cache, object, addr, tag);
pr_err("\n");
} }
if (kernel_or_module_addr(addr) && !init_task_stack_addr(addr)) { if (kernel_or_module_addr(addr) && !init_task_stack_addr(addr)) {
pr_err("The buggy address belongs to the variable:\n"); pr_err("The buggy address belongs to the variable:\n");
pr_err(" %pS\n", addr); pr_err(" %pS\n", addr);
pr_err("\n");
} }
if (is_vmalloc_addr(addr)) { if (is_vmalloc_addr(addr)) {
...@@ -265,6 +267,7 @@ static void print_address_description(void *addr, u8 tag) ...@@ -265,6 +267,7 @@ static void print_address_description(void *addr, u8 tag)
" [%px, %px) created by:\n" " [%px, %px) created by:\n"
" %pS\n", " %pS\n",
va->addr, va->addr + va->size, va->caller); va->addr, va->addr + va->size, va->caller);
pr_err("\n");
page = vmalloc_to_page(page); page = vmalloc_to_page(page);
} }
...@@ -273,9 +276,11 @@ static void print_address_description(void *addr, u8 tag) ...@@ -273,9 +276,11 @@ static void print_address_description(void *addr, u8 tag)
if (page) { if (page) {
pr_err("The buggy address belongs to the physical page:\n"); pr_err("The buggy address belongs to the physical page:\n");
dump_page(page, "kasan: bad access detected"); dump_page(page, "kasan: bad access detected");
pr_err("\n");
} }
kasan_print_address_stack_frame(addr); kasan_print_address_stack_frame(addr);
pr_err("\n");
} }
static bool meta_row_is_guilty(const void *row, const void *addr) static bool meta_row_is_guilty(const void *row, const void *addr)
...@@ -382,7 +387,6 @@ void kasan_report_invalid_free(void *object, unsigned long ip) ...@@ -382,7 +387,6 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
kasan_print_tags(tag, object); kasan_print_tags(tag, object);
pr_err("\n"); pr_err("\n");
print_address_description(object, tag); print_address_description(object, tag);
pr_err("\n");
print_memory_metadata(object); print_memory_metadata(object);
end_report(&flags, (unsigned long)object); end_report(&flags, (unsigned long)object);
} }
...@@ -443,7 +447,6 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write, ...@@ -443,7 +447,6 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write,
if (addr_has_metadata(untagged_addr)) { if (addr_has_metadata(untagged_addr)) {
print_address_description(untagged_addr, get_tag(tagged_addr)); print_address_description(untagged_addr, get_tag(tagged_addr));
pr_err("\n");
print_memory_metadata(info.first_bad_addr); print_memory_metadata(info.first_bad_addr);
} else { } else {
dump_stack_lvl(KERN_ERR); dump_stack_lvl(KERN_ERR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment