Sigprocmask handling errors in nxsig_deliver()
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
When delivering a signal, the signals specified in sa_mask are masked:
/* Save a copy of the old sigprocmask and install the new
* (temporary) sigprocmask. The new sigprocmask is the union
* of the current sigprocmask and the sa_mask for the signal being
* delivered plus the signal being delivered.
*/
savesigprocmask = stcb->sigprocmask;
sigorset(&newsigprocmask, &savesigprocmask, &sigq->mask);
stcb->sigprocmask = newsigprocmask;
[modified by #9299]
However there are two problems when when the signal handler returns and the sigprocmask is restored as mentioned in the comments:
/* Restore the original sigprocmask.
*
* What if the signal handler changed the sigprocmask? Try to retain
* any such changes here.
*
* REVISIT: This logic is imperfect. It will fail to detect bits set
* in the current sigprocmask that were already set by newsigprocmask.
*/
nxsig_xorset(&tmpset1, &stcb->sigprocmask, &newsigprocmask);
sigandset(&tmpset2, &stcb->sigprocmask, &tmpset1);
nxsig_nandset(&tmpset1, &savesigprocmask, &tmpset1);
sigorset(&stcb->sigprocmask, &tmpset1, &tmpset2);
Contributor guide
Assessment
This issue has not been assessed yet.