Re: race condition in killall

From: Casper Ti. Vector <caspervector_at_gmail.com>
Date: Tue, 7 May 2019 22:46:48 +0800

On Sun, May 05, 2019 at 03:55:51AM +0200, sysinit_at_yandex.com wrote:
> since they do more work to select processes and hence need more time
> when iterating the PID dirs in the procfs? though i doubt they use
> any matching at all when tasked with killing all processes and
> probably behave like the killall5 utility in this situation.

The original snippet on gitlab-2.asag.io used `pkill -SIG .'; and it
seemed that they had really encounterred escaped processes, because they
said:
> the "sync" was added just in case mounting read-only doesn't work

> OpenRC also provides a tool for that task btw:
> /libexec/rc/bin/kill_all
> it uses the kvm method to find running processes on the BSDs and the
> procfs on Linux.

Or use chainloading and `kill -9 -1': both are simple and portable.

-- 
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
Received on Tue May 07 2019 - 14:46:48 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC