Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sigprocmask handling errors in nxsig_deliver() #9300

Open
patacongo opened this issue May 16, 2023 · 0 comments
Open

Sigprocmask handling errors in nxsig_deliver() #9300

patacongo opened this issue May 16, 2023 · 0 comments

Comments

@patacongo
Copy link
Contributor

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);
@patacongo patacongo changed the title Sigprocmaks handling errors in nxsig_deliver() Sigprocmask handling errors in nxsig_deliver() May 17, 2023
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

No branches or pull requests

1 participant