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: <20190225153648.GG14757@krava>
Date:   Mon, 25 Feb 2019 16:36:48 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc:     Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>
Subject: Re: [PATCH 10/20] perf data: Add directory support

On Mon, Feb 25, 2019 at 12:07:22PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> > > > +}
> > > > +
> > > >  static int open_file_read(struct perf_data *data)
> > > >  {
> > > >  	struct stat st;
> > > > @@ -254,6 +270,22 @@ static int open_file_dup(struct perf_data *data)
> > > >  	return open_file(data);
> > > >  }
> > > >  
> > > > +static int open_dir(struct perf_data *data)
> > > > +{
> > > > +	if (perf_data__is_write(data) &&
> > > > +	    mkdir(data->path, S_IRWXU) < 0)
> > > > +		return -1;
> > > > +
> > > > +	/*
> > > > +	 * So far we open only the header, so we
> > > > +	 * can read the data version and layout.
> > > > +	 */
> > > > +	if (asprintf(&data->file.path, "%s/header", data->path) < 0)
> > > > +		return -ENOMEM;
> > > 
> > > so, if this fails, then we should unwind the mkdir, if it was
> > > performed, so that we leave things as they were before calling
> > > open_dir(), right?
> > 
> > I think we need to some global solution on this,
> 
> If we don't add more, that would be a good thing :-)
> 
> The other parts also need to be investigated to see what is best in that
> case, but here, undoing the mkdir() if the asprintf() fails is the right
> thing to do :-)

true ;-) will resend

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ