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: <20150604091100.GA19775@gmail.com>
Date:	Thu, 4 Jun 2015 11:11:00 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Milos Vyletel <milos@...hat.com>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Jiri Olsa <jolsa@...nel.org>, Don Zickus <dzickus@...hat.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	"Steven Rostedt (Red Hat)" <rostedt@...dmis.org>,
	"open list:PERFORMANCE EVENT..." <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf tools: avoid possible race condition in copyfile


* Milos Vyletel <milos@...hat.com> wrote:

> Use unique temporary files when copying to buildid dir to prevent races
> in case multiple instances are trying to copy same file. This is done by
> 
> - creating template in form <path>/.<filename>.XXXXXX where the suffix is
>   used by mkstemp() to create unique file
> - change file mode
> - copy content
> - if successful link temp file to target file
> - unlink temp file
> 
> At this point the only file left at target path should be the desired
> one either created by us or other instance if we raced. This should also
> prevent not yet fully copied files to be visible to to other perf
> instances that could try to parse them.
> 
> On top of that slow_copyfile no longer needs to deal with file mode when
> creating file since temporary file is already created and mode is set.
> 
> Signed-off-by: Milos Vyletel <milos@...hat.com>

Ok, that looks nice!

Assuming it passes testing you can add my ack to it:

  Acked-by: Ingo Molnar <mingo@...nel.org>

Is there any other place in tools/perf where we are using file locking or racy 
shared access to the same file(s)?

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ