• Steven Rostedt (VMware)'s avatar
    tracing: Add check of trace event print fmts for dereferencing pointers · 5013f454
    Steven Rostedt (VMware) authored
    Trace events record data into the ring buffer at the time of the event. The
    trace event has a printf logic to display the recorded data at a much later
    time when the user reads the trace file. This makes using dereferencing
    pointers unsafe if the dereferenced pointer points to the original source.
    The safe way to handle this is to create an array within the trace event and
    copy the source into the array. Then the dereference pointer may point to
    that array.
    
    As this is a easy mistake to make, a check is added to examine all trace
    event print fmts to make sure that they are safe to use. This only checks
    the various %p* dereferenced pointers like %pB, %pR, etc. It does not handle
    dereferencing of strings, as there are some use cases that are OK to
    dereference the source. That will be dealt with differently.
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    5013f454
trace_events.c 91.6 KB