[RFC] Subtle race in dup2() and permissions on /proc/<pid>/fd/<n>

Alexander Viro (viro@math.psu.edu)
Thu, 24 Jun 1999 18:14:30 -0400 (EDT)


1. dup2(foo, bar); can race with close(foo); resulting in *both* foo
and bar being closed. IMO it's bogus. Is there any oddity in POSIX that
would *require* that bogosity (e.g. something along the lines of
dup2(foo, bar) <=> close(bar);dup2(foo, bar)? If there is none I'm fixing
that. (I'm *not* stoned - clone() with COPY_FILES leads to the situation
when such races are possible).

2. dup2(foo, bar) closes bar, but completely ignores the results of
close(). POSIX position on that?

3. Why on the earth are we playing with permissions on
/proc/<pid>/fd/<n> *symlinks*? Is there anybody objecting to making those
beasts rwxrwxrwx as any other symlink?

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