From ab49adb92daee9db1f0b649cacdc68f683deddaf Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 9 Nov 2023 14:08:50 -0700 Subject: [PATCH] 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. --- src/sudo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sudo.c b/src/sudo.c index 5ac63b4af..9d929e4a3 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -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;