Messages in this thread | | | Date | Wed, 11 Feb 1998 14:05:54 +0300 (MSK) | From | "Pawel S. Veselov" <> | Subject | Re: find: /proc/<pid>/fd/4: No such file or directory |
| |
Hello, David!
On Tue, 10 Feb 1998, David Schwartz wrote:
>>On Tue, 10 Feb 1998, David Schwartz wrote: >> >>> >>> So? Files in the /proc directory can be transient and appear and >>> disappear at whim. >>Why don't the other fs's have a problem with shadows? You can make >>ext2 files as transient as they come, and there are no shadows. > I haven't looked closely, but my guess is that this file is for the find >processes descriptor used to read the directory, and find's code to traverse >a directory is sufficiently fast that a process switch rarely if ever occurs >in between when a directory is read and the files inside it are checked. >Therefore, only the proc entry for the find process itself is vulnerable.
Yes. This is what really happening:
[vps@phoenix]/proc$ find . -name blah -print >~/temp/a 2>&1 & [1] 24583 [vps@phoenix]/proc$ grep -v denied ~/temp/a find: ./24583/fd/4: No such file or directory [1]+ Exit 1 find . -name blah -print >~/temp/a 2>&1 [vps@phoenix]/proc$
Note, pids are the same.
This is a strip from strace results ( note that strace causes to "move" fd's) :
open(".", O_RDONLY) = 5 fcntl(5, F_SETFD, FD_CLOEXEC) = 0 close(5) = 0 open("tty", O_RDONLY) = 5
and so on. This descriptor is flying.
> In any event, this behavior is certainly not unreasonable.
If I can remember original author issued find / -name blah -print by default , find scans the whole system ( including _all_ mounted fs's) To avoid this one can use -xdev option.
Bye. -- Keep cool, but don't freeze. -- Hellman's Mayonnaise
-- With best of best regards, Pawel S. Veselov (aka Black Angel) internet : vps@unicorn.niimm.spb.su ( mail,finger,talk ) Web page : http://www.niimm.spb.su/~vps/ ICQ : 5252265
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |