diff mbox series

[mm,04/22] kasan: improve stack frame info in reports

Message ID aa613f097c12f7b75efb17f2618ae00480fb4bc3.1646237226.git.andreyknvl@google.com (mailing list archive)
State New
Headers show
Series kasan: report clean-ups and improvements | expand

Commit Message

andrey.konovalov@linux.dev March 2, 2022, 4:36 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com>

- Print at least task name and id for reports affecting allocas
  (get_address_stack_frame_info() does not support them).

- Capitalize first letter of each sentence.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
 mm/kasan/report_generic.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Alexander Potapenko March 2, 2022, 5:31 p.m. UTC | #1
On Wed, Mar 2, 2022 at 5:36 PM <andrey.konovalov@linux.dev> wrote:

> From: Andrey Konovalov <andreyknvl@google.com>
>
> - Print at least task name and id for reports affecting allocas
>   (get_address_stack_frame_info() does not support them).
>
> - Capitalize first letter of each sentence.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
>
Reviewed-by: Alexander Potapenko <glider@google.com>

> ---
>  mm/kasan/report_generic.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
> index 3751391ff11a..7e03cca569a7 100644
> --- a/mm/kasan/report_generic.c
> +++ b/mm/kasan/report_generic.c
> @@ -180,7 +180,7 @@ static void print_decoded_frame_descr(const char
> *frame_descr)
>                 return;
>
>         pr_err("\n");
> -       pr_err("this frame has %lu %s:\n", num_objects,
> +       pr_err("This frame has %lu %s:\n", num_objects,
>                num_objects == 1 ? "object" : "objects");
>
>         while (num_objects--) {
> @@ -266,13 +266,14 @@ void kasan_print_address_stack_frame(const void
> *addr)
>         if (WARN_ON(!object_is_on_stack(addr)))
>                 return;
>
> +       pr_err("The buggy address belongs to stack of task %s/%d\n",
> +              current->comm, task_pid_nr(current));
> +
>         if (!get_address_stack_frame_info(addr, &offset, &frame_descr,
>                                           &frame_pc))
>                 return;
>
> -       pr_err("\n");
> -       pr_err("addr %px is located in stack of task %s/%d at offset %lu
> in frame:\n",
> -              addr, current->comm, task_pid_nr(current), offset);
> +       pr_err(" and is located at offset %lu in frame:\n", offset);
>         pr_err(" %pS\n", frame_pc);
>
>         if (!frame_descr)
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kasan-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/kasan-dev/aa613f097c12f7b75efb17f2618ae00480fb4bc3.1646237226.git.andreyknvl%40google.com
> .
>
diff mbox series

Patch

diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
index 3751391ff11a..7e03cca569a7 100644
--- a/mm/kasan/report_generic.c
+++ b/mm/kasan/report_generic.c
@@ -180,7 +180,7 @@  static void print_decoded_frame_descr(const char *frame_descr)
 		return;
 
 	pr_err("\n");
-	pr_err("this frame has %lu %s:\n", num_objects,
+	pr_err("This frame has %lu %s:\n", num_objects,
 	       num_objects == 1 ? "object" : "objects");
 
 	while (num_objects--) {
@@ -266,13 +266,14 @@  void kasan_print_address_stack_frame(const void *addr)
 	if (WARN_ON(!object_is_on_stack(addr)))
 		return;
 
+	pr_err("The buggy address belongs to stack of task %s/%d\n",
+	       current->comm, task_pid_nr(current));
+
 	if (!get_address_stack_frame_info(addr, &offset, &frame_descr,
 					  &frame_pc))
 		return;
 
-	pr_err("\n");
-	pr_err("addr %px is located in stack of task %s/%d at offset %lu in frame:\n",
-	       addr, current->comm, task_pid_nr(current), offset);
+	pr_err(" and is located at offset %lu in frame:\n", offset);
 	pr_err(" %pS\n", frame_pc);
 
 	if (!frame_descr)