diff options
author | Andrey Konovalov <andreyknvl@google.com> | 2022-03-24 18:12:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-24 19:06:49 -0700 |
commit | 0f9b35f38318d21470975bec61e0e93b4aab5c3c (patch) | |
tree | 4012f7de5bc048d49d41854698803144f8d9fa02 /mm/kasan/report.c | |
parent | 038fd2b4cb42c64afa3cacad53f9e0f514b8d02a (diff) |
kasan: rearrange stack frame info in reports
- Move printing stack frame info before printing page info.
- Add object_is_on_stack() check to print_address_description() and add
a corresponding WARNING to kasan_print_address_stack_frame(). This
looks more in line with the rest of the checks in this function and
also allows to avoid complicating code logic wrt line breaks.
- Clean up comments related to get_address_stack_frame_info().
Link: https://lkml.kernel.org/r/1ee113a4c111df97d168c820b527cda77a3cac40.1646237226.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Alexander 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/kasan/report.c')
-rw-r--r-- | mm/kasan/report.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index ded648c0a0e4..d60ee8b81e2b 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -259,6 +259,15 @@ static void print_address_description(void *addr, u8 tag) pr_err("\n"); } + if (object_is_on_stack(addr)) { + /* + * Currently, KASAN supports printing frame information only + * for accesses to the task's own stack. + */ + kasan_print_address_stack_frame(addr); + pr_err("\n"); + } + if (is_vmalloc_addr(addr)) { struct vm_struct *va = find_vm_area(addr); @@ -278,9 +287,6 @@ static void print_address_description(void *addr, u8 tag) dump_page(page, "kasan: bad access detected"); pr_err("\n"); } - - kasan_print_address_stack_frame(addr); - pr_err("\n"); } static bool meta_row_is_guilty(const void *row, const void *addr) |