On Fri, Sep 5, 2014 at 1:21 PM, Harald Becker <ra...@gmx.de> wrote:
>> 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.

Unfortunately, there is no commonly agreed definition of
"program named FOO".

If it is the same executable, is it the same program?

You can about as easily argue that killing by looking at
basename(argv[0]) is wrong, because
argv[0] can be anything:

execve("/bin/foo", ["ha ha you lose", ... ]).

You can also easily argue that killing by looking at comm
is wrong too, because comm is truncated to 15 chars,
and is settable by a prctl.

So, the proper solution, which never kills wrong processes,
is "killall should kill no processes".
-- 
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to