Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1263201
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid |
| Date | 2015-11-05 14:30 +0100 |
| Message-ID | <qrsM2-7f5-27@gated-at.bofh.it> (permalink) |
| References | <qrsCm-7bY-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
In system with kprobe enabled but uprobe turned off, 'perf probe -d'
causes segfault because it calls probe_file__get_events() with a
negative fd (when deleting uprobe events).
This patch validates fds before calling probe_file__get_events().
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-probe.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 132afc9..861aa89 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -384,7 +384,11 @@ static int perf_del_probe_events(struct strfilter *filter)
goto out;
}
- ret = probe_file__get_events(kfd, filter, klist);
+ if (kfd < 0)
+ ret = -ENOENT;
+ else
+ ret = probe_file__get_events(kfd, filter, klist);
+
if (ret == 0) {
strlist__for_each(ent, klist)
pr_info("Removed event: %s\n", ent->s);
@@ -394,7 +398,11 @@ static int perf_del_probe_events(struct strfilter *filter)
goto error;
}
- ret2 = probe_file__get_events(ufd, filter, ulist);
+ if (ufd < 0)
+ ret2 = -ENOENT;
+ else
+ ret2 = probe_file__get_events(ufd, filter, ulist);
+
if (ret2 == 0) {
strlist__for_each(ent, ulist)
pr_info("Removed event: %s\n", ent->s);
--
1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] perf tools: Two bugfixs related to perf probe Wang Nan <wangnan0@huawei.com> - 2015-11-05 14:20 +0100
[PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success Wang Nan <wangnan0@huawei.com> - 2015-11-05 14:30 +0100
RE: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-05 15:10 +0100
Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success "acme@kernel.org" <acme@kernel.org> - 2015-11-05 17:10 +0100
RE: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-06 07:30 +0100
RE: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-06 08:20 +0100
Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-06 09:40 +0100
Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-06 10:40 +0100
Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 14:50 +0100
[tip:perf/urgent] perf tools: Fix find_perf_probe_point_from_map( ) which incorrectly returns success tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-08 08:40 +0100
[PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid Wang Nan <wangnan0@huawei.com> - 2015-11-05 14:30 +0100
RE: [PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-05 15:30 +0100
Re: [PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-05 16:00 +0100
RE: [PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-05 16:10 +0100
Re: [PATCH 1/2] perf probe: Only call probe_file__get_events() when fd is valid 'Arnaldo Carvalho de Melo' <acme@kernel.org> - 2015-11-05 17:00 +0100
[PATCH v2] perf probe: Verify parameters for two functions Wang Nan <wangnan0@huawei.com> - 2015-11-06 11:00 +0100
RE: [PATCH v2] perf probe: Verify parameters for two functions 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-06 11:10 +0100
Re: [PATCH v2] perf probe: Verify parameters for two functions "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-11 08:10 +0100
[tip:perf/urgent] perf probe: Verify parameters in two functions tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-12 07:50 +0100
csiph-web