From: David Laight <David.Laight@ACULAB.COM>
To: "'Christoph Böhmwalder'" <christoph.boehmwalder@linbit.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Eric W . Biederman" <ebiederm@xmission.com>,
Jens Axboe <axboe@kernel.dk>,
Philipp Reisner <philipp.reisner@linbit.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] drbd: do not ignore signals in threads
Date: Mon, 29 Jul 2019 08:50:04 +0000 [thread overview]
Message-ID: <6259de605e9246b095233e3984262b93@AcuMS.aculab.com> (raw)
In-Reply-To: <20190729083248.30362-1-christoph.boehmwalder@linbit.com>
From: Christoph Böhmwalder
> Sent: 29 July 2019 09:33
> Fix a regression introduced by upstream commit fee109901f39
> ('signal/drbd: Use send_sig not force_sig').
>
> Currently, when a thread is initialized, all signals are set to be
> ignored by default. DRBD uses SIGHUP to end its threads, which means it
> is now no longer possible to bring down a DRBD resource because the
> signals do not make it through to the thread in question.
>
> This circumstance was previously hidden by the fact that DRBD used
> force_sig() to kill its threads. The aforementioned upstream commit
> changed this to send_sig(), which means the effects of the signals being
> ignored by default are now becoming visible.
>
> Thus, issue an allow_signal() at the start of the thread to explicitly
> allow the desired signals.
Doesn't unmasking the signals and using send_sig() instead of force_sig()
have the (probably unwanted) side effect of allowing userspace to send
the signal?
I've certainly got some driver code that uses force_sig() on a kthread
that it doesn't (ever) want userspace to signal.
The origina1 commit says:
> Further force_sig is for delivering synchronous signals (aka exceptions).
> The locking in force_sig is not prepared to deal with running processes, as
> tsk->sighand may change during exec for a running process.
I think a lot of code has assumed that the only real difference between
send_sig() and force_sig() is that the latter ignores the signal mask.
If you need to unblock a kernel thread (eg one blocked in kernel_accept())
in order to unload a driver, then you really don't want it to be possible
for anything else to signal the kthread.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2019-07-29 8:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 8:32 [PATCH] drbd: do not ignore signals in threads Christoph Böhmwalder
2019-07-29 8:50 ` David Laight [this message]
2019-08-05 9:33 ` Christoph Böhmwalder
2019-08-05 9:41 ` David Laight
2019-08-12 11:52 ` Philipp Reisner
2019-08-12 13:12 ` David Laight
2019-08-12 13:28 ` Philipp Reisner
2019-08-16 22:19 ` [PATCH] signal: Allow cifs and drbd to receive their terminating signals Eric W. Biederman
2019-08-19 8:37 ` Christoph Böhmwalder
2019-08-19 22:03 ` [GIT PULL] " Eric W. Biederman
2019-08-19 23:35 ` pr-tracker-bot
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=6259de605e9246b095233e3984262b93@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=axboe@kernel.dk \
--cc=christoph.boehmwalder@linbit.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.reisner@linbit.com \
--cc=stable@vger.kernel.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).