Re: [PATCH] Improve mutex documentation
From: Matthew Wilcox
Date: Thu Mar 15 2018 - 09:18:40 EST
On Thu, Mar 15, 2018 at 03:12:30PM +0300, Kirill Tkhai wrote:
> > +/**
> > + * mutex_lock_killable() - Acquire the mutex, interruptible by fatal signals.
>
> Shouldn't we clarify that fatal signals are SIGKILL only?
It's more complicated than it might seem (... welcome to signal handling!)
If you send SIGINT to a task that's waiting on a mutex_killable(), it will
still die. I *think* that's due to the code in complete_signal():
if (sig_fatal(p, sig) &&
!(signal->flags & SIGNAL_GROUP_EXIT) &&
!sigismember(&t->real_blocked, sig) &&
(sig == SIGKILL || !p->ptrace)) {
...
sigaddset(&t->pending.signal, SIGKILL);
You're correct that this code only checks for SIGKILL, but any fatal
signal will result in the signal group receiving SIGKILL.
Unless I've misunderstood, and it wouldn't be the first time I've
misunderstood signal handling.