Always disable core dumps when sudo sends itself a fatal signal.
When a command exits due to a fatal signal, sudo will re-send that signal to itself so the shell does not ignore keyboard-generated signals. However, now that sudo disables core dumps by default for the command, we cannot rely on WCOREDUMP() telling us whether or not the signal will lead to a core dump. It is safest to always disable core dumps before sending the signal to ourself.
This commit is contained in:
@@ -315,9 +315,10 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
if (WCOREDUMP(status))
|
/* Make sure sudo doesn't dump core itself. */
|
||||||
disable_coredump();
|
disable_coredump();
|
||||||
|
|
||||||
|
/* Re-send the signal to the main sudo process. */
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_handler = SIG_DFL;
|
sa.sa_handler = SIG_DFL;
|
||||||
|
Reference in New Issue
Block a user