]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: init: make sure only daemonized processes change their session
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Dec 2024 07:26:24 +0000 (08:26 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 4 Dec 2024 18:46:42 +0000 (19:46 +0100)
commit70e4938aec671c5bd1d69fee4ca1c8eea9f72bd3
tree670a84ad589dad2cf1627c091cdef1c286d25c7e
parent6404b7a18a518e04bf934c1635e8a0b34628149a
BUG/MEDIUM: init: make sure only daemonized processes change their session

Commit 8dd4efe42f ("MAJOR: mworker: move master-worker fork in init()")
introduced some sensitive changes to the startup code (which was
expected), and one sensitive change is that the second call to setsid()
was accidentally made unconditional. As such it even applies to foreground
processes, resulting in foreground processes being detached from the
terminal and no longer responding to Ctrl-C nor Ctrl-Z. An example of
this simply consists in start haproxy -db under sudo. Then a new shell
is required to stop it.

This patch removes this second setsid(), as it is already done in
apply_daemon_mode().

This must be backported to 3.1.
src/haproxy.c