kasan: use dump_stack_lvl(KERN_ERR) to print stacks
authorAlexander Potapenko <glider@google.com>
Tue, 29 Jun 2021 02:40:33 +0000 (19:40 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:52 +0000 (10:53 -0700)
Most of the contents of KASAN reports are printed with pr_err(), so use a
consistent logging level to print the memory access stacks.

Link: https://lkml.kernel.org/r/20210506105405.3535023-2-glider@google.com
Signed-off-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Prasad Sodagudi <psodagud@quicinc.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: he, bo <bo.he@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/kasan/report.c

index 14bd51e..8fff182 100644 (file)
@@ -230,7 +230,7 @@ static void print_address_description(void *addr, u8 tag)
 {
        struct page *page = kasan_addr_to_page(addr);
 
-       dump_stack();
+       dump_stack_lvl(KERN_ERR);
        pr_err("\n");
 
        if (page && PageSlab(page)) {
@@ -375,7 +375,7 @@ void kasan_report_async(void)
        pr_err("BUG: KASAN: invalid-access\n");
        pr_err("Asynchronous mode enabled: no access details available\n");
        pr_err("\n");
-       dump_stack();
+       dump_stack_lvl(KERN_ERR);
        end_report(&flags, 0);
 }
 #endif /* CONFIG_KASAN_HW_TAGS */
@@ -420,7 +420,7 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write,
                pr_err("\n");
                print_memory_metadata(info.first_bad_addr);
        } else {
-               dump_stack();
+               dump_stack_lvl(KERN_ERR);
        }
 
        end_report(&flags, addr);