lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Nov 2015 14:23:00 +0000
From:	平松雅巳 / HIRAMATU,MASAMI 
	<masami.hiramatsu.pt@...achi.com>
To:	"'Wang Nan'" <wangnan0@...wei.com>,
	"acme@...nel.org" <acme@...nel.org>,
	"namhyung@...nel.org" <namhyung@...nel.org>
CC:	"lizefan@...wei.com" <lizefan@...wei.com>,
	"pi3orama@....com" <pi3orama@....com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"jolsa@...nel.org" <jolsa@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: RE: [PATCH 1/2] perf probe: Only call probe_file__get_events() when
 fd is valid

From: Wang Nan [mailto:wangnan0@...wei.com]
>
>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).

Hmm, OK. This may happen if user runs perf probe on the kernel
which only enables either CONFIG_KPROBE_EVENTS or CONFIG_UPROBE_EVENTS.

>
>This patch validates fds before calling probe_file__get_events().

Hmm, could you improve probe_file__get_events() to check the fd instead
of checking it at call-site? I think that is more generic fixup.

Thank you,

>
>Signed-off-by: Wang Nan <wangnan0@...wei.com>
>Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
>Cc: Jiri Olsa <jolsa@...nel.org>
>Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
>Cc: Namhyung Kim <namhyung@...nel.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ