]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tty-askpw-agent: react to SIGTERM while waiting for console (#36568)
authorLennart Poettering <lennart@poettering.net>
Mon, 3 Mar 2025 12:56:44 +0000 (13:56 +0100)
committerGitHub <noreply@github.com>
Mon, 3 Mar 2025 12:56:44 +0000 (13:56 +0100)
I noticed that systemd-tty-password-agent would time out when asked to
stop via SIGTERM, and eventually be killed, under some circumstances. It
took me a while but i figured out what was going on:

systemd-ask-pw-agent blocks SIGTERM because it wants async notifications
on SIGTERM via signalfd() to listen on. That mostly works great: except
for one case: if we actually get a pw query request, and hence need to
acquire the terminal: we issue open_terminal() in that case, but if the
terminal is used otherwsie we'll hang, and because SIGTERM is blocked
we'll hang and cannot exit cleanly.

Address that: optionally, in open_terminal() look for SIGTERM by
unblcking the signal mask via ppoll() while we wait.


Trivial merge