]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
perf ftrace: Fix access to pid in array when setting a pid filter
authorThomas Richter <tmricht@linux.ibm.com>
Wed, 21 Apr 2021 12:04:00 +0000 (14:04 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:03:33 +0000 (10:03 +0200)
commit6324907a9ae52f1feeabe01f53335e85afcef8a8
tree5a4468376e314f58c5cf52626a785c91f76055d5
parentf6430b0d39cc68c7e0e4455c9afee21e6574d876
perf ftrace: Fix access to pid in array when setting a pid filter

BugLink: https://bugs.launchpad.net/bugs/1928850
[ Upstream commit 671b60cb6a897a5b3832fe57657152f2c3995e25 ]

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: Alexander Schmidt <alexschm@de.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20210421120400.2126433-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tools/perf/builtin-ftrace.c