Repository navigation
Conversation
…ores it FreeBSD 11's kern_sigaction (sys/kern/kern_sig.c) calls sigqueue_delete_proc, which drops the signal from the process queue and from every thread's queue, whenever the new handler is SIG_IGN, or SIG_DFL on a signal whose sigprop has SA_IGNORE (SIGURG, SIGCONT, SIGCHLD, SIGIO, SIGWINCH, SIGINFO). It does so whether or not the signal is blocked. sigaction and signal now take the signal off the pending set in those cases, so a later unblock or wait never sees it.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Contributor
|
Linux data point for
|
12 tasks done
This branch has not been deployed
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.
What
Setting
SIG_IGNwithsigactionorsignal, orSIG_DFLon a signal whose default action is to ignore, left a signal that was already pending on the pending set. Unblocking it later ran whatever handler was installed by then, andsigwaitcould still take it. FreeBSD 11'skern_sigaction(sys/kern/kern_sig.c) callssigqueue_delete_procin that case, which removes the signal from the process queue and from every thread's queue, blocked or not. The signals whosesigprophasSA_IGNOREareSIGURG,SIGCONT,SIGCHLD,SIGIO,SIGWINCHandSIGINFO;sigpropreturns 0 for 32 and above, so no real-time signal is ignored by default. That is the same listIgnoredByDefaultalready uses.sigactionandsignalnow remove the signal from the process-wide pending set after recording such a disposition.SIGCONTis discarded too, as inkern_sigaction, which only keeps it out ofps_sigignore. The error paths (invalid numbers, a handler onSIGKILLorSIGSTOP) return before anything changes, as before. The clause about this gap is cut from the sigpending entry indocs/dev/debt/libkernel.md.Test changes:
guest_signalsblocks signal 30, raises it with a handler installed, and checks thatSIG_DFLkeeps it pending,SIG_IGNthroughsigactionand throughsignalremoves it, and unblocking afterwards with the handler reinstalled does not run it. It does the same forSIGWINCHwithSIG_DFL, and for a blockedSIGCONTraised with the default disposition and reset withsignal(SIGCONT, SIG_DFL).Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7, CMake + Ninja, Release,
-DBUILD_TESTING=ON, onmain2f161d4.guest_signalswith the new checks fails (exit 0xc0000409) at thesigpendingcheck right aftersigaction(30, SIG_IGN), which still reports signal 30. With this PR it passes.guest_signals,guest_sigtimedwait,guest_itimer,guest_itimer_pending_default,guest_signal_sets,guest_sigaltstack,guest_getitimer,guest_kill,guest_signal_list,guest_raise_exceptionandguest_raise_nested_sleep: 11 of 11 pass when run serially.python tools/check_conventions.py --base origin/mainreports no errors.guest_signalspasses, and fails withmain'sSignals.cpp(comment below). Not run on bare-metal Linux.Overlap:
tools/pr_overlap.pyreports #8866, #8872 and #9001, which append tests at the same place at the end ofGuestSignals.cpp(signalandsiginterruptwithSA_RESTART); none of them discards pending signals. It could not compare #3986 (per-thread signal mask) and #7201 (macOS port) onSignals.cpp; #3986 drops an ignored signal only when it is raised, not when the disposition changes, and #7201 does not touch this logic. The rest touch only other lines ofdocs/dev/debt/libkernel.md.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)