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:
Todd C. Miller
2023-11-09 14:08:50 -07:00
parent 62895ea442
commit ab49adb92d

View File

@@ -315,9 +315,10 @@ main(int argc, char *argv[], char *envp[])
if (WIFSIGNALED(status)) {
struct sigaction sa;
if (WCOREDUMP(status))
disable_coredump();
/* Make sure sudo doesn't dump core itself. */
disable_coredump();
/* Re-send the signal to the main sudo process. */
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_DFL;