mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 21:41:04 +01:00
Install default signal handlers before masking signals we want to handle.
It is possible that the parent process ignores some of them and sigtimedwait() will never see them, eventhough they are masked. The most common situation for this to happen is boot process where init(8) ignores SIGHUP before starting to execute /etc/rc. This in turn caused hastd(8) to ignore SIGHUP. Reported by: trasz Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 3 days
This commit is contained in:
parent
95959703e1
commit
9cc97e5803
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217307
@ -753,11 +753,19 @@ main(int argc, char *argv[])
|
||||
cfg = yy_config_parse(cfgpath, true);
|
||||
assert(cfg != NULL);
|
||||
|
||||
/*
|
||||
* Restore default actions for interesting signals in case parent
|
||||
* process (like init(8)) decided to ignore some of them (like SIGHUP).
|
||||
*/
|
||||
PJDLOG_VERIFY(signal(SIGHUP, SIG_DFL) != SIG_ERR);
|
||||
PJDLOG_VERIFY(signal(SIGINT, SIG_DFL) != SIG_ERR);
|
||||
PJDLOG_VERIFY(signal(SIGTERM, SIG_DFL) != SIG_ERR);
|
||||
/*
|
||||
* Because SIGCHLD is ignored by default, setup dummy handler for it,
|
||||
* so we can mask it.
|
||||
*/
|
||||
PJDLOG_VERIFY(signal(SIGCHLD, dummy_sighandler) != SIG_ERR);
|
||||
|
||||
PJDLOG_VERIFY(sigemptyset(&mask) == 0);
|
||||
PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0);
|
||||
PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user