From: "Casper Ti. Vector" <caspervector@gmail.com>
To: supervision@list.skarnet.org
Subject: Re: Update on the progress of slew development
Date: Sat, 4 May 2019 14:07:04 +0800 [thread overview]
Message-ID: <20190504060704.GA27290@CasperVector> (raw)
In-Reply-To: <20190320051439.GA7636@CasperVector>
On Wed, Mar 20, 2019 at 01:14:39PM +0800, Casper Ti. Vector wrote:
> pkill(1), killall(1) and killall5(8) all retrieve a process list and
> kill them one by one, instead of calling kill(-1, signal), so a race
> condition can happen thats let some process escape the final SIGKILL.
> Since pkill(1) and killall(1) use regex matching, the probability for
> the race can be significantly larger.
>
> To be 100% sure no process (except for PID 1) escapes that signal, you
> can use `s6-nuke' from s6-portable-utils. `kill -signal -- -1' should
> theoretically do similar things, but kill(1) from coreutils and busybox
> do not seem to behave in this way.
Reading recent posts on this mail list, I have noticed that the sentence
about kill(1) was incorrect because:
* POSIX does not require `kill -signal -- -1', but just `kill -- -1' *in
addition to* `kill -signal -1'.
* `kill -signal -1' does do the desired job, and I erronously thought
it did not, because what I tried was `{/bin/kill,busybox kill} -15 -1'
in the shell of a test user, but the shell trapped SIGTERM (and Linux
does not send the signal to the calling process of kill(-1, signal)).
* coreutils does not implement kill(1); busybox, util-linux and procps
do. Anyway, `kill -{signum,SIGNAME} -1' is required by POSIX.
slew has been updated (commit 593e6174) to use kill(1), and its users
no longer need to worry about the theoretical possibility about
comets [1] escaping the final SIGKILL.
[1] <https://turing.une.edu.au/~cosc330/lectures/lecture_03/lecture_03.html>
--
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
next prev parent reply other threads:[~2019-05-04 6:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-17 13:25 Casper Ti. Vector
2019-03-17 14:30 ` Oliver Schad
2019-03-18 14:44 ` Casper Ti. Vector
2019-03-19 12:10 ` Casper Ti. Vector
2019-03-19 12:42 ` Casper Ti. Vector
2019-03-19 15:25 ` Casper Ti. Vector
2019-03-19 15:58 ` Oliver Schad
[not found] ` <20190320051439.GA7636@caspervector>
2019-03-20 5:14 ` Casper Ti. Vector
2019-03-20 11:51 ` Casper Ti. Vector
2019-05-04 6:07 ` Casper Ti. Vector [this message]
2019-05-05 1:55 ` race condition in killall sysinit
2019-05-07 14:46 ` Casper Ti. Vector
2019-05-11 18:29 ` Guillermo
2019-05-11 19:26 ` Laurent Bercot
2019-09-27 17:42 ` Update on the progress of slew development Casper Ti. Vector
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190504060704.GA27290@CasperVector \
--to=caspervector@gmail.com \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).