diff options
author | Andrey Konovalov <andreyknvl@google.com> | 2017-05-03 17:56:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-03 18:52:12 -0400 |
commit | b6b72f4919c121bee5890732e0b8de2ab99c8dbc (patch) | |
tree | 4586108722cc91812d493e68044892cec820e4e9 | |
parent | 7d418f7b0d3407b93ec70f3b380cc5beafa1fa68 (diff) |
kasan: change allocation and freeing stack traces headers
Change stack traces headers from:
Allocated:
PID = 42
to:
Allocated by task 42:
Makes the report one line shorter and look better.
Link: http://lkml.kernel.org/r/20170302134851.101218-4-andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/kasan/report.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index d6b6ec77c56a..7d24363edd66 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c | |||
@@ -177,9 +177,9 @@ static void kasan_end_report(unsigned long *flags) | |||
177 | kasan_enable_current(); | 177 | kasan_enable_current(); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void print_track(struct kasan_track *track) | 180 | static void print_track(struct kasan_track *track, const char *prefix) |
181 | { | 181 | { |
182 | pr_err("PID = %u\n", track->pid); | 182 | pr_err("%s by task %u:\n", prefix, track->pid); |
183 | if (track->stack) { | 183 | if (track->stack) { |
184 | struct stack_trace trace; | 184 | struct stack_trace trace; |
185 | 185 | ||
@@ -201,10 +201,8 @@ static void kasan_object_err(struct kmem_cache *cache, void *object) | |||
201 | if (!(cache->flags & SLAB_KASAN)) | 201 | if (!(cache->flags & SLAB_KASAN)) |
202 | return; | 202 | return; |
203 | 203 | ||
204 | pr_err("Allocated:\n"); | 204 | print_track(&alloc_info->alloc_track, "Allocated"); |
205 | print_track(&alloc_info->alloc_track); | 205 | print_track(&alloc_info->free_track, "Freed"); |
206 | pr_err("Freed:\n"); | ||
207 | print_track(&alloc_info->free_track); | ||
208 | } | 206 | } |
209 | 207 | ||
210 | void kasan_report_double_free(struct kmem_cache *cache, void *object, | 208 | void kasan_report_double_free(struct kmem_cache *cache, void *object, |