From ebc27895e954ef84e33dbc7f72183d02c2c5f496 Mon Sep 17 00:00:00 2001 From: Joel Fernandes Date: Fri, 23 Mar 2018 09:32:41 -0700 Subject: [PATCH] ANDROID: debugobjects: Make stack check warning more informative Currently there is a difficult to debug bug where an object on the stack appears to not be on it. Discussing with tglx, he suggests printing the pointers and the location of the stack for the currently running task. Lets do the same, so that the error message is more informative and can help in debugging. After debugging, we can upstream this patch if its useful. Bug: 72009635 Change-Id: Id50518e70a500b850580684e82b999afbf88ee75 Signed-off-by: Joel Fernandes --- lib/debugobjects.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 056052dc8e91..19572a4bbdca 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -293,10 +293,13 @@ static void debug_object_is_on_stack(void *addr, int onstack) return; limit++; - if (is_on_stack) - pr_warn("object is on stack, but not annotated\n"); - else - pr_warn("object is not on stack, but annotated\n"); + if (is_on_stack) { + pr_warn("object %p is on stack %p, but NOT annotated\n", addr, + task_stack_page(current)); + } else { + pr_warn("object %p is NOT on stack %p, but annotated\n", addr, + task_stack_page(current)); + } WARN_ON(1); }