patacongo commented on code in PR #9923:
URL: https://github.com/apache/nuttx/pull/9923#discussion_r1279531718
##########
sched/signal/sig_procmask.c:
##########
@@ -187,8 +187,27 @@ int nxsig_procmask(int how, FAR const sigset_t *set, FAR
sigset_t *oset)
int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
{
+ sigset_t nset;
int ret;
+ /* SIGKILL and SIGSTOP should not be added to signal mask */
+
+ if (set != NULL)
+ {
+ nset = *set;
+ if (nxsig_ismember(&nset, SIGKILL))
+ {
+ nxsig_delset(&nset, SIGKILL);
+ }
+
+ if (nxsig_ismember(&nset, SIGSTOP))
+ {
+ nxsig_delset(&nset, SIGSTOP);
+ }
+
Review Comment:
> I find some functions directly call nxsig_procmask() rather than
sig_procmask() or pthread_procmask().
Yes, nxsig_procmask() is the internal NuttX version of sigprocmask(). That
is why whatever modifications are made to the sigprocmask must occur in
nxsig_procmask() and not in sigprocmaks() or pthread_sigmask().
> But ... we shouldn't limit kernel function to handle sigstop/sigkill,
right?
When the OS needs to modify the signal mask, it often writes directly to
tcb->sigprocmask. I would need to review all calls to nxsig_procmask() to see
if there are any unusual usages. In principle, nxsig_procmask() should be
identical to sigprocmask() other than sigprocmask() in an application
interfence that sets the application errno value. The OS should never call
sigprocmask() for that reason.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]