user@host$ killall -9 -u user
Will it definitely kill all processes owned by user
(including forkbombs)?
- No new processes is spawned to
user
from other users. - No
user
's processes are in D-sleep and unkillable. - No processes are trying to detect and
ptrace
or terminate this startedkillall
(but they can ptrace or do other things with each other) - There is
ulimit
that prevents too much processes (butkillall
is already started and allocated it's memory)
E.g. if killall
will finish untampered and successfully is it 100% that no processes are left with this uid? If no, how to do it properly (with standard commands and no root access).
Will SysRq+I definitely kill all things (even replicating)?
Best Answer
No.
killall
first lists all processes that are to be killed, and then iterates through that list and kills them. If you have a forkbomb running, afterkillall
will kill one of its processes, it is very likely that another process will immediately reclaim PID which has just freed, butkillall
thinks it already killed that process, so effectively nothing will happen.You should use ulimit if a forkbomb is a problem for you. Limit number of processes to, for example, 128, and a forkbomb will silently die or stop expanding, depending on how it was written. Anyway, it will not present any danger to other users of that system.