-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Don't actually send a signal with signo 0 #503
Conversation
As stated by standards.
This should not be needed. The check for signal zero is handled much high up in the signal sequence. Signal 0 should never make it to this code. Are you seeing an actual bug that this fixes? Otherwise, I believe that this change is incorrect and I will decline it. |
If you are, I would also like to know the logic sequence. As I said, signal 0 should never get here. A DEBUGASSERT(signal != 0) might be appropriate. |
@patacongo (gdb) bt |
Then that is an error in kill() (or really nxsig_kill()). kill() has specific requirements to ignore signal 0 https://pubs.opengroup.org/onlinepubs/009695399/functions/kill.html That change should go in kill(), not nxsig_dispatch(). |
@patacongo
|
I don't see the logic in kill(), it should be there because this feature has been used for years, so I am surprised. But I still need to close this change. It is not correct. Any special signal handling must be moved higher. The logic in nxsig_dispatch may do other, improper things with signal 0. It may for example, call group_signal() instead of nxsig_tcbdispatch(). The specific requirement for signal zero handler ONLY applies to kill() and sigqueue() so those would be the best place in order to keep the requirement associated with the interface. But the check the existence of the task is not performed until nxsid_tcbdispatch() so maybe that would be an acceptable place. I don't think nxsig_tcbdispatch() is the correct place. |
Basically, your change only works if HAVE_GROUP_MEMBERS is not defined. If that is defined, then calling kill() or sigqueue() will go a different path: kill->nxsig_kill->nxsig_dispatch->group_signal You change also does not handle multi-threaded task groups. The task ID may no longer be valid, but the task group may persist. In this case, a different pthread member of the group will receive the signal. That can be fixed by moving the null signal check to lines 528 and 546 |
group_signal uses nxsig_tcbdispatch. it was actually one of the reasons why i fixed it this way. |
do you have an example of user-facinig API with a different semantics for signo zero? |
There are three ways to get to nxsig_dispatch(): kill(), sigqueue(), and via signal notifications which are used message queue and timer signal notifications. Those all seem okay. The only problem is at nxsig_dispatch() which can have different behaviors depending on configuration. So any zero signal check needs to go early in nxsg_dispatch() while the common patch is being followed. |
Okay, it sounds like you have done a complete analysis. I will merge the change. |
As stated by standards.