[470] in bugtraq

home help back first fref pref prev next nref lref last post

Re: Race conditions

daemon@ATHENA.MIT.EDU (der Mouse)
Mon Dec 12 09:56:41 1994

Date: Mon, 12 Dec 1994 07:59:49 -0500
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
To: bugtraq@fc.net

>> To open a file, which should already exist: [...]

> 	if you want to allow symlinks but not allow the race, try:

> 	-open() the file without privelege, save the inode #
> 	-open() the file withe privelege, compare the inode #'s

This fails in two ways.  (1) if the file is inaccessible without
privilege, the first open can never succeed.  (2) if you lose the race,
you've just opened something you shouldn't have; most of the time this
isn't a problem, but if it's something for which open()/close() is not
a no-op, like a named pipe, it can matter.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu

home help back first fref pref prev next nref lref last post