]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/perf-evsel-free-evsel-counts-in-perf_evsel__exit.patch
remove unneeded perf patch from 4.9
[thirdparty/kernel/stable-queue.git] / queue-4.9 / perf-evsel-free-evsel-counts-in-perf_evsel__exit.patch
1 From 6e50d31ce11810e2990d5beeb207fef3df796659 Mon Sep 17 00:00:00 2001
2 From: Arnaldo Carvalho de Melo <acme@redhat.com>
3 Date: Mon, 18 Mar 2019 16:41:28 -0300
4 Subject: perf evsel: Free evsel->counts in perf_evsel__exit()
5
6 [ Upstream commit 42dfa451d825a2ad15793c476f73e7bbc0f9d312 ]
7
8 Using gcc's ASan, Changbin reports:
9
10 =================================================================
11 ==7494==ERROR: LeakSanitizer: detected memory leaks
12
13 Direct leak of 48 byte(s) in 1 object(s) allocated from:
14 #0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
15 #1 0x5625e5330a5e in zalloc util/util.h:23
16 #2 0x5625e5330a9b in perf_counts__new util/counts.c:10
17 #3 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
18 #4 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
19 #5 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
20 #6 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
21 #7 0x5625e51528e6 in run_test tests/builtin-test.c:358
22 #8 0x5625e5152baf in test_and_print tests/builtin-test.c:388
23 #9 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
24 #10 0x5625e515572f in cmd_test tests/builtin-test.c:722
25 #11 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
26 #12 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
27 #13 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
28 #14 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
29 #15 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
30
31 Indirect leak of 72 byte(s) in 1 object(s) allocated from:
32 #0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
33 #1 0x5625e532560d in zalloc util/util.h:23
34 #2 0x5625e532566b in xyarray__new util/xyarray.c:10
35 #3 0x5625e5330aba in perf_counts__new util/counts.c:15
36 #4 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
37 #5 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
38 #6 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
39 #7 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
40 #8 0x5625e51528e6 in run_test tests/builtin-test.c:358
41 #9 0x5625e5152baf in test_and_print tests/builtin-test.c:388
42 #10 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
43 #11 0x5625e515572f in cmd_test tests/builtin-test.c:722
44 #12 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
45 #13 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
46 #14 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
47 #15 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
48 #16 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
49
50 His patch took care of evsel->prev_raw_counts, but the above backtraces
51 are about evsel->counts, so fix that instead.
52
53 Reported-by: Changbin Du <changbin.du@gmail.com>
54 Cc: Alexei Starovoitov <ast@kernel.org>
55 Cc: Daniel Borkmann <daniel@iogearbox.net>
56 Cc: Jiri Olsa <jolsa@kernel.org>
57 Cc: Namhyung Kim <namhyung@kernel.org>
58 Cc: Peter Zijlstra <peterz@infradead.org>
59 Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
60 Link: https://lkml.kernel.org/n/tip-hd1x13g59f0nuhe4anxhsmfp@git.kernel.org
61 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
62 Signed-off-by: Sasha Levin <sashal@kernel.org>
63 ---
64 tools/perf/util/evsel.c | 1 +
65 1 file changed, 1 insertion(+)
66
67 diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
68 index f7128c2a6386..a62f79558146 100644
69 --- a/tools/perf/util/evsel.c
70 +++ b/tools/perf/util/evsel.c
71 @@ -1167,6 +1167,7 @@ void perf_evsel__exit(struct perf_evsel *evsel)
72 {
73 assert(list_empty(&evsel->node));
74 assert(evsel->evlist == NULL);
75 + perf_evsel__free_counts(evsel);
76 perf_evsel__free_fd(evsel);
77 perf_evsel__free_id(evsel);
78 perf_evsel__free_config_terms(evsel);
79 --
80 2.19.1
81