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 <joelaf@google.com>
This commit is contained in:
Joel Fernandes
2018-03-23 09:32:41 -07:00
parent f361eb39cd
commit ebc27895e9

View File

@@ -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);
}