Patch "perf ftrace: Fix access to pid in array when setting a pid filter" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf ftrace: Fix access to pid in array when setting a pid filter

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-ftrace-fix-access-to-pid-in-array-when-setting-.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f6a86880582a4d2385ad27f0e731ea2c5b962dbb
Author: Thomas Richter <tmricht@xxxxxxxxxxxxx>
Date:   Wed Apr 21 14:04:00 2021 +0200

    perf ftrace: Fix access to pid in array when setting a pid filter
    
    [ 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@xxxxxxxxxx>
    Signed-off-by: Thomas Richter <tmricht@xxxxxxxxxxxxx>
    Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Cc: Sumanth Korikkar <sumanthk@xxxxxxxxxxxxx>
    Cc: Sven Schnelle <svens@xxxxxxxxxxxxx>
    Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx>
    Link: http://lore.kernel.org/lkml/20210421120400.2126433-1-tmricht@xxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index d5adc417a4ca..40b179f54428 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -161,7 +161,7 @@ static int set_tracing_pid(struct perf_ftrace *ftrace)
 
 	for (i = 0; i < perf_thread_map__nr(ftrace->evlist->core.threads); i++) {
 		scnprintf(buf, sizeof(buf), "%d",
-			  ftrace->evlist->core.threads->map[i]);
+			  perf_thread_map__pid(ftrace->evlist->core.threads, i));
 		if (append_tracing_file("set_ftrace_pid", buf) < 0)
 			return -1;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux