Repository navigation
sched/signal: Recheck pending sigtimedwait signals - #21065
Merged
Merged
Conversation
|
casaroli
requested changes
Oct 28, 2026
casaroli
left a comment
Contributor
There was a problem hiding this comment.
- The Testing section has only "sim/nsh" with no log, and this head does not build on sim (CI sim-01).
Fix: add the build and runtime logs of this head.
sigtimedwait() publishes sigwaitmask before nxsig_clockwait() moves the task to TSTATE_WAIT_SIG. A matching signal queued in that window can remain pending while the waiter goes to sleep. Recheck and consume matching pending signals in nxsig_clockwait() while interrupts are disabled before blocking the task. Signed-off-by: chao an <[email protected]>
casaroli
reviewed
Oct 28, 2026
casaroli
left a comment
Contributor
There was a problem hiding this comment.
The Testing section still says only "sim/nsh", with no log; our review of 08:08Z asked for the logs too.
Fix: add the build and runtime logs of this head (CONTRIBUTING 1.7.2), with a test where a signal is sent between the sigwaitmask setting and the wait (for example a higher-priority thread or an interrupt that posts it), the case this PR fixes.
xiaoxiang781216
approved these changes
Oct 28, 2026
acassis
approved these changes
Oct 28, 2026
casaroli
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a race in the
sigtimedwait()wait path where a matching signal couldremain pending while the waiting task goes to sleep.
sigtimedwait()publishessigwaitmaskbefore callingnxsig_clockwait().If a matching signal is queued after that publication but before the task is
moved to
TSTATE_WAIT_SIG, the signal can remain pending while the task stillblocks waiting for it.
This change rechecks the task's pending signal set inside
nxsig_clockwait()while interrupts are disabled. If a pending signal matches
sigwaitmask, it isremoved from the pending queue, copied into
sigunbinfo, and returnedimmediately instead of blocking the task.
Impact
This fixes a signal wait race that could cause
sigtimedwait()to sleep eventhough a waited-for signal is already pending.
Expected impact:
sigtimedwait()pathTesting
sim/nsh