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


Groups > linux.kernel > #1487504

[PATCHv2 01/61] perf symbols: Do not open device files

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject [PATCHv2 01/61] perf symbols: Do not open device files
Date 2016-09-20 18:20 +0200
Message-ID <sjvW2-5lT-41@gated-at.bofh.it> (permalink)
References <sj6Eh-5Vj-3@gated-at.bofh.it> <sj6Ei-5Vj-49@gated-at.bofh.it> <sjv9D-4MD-5@gated-at.bofh.it> <sjvjk-4Q2-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 20, 2016 at 05:36:47PM +0200, Jiri Olsa wrote:
> On Tue, Sep 20, 2016 at 12:28:03PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Sep 19, 2016 at 03:09:10PM +0200, Jiri Olsa escreveu:
> > > Moving the regular file check into the entry
> > > of the dso__read_binary_type_filename function.
> > > 
> > > This way we can eliminate some calls and extend
> > > the file check for all cases.
> > 
> > Bzzt:
> > 
> > [root@jouet ~]# perf test "Test dso" 
> >  8: Test dso data read      : FAILED!
> >  9: Test dso data cache     : FAILED!
> > 10: Test dso data reopen    : FAILED!
> > [root@jouet ~]#
> 
> ugh, will check.. thanks

ook, I confused this one with earlier version, sry.. correct version attached
it's pushed in the perf/c2c branch now

thanks,
jirka


---
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.

Link: http://lkml.kernel.org/n/tip-twbp391v8v9f5idp584hlfov@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/61] perf symbols: Do not open device files again Jiri Olsa <jolsa@kernel.org> - 2016-09-19 15:20 +0200
  Re: [PATCH 01/61] perf symbols: Do not open device files again Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-20 17:30 +0200
    Re: [PATCH 01/61] perf symbols: Do not open device files again Jiri Olsa <jolsa@redhat.com> - 2016-09-20 17:40 +0200
      [PATCHv2 01/61] perf symbols: Do not open device files Jiri Olsa <jolsa@redhat.com> - 2016-09-20 18:20 +0200
        [tip:perf/core] perf symbols: Do not open device files tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-09-20 23:50 +0200

csiph-web