Skip to content

[SIGNAL] Fixed my_signal not reporting sigaction failure for SIGKILL/SIGSTOP - #3924

Merged
ptitSeb merged 1 commit into
ptitSeb:mainfrom
1362525207:fix-signal-err
Jun 4, 2026
Merged

[SIGNAL] Fixed my_signal not reporting sigaction failure for SIGKILL/SIGSTOP#3924
ptitSeb merged 1 commit into
ptitSeb:mainfrom
1362525207:fix-signal-err

Conversation

@1362525207

Copy link
Copy Markdown
Contributor

Problem: Test case failure for LTP signal01:
signal01.c:54: TFAIL: (long)signal(SIGKILL, tc->sighandler) succeeded

Reason: 'my_signal' ignored the return value of the host 'sigaction()' and always returned 'oldact.sa_handler'. For uncatchable signals (SIGKILL/SIGSTOP) the kernel rejects the handler with EINVAL, but the guest saw a non-'SIG_ERR' result and assumed success.

Now returns 'SIG_ERR' on failure. This matches the signal() contract and glibc's own implementation, which also returns SIG_ERR when sigaction fails:

  act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART;
  if (__sigaction (sig, &act, &oact) < 0)
    return SIG_ERR;

  return oact.sa_handler;

Validation:

  • ctest: 34/34 passed on RV64 hardware.
  • LTP signal01: 6/6 (was 5/6).

@ptitSeb
ptitSeb merged commit f7cede9 into ptitSeb:main Jun 4, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants