jlaitine opened a new pull request, #16301: URL: https://github.com/apache/nuttx/pull/16301
## Summary A race in managing tcb->sigprocmask may cause signal not being delivered at all. The mechanism is as follows: 1. cpu 1: nxsig_deliver adds the signal to the sigprocmask for the duration of signal delivery 2. cpu 2: new signal (same signo) is dispatched in nxsig_tcbdispatch 3. cpu 2: nxsig_tcbdispatch detects that signal is masked 4. cpu 2: nxsig_tcbdispatch leaves critical section before calling nxsig_add_pendigsignal 5. cpu 1: nxsig_deliver finishes. The "nxsig_unmask_pendingsignal" is called in the end but does nothing 6. cpu 2: nxsig_tcbdispatch continues and adds the pending signal In the end, the logic in the end of nxsig_deliver, which tries to handle signals added to the pending queue during the signal action delivery (step 5) failed, and the pending signal was not delivered. Fix this by just keeping the critical section for during the whole duration of nxsig_tcbdispatch, and move things which can't be executed from within critical section outside. ## Impact This fixes ostest signest test fails on SMP systems. ## Testing Tested on qemu rv-virt:smp and mpfs using ostest, together with apps PR https://github.com/apache/nuttx-apps/pull/3067 Hacked ostest to run only signest test, and executed 1000 loops succesfully. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org