Bugtraq mailing list archives

Re: Race conditions


From: mouse () Collatz McRCIM McGill EDU (der Mouse)
Date: Mon, 12 Dec 1994 07:59:49 -0500


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



Current thread: