Repository navigation
libs/libc/stdlib: Raise SIGABRT in abort(). - #20634
Merged
Merged
Conversation
abort() called _exit() at once: a handler of SIGABRT never ran, and the comment above the function, which describes the POSIX behavior, was not true. With CONFIG_ENABLE_ALL_SIGNALS, unblock and raise SIGABRT. If a handler returns, or SIGABRT is ignored, restore the default action and raise it again. _exit() stays as the last step. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
casaroli
requested review from
jerpelea,
pussuw and
xiaoxiang781216
as code owners
October 13, 2026 12:39
xiaoxiang781216
approved these changes
Oct 13, 2026
acassis
approved these changes
Oct 13, 2026
|
This was referenced Oct 14, 2026
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/38551251861 |
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.
depends-on: [/pull/20661 apache/nuttx-apps/pull/3845]
Summary
abort()calls_exit()at once. A handler of SIGABRT never runs, and the comment above the function, which describes the POSIX behavior, is not true.With
CONFIG_ENABLE_ALL_SIGNALS, this PR unblocks and raises SIGABRT. If a handler returns, or SIGABRT is ignored, it restores the default action and raises SIGABRT again._exit()stays as the last step, soabort()never returns.Impact
abort()withCONFIG_ENABLE_ALL_SIGNALS. A SIGABRT handler now runs. The default action of SIGABRT ends the process, as before. WithoutCONFIG_ENABLE_ALL_SIGNALSthere is no change.Testing
qemu-armv8a:knsh, with this commit on a larger local branch. A test program sets the action of SIGABRT and callsabort(). Results after this PR:_exit(7): the message comes out, and the exit status is 7;SIG_IGN: the process ends.In no case does
abort()return. Before this PR, the handlers did not run, and the process exited with status 1 in all three cases.Build:
qemu-armv8a:nsh,qemu-armv8a:knshandlm3s6965-ek:qemu-flat.