2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Defer registration of the SIGCHLD handler until just before we exec

the command.  Fixes a problem where pam_gnome_keyring installs its
own SIGCHLD handler and may not restore the original one.  As a
result, we now have to explicitly wait for the askpass helper to
finish.  Bug #657
This commit is contained in:
Todd C. Miller
2014-11-18 14:05:51 -07:00
parent 552dbe5253
commit 29039859b7
3 changed files with 22 additions and 21 deletions

View File

@@ -816,6 +816,8 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
#else
sa.sa_handler = handler;
#endif
if (sudo_sigaction(SIGCHLD, &sa, NULL) != 0)
sudo_warn(U_("unable to set handler for signal %d"), SIGCHLD);
if (sudo_sigaction(SIGTSTP, &sa, NULL) != 0)
sudo_warn(U_("unable to set handler for signal %d"), SIGTSTP);
@@ -837,13 +839,6 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
}
}
/*
* The policy plugin's session init must be run before we fork
* or certain pam modules won't be able to track their state.
*/
if (policy_init_session(details) != true)
sudo_fatalx(U_("policy plugin failed session initialization"));
/*
* Block some signals until cmnd_pid is set in the parent to avoid a
* race between exec of the command and receipt of a fatal signal from it.