From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933350AbcITQNR (ORCPT ); Tue, 20 Sep 2016 12:13:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932963AbcITQNO (ORCPT ); Tue, 20 Sep 2016 12:13:14 -0400 Date: Tue, 20 Sep 2016 18:12:45 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Don Zickus , Joe Mario , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , Andi Kleen Subject: [PATCHv2 01/61] perf symbols: Do not open device files Message-ID: <20160920161245.GA8995@krava> References: <1474290610-23241-1-git-send-email-jolsa@kernel.org> <1474290610-23241-2-git-send-email-jolsa@kernel.org> <20160920152803.GE4973@kernel.org> <20160920153647.GA3057@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160920153647.GA3057@krava> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 20 Sep 2016 16:12:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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