[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: World writable pid and lock files.



Henrique de Moraes Holschuh wrote:
You know, it would help if you actually read what you replied to.

start-stop-daemon(8) says
/proc/pid/exe is used. On my system that is a symbolic link. What I wold do if I was to write start-stop-daemon is read the link and match that value with the name passed to --exec. This would have nothing to do with inode numbers. However start-stop-daemon might look at the inode number of the dereferenced link and match that to the inode number of the name passed to --exec. This should also match, though there is a race condition here. I'm a bit confused as /proc/pid/exe should be usable for debuggers like gdb.

cheako@www:~$ cp /bin/bash .
cheako@www:~$ ./bash
cheako@www:~$ ls -arlt /proc/$$/exe
lrwxrwxrwx 1 cheako cheako 0 May 15 12:42 /proc/30288/exe -> /home/cheako/bash
cheako@www:~$ rm bash
cheako@www:~$ ls -arlt /proc/$$/exe
lrwxrwxrwx 1 cheako cheako 0 May 15 12:42 /proc/30288/exe -> /home/cheako/bash (deleted)

So /proc/$$/exe has some implementation issues.


Reply to: