Patch "perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set" has been added to the 5.8-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 top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set

to the 5.8-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-top-skip-side-band-event-setup-if-have_libbpf_s.patch
and it can be found in the queue-5.8 subdirectory.

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



commit 74d5f3f2fe755f81acbc733701a5512009451960
Author: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
Date:   Tue Aug 18 20:30:37 2020 +0800

    perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
    
    [ Upstream commit 0c5f1acc2a14416bf30023f373558d369afdbfc8 ]
    
    When I execute 'perf top' without HAVE_LIBBPF_SUPPORT, there exists the
    following segmentation fault, skip the side-band event setup to fix it,
    this is similar with commit 1101c872c8c7 ("perf record: Skip side-band
    event setup if HAVE_LIBBPF_SUPPORT is not set").
    
      [yangtiezhu@linux perf]$ ./perf top
      <SNIP>
      perf: Segmentation fault
      Obtained 6 stack frames.
      ./perf(sighandler_dump_stack+0x5c) [0x12011b604]
      [0xffffffc010]
      ./perf(perf_mmap__read_init+0x3e) [0x1201feeae]
      ./perf() [0x1200d715c]
      /lib64/libpthread.so.0(+0xab9c) [0xffee10ab9c]
      /lib64/libc.so.6(+0x128f4c) [0xffedc08f4c]
      Segmentation fault
      [yangtiezhu@linux perf]$
    
    I use git bisect to find commit b38d85ef49cf ("perf bpf: Decouple
    creating the evlist from adding the SB event") is the first bad commit,
    so also add the Fixes tag.
    
    Committer testing:
    
    First build perf explicitely disabling libbpf:
    
      $ make NO_LIBBPF=1 O=/tmp/build/perf -C tools/perf install-bin && perf test python
    
    Now make sure it isn't linked:
    
      $ perf -vv | grep -w bpf
                       bpf: [ OFF ]  # HAVE_LIBBPF_SUPPORT
      $
      $ nm ~/bin/perf | grep libbpf
      $
    
    And now try to run 'perf top':
    
      # perf top
      perf: Segmentation fault
      -------- backtrace --------
      perf[0x5bcd6d]
      /lib64/libc.so.6(+0x3ca6f)[0x7fd0f5a66a6f]
      perf(perf_mmap__read_init+0x1e)[0x5e1afe]
      perf[0x4cc468]
      /lib64/libpthread.so.0(+0x9431)[0x7fd0f645a431]
      /lib64/libc.so.6(clone+0x42)[0x7fd0f5b2b912]
      #
    
    Applying this patch fixes the issue.
    
    Fixes: b38d85ef49cf ("perf bpf: Decouple creating the evlist from adding the SB event")
    Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
    Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Xuefeng Li <lixuefeng@xxxxxxxxxxx>
    Link: http://lore.kernel.org/lkml/1597753837-16222-1-git-send-email-yangtiezhu@xxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 13889d73f8dd5..c665d69c0651d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv)
 		goto out_delete_evlist;
 	}
 
+#ifdef HAVE_LIBBPF_SUPPORT
 	if (!top.record_opts.no_bpf_event) {
 		top.sb_evlist = evlist__new();
 
@@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv)
 			goto out_delete_evlist;
 		}
 	}
+#endif
 
 	if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
 		pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");



[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