Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1487605

[PATCH 22/22] perf symbols: Do not open device files

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 22/22] perf symbols: Do not open device files
Date 2016-09-20 22:10 +0200
Message-ID <sjzwD-7F4-83@gated-at.bofh.it> (permalink)
References <sjzwB-7F4-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jiri Olsa <jolsa@redhat.com>

The dso__read_binary_type_filename gets the dso's file name to open. We
need to check it for regular file before trying to open it, otherwise we
might get stuck with device file.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20160920161245.GA8995@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/dso.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 774f6ec884d5..d2c6cdd9d42b 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -363,6 +363,9 @@ static int __open_dso(struct dso *dso, struct machine *machine)
 		return -EINVAL;
 	}
 
+	if (!is_regular_file(name))
+		return -EINVAL;
+
 	fd = do_open(name);
 	free(name);
 	return fd;
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 10/22] perf ui/stdio: Always reset output width for hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 17/22] perf annotate: Do not ignore call instruction with indirect target Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 08/22] perf hists: Introduce hists__link_hierarchy() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 20/22] perf ui/tui: Reset output width for hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 22/22] perf symbols: Do not open device files Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 12/22] perf report: Enable group view with hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 05/22] perf tools: Do hugetlb handling in more systems Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 07/22] perf hists: Introduce hists__match_hierarchy() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  [PATCH 18/22] perf annotate: Pass the symbol's map/dso to the instruction parsers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 22:10 +0200
  Re: [GIT PULL 00/22] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-09-20 23:40 +0200

csiph-web