| Summary: | valgrind allows SIGKILL being reset to SIG_DFL | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Mark Wielaard <mark> |
| Component: | general | Assignee: | Julian Seward <jseward> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 3.25.0 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Bug Depends on: | |||
| Bug Blocks: | 506971 | ||
commit 806abab0557a53546d9498926f699fd679b9f0f1 Author: Mark Wielaard <mark@klomp.org> Date: Mon Jul 14 23:23:23 2025 +0200 Reject any attempt to set the handler for SIGKILL/STOP 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 |
LTP signal01 testcase fails with: signal01.c:56: TFAIL: (long)signal(SIGKILL, tc->sighandler) succeeded Should fail with EINVAL (SIGKILL can not be reset to default) Seems that do_sys_sigaction explicitly allows that. Not sure why, fix might be as simple as: diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index f0e6b8e7cf2e..67893d473603 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -1319,8 +1319,7 @@ SysRes VG_(do_sys_sigaction) ( Int signo, /* 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) + && new_act ) goto bad_sigkill_or_sigstop; /* If the client supplied non-NULL old_act, copy the relevant SCSS