killall behaviour
Harald Becker
ralda at gmx.de
Fri Sep 5 11:21:45 UTC 2014
Hi Denys !
> killall matches by /proc/PID/exe too.
>
> Because some applets use a trick where they re-execute
> themselves by execve("/proc/self/exe").
> When you do that, /proc/PID/comm field gets set to string "exe" :(
>
> Thus, matching by comm will fail to find a process
> started this way.
... but here we start a program by different name, just pointing to same
executable, when you do a killall nobody expects to kill other instances
of the same executable, when called with a different name.
May be this /proc/self/exe is a special case, which shall only trigger
the test on /proc/PID/exe when the comm field contains "exe", else you
highly risk killing the wrong processes.
As you can see the comm fields contains the expected values, and would
select the right processes here.
--
Harald
More information about the busybox
mailing list