File perf-probe-fix-kprobe-blacklist-checking-condition.patch of Package perf
70
1
From: Li Bin <huawei.libin@huawei.com>
2
Date: Tue, 29 Aug 2017 20:57:23 +0800
3
Subject: perf probe: Fix kprobe blacklist checking condition
4
Git-commit: 2c29461e273abaf149cf8220c3403e9d67dd8b61
5
Patch-mainline: v4.14-rc1
6
References: bsc#1070010 (git-fixes)
7
Signed-off-By: Tony Jones <tonyj@suse.de>
8
9
The commit 9aaf5a5f479b ("perf probe: Check kprobes blacklist when
10
adding new events"), 'perf probe' supports checking the blacklist of the
11
fuctions which can not be probed. But the checking condition is wrong,
12
that the end_addr of the symbol which is the start_addr of the next
13
symbol can't be included.
14
15
Committer notes:
16
17
IOW make it match its kernel counterpart in kernel/kprobes.c:
18
19
bool within_kprobe_blacklist(unsigned long addr)
20
21
Each entry have as its end address not its end address, but the first
22
address _outside_ that symbol, which for related functions, is the first
23
address of the next symbol, like these from kernel/trace/trace_probe.c:
24
25
0xffffffffbd198df0-0xffffffffbd198e40 print_type_u8
26
0xffffffffbd198e40-0xffffffffbd198e90 print_type_u16
27
0xffffffffbd198e90-0xffffffffbd198ee0 print_type_u32
28
0xffffffffbd198ee0-0xffffffffbd198f30 print_type_u64
29
0xffffffffbd198f30-0xffffffffbd198f80 print_type_s8
30
0xffffffffbd198f80-0xffffffffbd198fd0 print_type_s16
31
0xffffffffbd198fd0-0xffffffffbd199020 print_type_s32
32
0xffffffffbd199020-0xffffffffbd199070 print_type_s64
33
0xffffffffbd199070-0xffffffffbd1990c0 print_type_x8
34
0xffffffffbd1990c0-0xffffffffbd199110 print_type_x16
35
0xffffffffbd199110-0xffffffffbd199160 print_type_x32
36
0xffffffffbd199160-0xffffffffbd1991b0 print_type_x64
37
38
But not always:
39
40
0xffffffffbd1997b0-0xffffffffbd1997c0 fetch_kernel_stack_address (kernel/trace/trace_probe.c)
41
0xffffffffbd1c57f0-0xffffffffbd1c58b0 __context_tracking_enter (kernel/context_tracking.c)
42
43
Signed-off-by: Li Bin <huawei.libin@huawei.com>
44
Cc: Masami Hiramatsu <mhiramat@kernel.org>
45
Cc: Namhyung Kim <namhyung@kernel.org>
46
Cc: Peter Zijlstra <peterz@infradead.org>
47
Cc: Wang Nan <wangnan0@huawei.com>
48
Cc: zhangmengting@huawei.com
49
Fixes: 9aaf5a5f479b ("perf probe: Check kprobes blacklist when adding new events")
50
Link: http://lkml.kernel.org/r/1504011443-7269-1-git-send-email-huawei.libin@huawei.com
51
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
52
---
53
tools/perf/util/probe-event.c | 2 +-
54
1 file changed, 1 insertion(+), 1 deletion(-)
55
56
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
57
index d7cd1142f4c6..b7aaf9b2294d 100644
58
--- a/tools/perf/util/probe-event.c
59
+++ b/tools/perf/util/probe-event.c
60
61
struct kprobe_blacklist_node *node;
62
63
list_for_each_entry(node, blacklist, list) {
64
- if (node->start <= address && address <= node->end)
65
+ if (node->start <= address && address < node->end)
66
return node;
67
}
68
69
70