]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/journal/journal-file.c
journal-file: handle SIGBUS on offlining thread
authorChris Morin <chris.morin2@gmail.com>
Wed, 20 Mar 2019 08:34:23 +0000 (01:34 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Mar 2019 12:02:04 +0000 (13:02 +0100)
commit08f9e80b3f2c4f78e643768ebd9697c32363367a
tree24cd998e71d8f2e6c9e1cd71cd2ad7a4cdc9525b
parent45ce1120020e88f3d7dc116b6d2c805ff1346b3b
journal-file: handle SIGBUS on offlining thread

The thread launched in journal_file_set_offline() accesses a memory
mapped file, so it needs to handle SIGBUS. Leave SIGBUS unblocked on the
offlining thread so that it uses the same handler as the main thread.

The result of triggering SIGBUS in a thread where it's blocked is
undefined in Linux. The tested implementations were observed to cause
the default handler to run, taking down the whole journald process.

We can leave SIGBUS unblocked in multiple threads since it's handler is
thread-safe. If SIGBUS is sent to the journald process asynchronously
(i.e. with kill, sigqueue, or raise), either thread handling it will
result in the same behavior: it will install the default handler and
reraise the signal, killing the process.

Fixes: #12042
src/journal/journal-file.c