• Thomas Richter's avatar
    perf ftrace: Fix access to pid in array when setting a pid filter · 671b60cb
    Thomas Richter authored
    
    
    Command 'perf ftrace -v -- ls' fails in s390 (at least 5.12.0rc6).
    
    The root cause is a missing pointer dereference which causes an
    array element address to be used as PID.
    
    Fix this by extracting the PID.
    
    Output before:
      # ./perf ftrace -v -- ls
      function_graph tracer is used
      write '-263732416' to tracing/set_ftrace_pid failed: Invalid argument
      failed to set ftrace pid
      #
    
    Output after:
       ./perf ftrace -v -- ls
       function_graph tracer is used
       # tracer: function_graph
       #
       # CPU  DURATION                  FUNCTION CALLS
       # |     |   |                     |   |   |   |
       4)               |  rcu_read_lock_sched_held() {
       4)   0.552 us    |    rcu_lockdep_current_cpu_online();
       4)   6.124 us    |  }
    Reported-by: default avatarAlexander Schmidt <alexschm@de.ibm.com>
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Sumanth Korikkar <sumanthk@li...
    671b60cb
builtin-ftrace.c 21.7 KB