tracing: kmem: convert call_site addresses to user friendly symbols
Subsystems (2)
PATCH v2 1/1 tracing: kmem: convert call_site addresses to user friendly symbols
While attempting to debug slub freelist pointer corruption bugs caused by a module, I discovered that the kmem call_site addresses are not at all user friendly for modules unless you manage to save a copy of kallsyms for the running kernel beforehand.
So convert kmem call_site addresses to user friendly symbols which is especially helpful for module callers when you don't have a copy of kallsyms for the running kernel.
---
Change history:
v1:
- First submission
v2:
- Fix kbuild test robot issues as suggested by
Steven Rostedt.
--- include/trace/events/kmem.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
include/trace/events/kmem.h +6 -5
@@ -35,8 +35,8 @@ DECLARE_EVENT_CLASS(kmem_alloc, __entry->gfp_flags = gfp_flags; ), - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", - __entry->call_site, + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", + (void *)__entry->call_site, __entry->ptr, __entry->bytes_req, __entry->bytes_alloc,
@@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node, __entry->node = node; ), - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", - __entry->call_site, + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", + (void *)__entry->call_site, __entry->ptr, __entry->bytes_req, __entry->bytes_alloc,
@@ -131,7 +131,8 @@ DECLARE_EVENT_CLASS(kmem_free, __entry->ptr = ptr; ), -TP_printk ("call_site=%lx ptr=%p" , __entry->call_site, __entry->ptr) +TP_printk ("call_site=%pS ptr=%p" , + (void *)__entry->call_site, __entry->ptr) ); DEFINE_EVENT(kmem_free, kfree,
Signature · 1 line
2.7.4
Hmm, get_maintainers.pl fails to get the people I think should be maintaining include/trace/events/kmem.h.
Quoted 11 lines · On Mon, 22 Jul 2019 17:42:59 -0400 "George G. Davis" <[email protected]>…
While attempting to debug slub freelist pointer corruption bugs caused by a module, I discovered that the kmem
call_siteaddresses are not at all user friendly for modules unless you manage to save a copy of kallsyms for the running kernel beforehand.So convert kmem
call_siteaddresses to user friendly symbols which is especially helpful for module callers when you don't have a copy of kallsyms for the running kernel.Reported-by kbuild test robot <[email protected]>Signed-off-by George G. Davis <[email protected]>
I can take this if nobody else does.
-- Steve
Quoted 47 lines
---
Change history:
v1:
- First submission
v2:
- Fix kbuild test robot issues as suggested by
Steven Rostedt.--- include/trace/events/kmem.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)include/trace/events/kmem.h +6
-5@@ -35,8 +35,8 @@ DECLARE_EVENT_CLASS(kmem_alloc, __entry->gfp_flags = gfp_flags; ), - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", - __entry->call_site, + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", + (void *)__entry->call_site, __entry->ptr, __entry->bytes_req, __entry->bytes_alloc,@@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node, __entry->node = node; ), - TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", - __entry->call_site, + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", + (void *)__entry->call_site, __entry->ptr, __entry->bytes_req, __entry->bytes_alloc,@@ -131,7 +131,8 @@ DECLARE_EVENT_CLASS(kmem_free, __entry->ptr = ptr; ), -TP_printk ("call_site=%lx ptr=%p" , __entry->call_site, __entry->ptr) +TP_printk ("call_site=%pS ptr=%p" , + (void *)__entry->call_site, __entry->ptr) ); DEFINE_EVENT(kmem_free, kfree,