linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Li Bin <huawei.libin@huawei.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Wang Nan <wangnan0@huawei.com>,
	zhangmengting@huawei.com,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 17/18] perf probe: Fix kprobe blacklist checking condition
Date: Tue, 29 Aug 2017 16:42:53 -0300	[thread overview]
Message-ID: <20170829194254.1338-18-acme@kernel.org> (raw)
In-Reply-To: <20170829194254.1338-1-acme@kernel.org>

From: Li Bin <huawei.libin@huawei.com>

The commit 9aaf5a5f479b ("perf probe: Check kprobes blacklist when
adding new events"), 'perf probe' supports checking the blacklist of the
fuctions which can not be probed.  But the checking condition is wrong,
that the end_addr of the symbol which is the start_addr of the next
symbol can't be included.

Committer notes:

IOW make it match its kernel counterpart in kernel/kprobes.c:

  bool within_kprobe_blacklist(unsigned long addr)

Each entry have as its end address not its end address, but the first
address _outside_ that symbol, which for related functions, is the first
address of the next symbol, like these from kernel/trace/trace_probe.c:

0xffffffffbd198df0-0xffffffffbd198e40	print_type_u8
0xffffffffbd198e40-0xffffffffbd198e90	print_type_u16
0xffffffffbd198e90-0xffffffffbd198ee0	print_type_u32
0xffffffffbd198ee0-0xffffffffbd198f30	print_type_u64
0xffffffffbd198f30-0xffffffffbd198f80	print_type_s8
0xffffffffbd198f80-0xffffffffbd198fd0	print_type_s16
0xffffffffbd198fd0-0xffffffffbd199020	print_type_s32
0xffffffffbd199020-0xffffffffbd199070	print_type_s64
0xffffffffbd199070-0xffffffffbd1990c0	print_type_x8
0xffffffffbd1990c0-0xffffffffbd199110	print_type_x16
0xffffffffbd199110-0xffffffffbd199160	print_type_x32
0xffffffffbd199160-0xffffffffbd1991b0	print_type_x64

But not always:

0xffffffffbd1997b0-0xffffffffbd1997c0	fetch_kernel_stack_address (kernel/trace/trace_probe.c)
0xffffffffbd1c57f0-0xffffffffbd1c58b0	__context_tracking_enter   (kernel/context_tracking.c)

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: zhangmengting@huawei.com
Fixes: 9aaf5a5f479b ("perf probe: Check kprobes blacklist when adding new events")
Link: http://lkml.kernel.org/r/1504011443-7269-1-git-send-email-huawei.libin@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d7cd1142f4c6..b7aaf9b2294d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2395,7 +2395,7 @@ kprobe_blacklist__find_by_address(struct list_head *blacklist,
 	struct kprobe_blacklist_node *node;
 
 	list_for_each_entry(node, blacklist, list) {
-		if (node->start <= address && address <= node->end)
+		if (node->start <= address && address < node->end)
 			return node;
 	}
 
-- 
2.13.5

  parent reply	other threads:[~2017-08-29 19:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 19:42 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 01/18] perf stat: Fix path to PMU formats in documentation Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 02/18] perf tools: Fix static build with newer toolchains Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 03/18] perf c2c: Fix remote HITM detection for Skylake Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 04/18] perf record: Set read_format for inherit_stat Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 05/18] perf report: Add dump_read function Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 06/18] perf values: Fix thread index bug Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 07/18] perf values: Fix allocation check Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 08/18] perf values: Zero value buffers Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 09/18] perf report: Group stat values on global event id Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 10/18] tools build tests: Don't hardcode gcc name Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 11/18] perf tools: Allow external definition of flex and bison binary names Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 12/18] tools lib: Allow external definition of CC, AR and LD Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 13/18] perf tools: Robustify detection of clang binary Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 14/18] perf tools: Pass full path of FEATURES_DUMP Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 15/18] tools headers: Sync cpu features kernel ABI headers with tooling headers Arnaldo Carvalho de Melo
2017-08-29 19:42 ` [PATCH 16/18] perf trace beauty: Beautify pkey_{alloc,free,mprotect} arguments Arnaldo Carvalho de Melo
2017-08-29 19:42 ` Arnaldo Carvalho de Melo [this message]
2017-08-29 19:42 ` [PATCH 18/18] perf symbols: Fix plt entry calculation for ARM and AARCH64 Arnaldo Carvalho de Melo
2017-08-29 21:15 ` [GIT PULL 00/18] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170829194254.1338-18-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=huawei.libin@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangnan0@huawei.com \
    --cc=zhangmengting@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).