Patch "perf trace: Fix segfault when trying to trace events by cgroup" 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 trace: Fix segfault when trying to trace events by cgroup

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-trace-fix-segfault-when-trying-to-trace-events-.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 1eac0dd9995ad2cca4634e2e0de15821622baf5b
Author: Stanislav Ivanichkin <sivanichkin@xxxxxxxxxxxxxx>
Date:   Tue Oct 27 12:43:57 2020 +0300

    perf trace: Fix segfault when trying to trace events by cgroup
    
    [ Upstream commit a6293f36ac92ab513771a98efe486477be2f981f ]
    
      # ./perf trace -e sched:sched_switch -G test -a sleep 1
      perf: Segmentation fault
      Obtained 11 stack frames.
      ./perf(sighandler_dump_stack+0x43) [0x55cfdc636db3]
      /lib/x86_64-linux-gnu/libc.so.6(+0x3efcf) [0x7fd23eecafcf]
      ./perf(parse_cgroups+0x36) [0x55cfdc673f36]
      ./perf(+0x3186ed) [0x55cfdc70d6ed]
      ./perf(parse_options_subcommand+0x629) [0x55cfdc70e999]
      ./perf(cmd_trace+0x9c2) [0x55cfdc5ad6d2]
      ./perf(+0x1e8ae0) [0x55cfdc5ddae0]
      ./perf(+0x1e8ded) [0x55cfdc5ddded]
      ./perf(main+0x370) [0x55cfdc556f00]
      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe6) [0x7fd23eeadb96]
      ./perf(_start+0x29) [0x55cfdc557389]
      Segmentation fault
      #
    
     It happens because "struct trace" in option->value is passed to the
     parse_cgroups function instead of "struct evlist".
    
    Fixes: 9ea42ba4411ac ("perf trace: Support setting cgroups as targets")
    Signed-off-by: Stanislav Ivanichkin <sivanichkin@xxxxxxxxxxxxxx>
    Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Dmitry Monakhov <dmtrmonakhov@xxxxxxxxxxxxxx>
    Link: http://lore.kernel.org/lkml/20201027094357.94881-1-sivanichkin@xxxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index bb5130d021554..a5201de1a191d 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -3979,9 +3979,9 @@ do_concat:
 	err = 0;
 
 	if (lists[0]) {
-		struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
-					       "event selector. use 'perf list' to list available events",
-					       parse_events_option);
+		struct option o = {
+			.value = &trace->evlist,
+		};
 		err = parse_events_option(&o, lists[0], 0);
 	}
 out:
@@ -3995,9 +3995,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u
 {
 	struct trace *trace = opt->value;
 
-	if (!list_empty(&trace->evlist->core.entries))
-		return parse_cgroups(opt, str, unset);
-
+	if (!list_empty(&trace->evlist->core.entries)) {
+		struct option o = {
+			.value = &trace->evlist,
+		};
+		return parse_cgroups(&o, str, unset);
+	}
 	trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
 
 	return 0;



[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