]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Reject any attempt to set the handler for SIGKILL/STOP
authorMark Wielaard <mark@klomp.org>
Mon, 14 Jul 2025 21:23:23 +0000 (23:23 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 14 Jul 2025 21:28:07 +0000 (23:28 +0200)
Even though resetting SIGKILL or SIGSTOP to SIG_DFL would be a noop it
isn't allowed. Just always return EINVAL if an attempt is made to set
the signal handler for SIGKILL or SIGSTOP. There is an LTP test for
this signal01.

https://bugs.kde.org/show_bug.cgi?id=506930

NEWS
coregrind/m_signals.c

diff --git a/NEWS b/NEWS
index 73488cbc172d8266107b577d3f1ec8a08176b311..49403da0132b89ff0734d532b390d349badc3d32 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 502968  Wrap linux specific syscalls 457 (listmount) and 458 (statmount)
 506499  Unhandled syscall 592 (exterrctl - FreeBSD
 506795  Better report which clone flags are problematic
+506930  valgrind allows SIGKILL being reset to SIG_DFL
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index f0e6b8e7cf2e4a514f945220ad4356dad26da130..cccbb568324638f9bb64a719fea0a527c23aa059 100644 (file)
@@ -1317,10 +1317,8 @@ SysRes VG_(do_sys_sigaction) ( Int signo,
              || new_act->ksa_handler == VKI_SIG_IGN) )
       goto bad_signo_reserved;
 
-   /* Reject attempts to set a handler (or set ignore) for SIGKILL. */
-   if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP)
-       && new_act
-       && new_act->ksa_handler != VKI_SIG_DFL)
+   /* Reject any attempt to set the handler for SIGKILL/STOP. */
+   if ( (signo == VKI_SIGKILL || signo == VKI_SIGSTOP) && new_act )
       goto bad_sigkill_or_sigstop;
 
    /* If the client supplied non-NULL old_act, copy the relevant SCSS