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]
Message-ID: <50399556C9727B4D88A595C8584AAB37526076B9@GSjpTKYDCembx32.service.hitachi.net>
Date:	Fri, 6 Nov 2015 10:03:31 +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 v2] perf probe: Verify parameters for two functions

From: Wang Nan [mailto:wangnan0@...wei.com]
>
>On kernel with only one of CONFIG_KPROBE_EVENTS and
>CONFIG_UPROBE_EVENTS enabled, 'perf probe -d' causes segfault because
>perf_del_probe_events() calls probe_file__get_events() with a negative
>fd.
>
>This patch fixes it by add parameter validation at the entry of
>probe_file__get_events() and probe_file__get_rawlist(). Since they are
>both non-static public functions (in .h file), parameter verifying
>is required.

Looks good to me ! :)

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>

Thank you!

>
>v1 -> v2: Verify fd at the head of probe_file__get_rawlist() instead of
>          checking at call site (suggested by Masami and Arnaldo at [1,2]).
>
>[1] http://lkml.kernel.org/r/50399556C9727B4D88A595C8584AAB37526048E3@GSjpTKYDCembx32.service.hitachi.net
>[2] http://lkml.kernel.org/r/20151105155830.GV13236@kernel.org
>
>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/util/probe-file.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
>index 89dbeb9..e3b3b92 100644
>--- a/tools/perf/util/probe-file.c
>+++ b/tools/perf/util/probe-file.c
>@@ -138,6 +138,9 @@ struct strlist *probe_file__get_rawlist(int fd)
> 	char *p;
> 	struct strlist *sl;
>
>+	if (fd < 0)
>+		return NULL;
>+
> 	sl = strlist__new(NULL, NULL);
>
> 	fp = fdopen(dup(fd), "r");
>@@ -271,6 +274,9 @@ int probe_file__get_events(int fd, struct strfilter *filter,
> 	const char *p;
> 	int ret = -ENOENT;
>
>+	if (!plist)
>+		return -EINVAL;
>+
> 	namelist = __probe_file__get_namelist(fd, true);
> 	if (!namelist)
> 		return -ENOENT;
>--
>1.8.3.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ