• Steven Rostedt (VMware)'s avatar
    mm, tracing: Fix kmem_cache_free trace event to not print stale pointers · d8145679
    Steven Rostedt (VMware) authored
    The update to kmem_cache_free trace event added printing of the slab name in
    the trace event. But it only stores the pointer of the name which will be
    printed as a string when the event is read some time in the future. This is
    dangerous because the name could be freed in the mean time and when reading
    the trace event it would try to dereference the string name by the pointer
    to the name that has been freed.
    
    Instead, use the trace event helper macros __string(), __assign_str(), and
    __get_str() that are for this very case.
    
    Cc: Jacob Wen <jian.w.wen@oracle.com>
    Fixes: 3544de8e ("mm, tracing: record slab name for kmem_cache_free()")
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    d8145679
kmem.h 8.54 KB