Repository navigation
Conversation
posix_spawn() with POSIX_SPAWN_SETSCHEDPARAM and priority 0 must fail with EINVAL: the kernel refuses the attribute after it made the new task. The test does it 100 times and checks that the heap of the caller stays intact (a pattern in new blocks after each error, and mallinfo() before and after), then that a normal posix_spawn() works. The child is the test program again. A kernel build crashed in this error path of exec_module() (the copies of the arguments were freed twice). Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
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: apache/nuttx/pull/21898
Summary
Add
testing/sched/spawnattr, a test of a spawn attribute that the kernel refuses after it made the new task.posix_spawn()withPOSIX_SPAWN_SETSCHEDPARAMand priority 0 must returnEINVAL. The test does it 100 times and checks that the heap of the caller stays intact: a pattern in new blocks after each error, andmallinfo()before and after. Then a normalposix_spawn()must work. The child is the test program again.A kernel build crashed in this error path of
exec_module(); apache/nuttx#21898 fixes it.Impact
A new test program, default n. Its Kconfig option depends on
LIBC_EXECFUNCSandSCHED_WAITPID. No other app changes.Testing
Assertion failed : at file: mm_heap/mm_malloc_size.c:73at the firstposix_spawn(), then a kernel panicEINVAL, pattern intact,mallinfo()the same, the goodposix_spawn()exits with 7)mallinfoFAIL (see below)ostest exits with status 0 on qemu-armv8a:knsh and qemu-armv8a:nsh with #21898.
TBD (Marco): in the flat build the heap grows by about 30 bytes for each failed
posix_spawn()(608 bytes for 20, and 32 bytes for 20 good ones). The child status thatnxtask_setup_scheduler()adds to the parent withCONFIG_SCHED_CHILD_STATUSis not removed bynxtask_uninit(). This is a separate bug.tools/checkpatch.sh -c -u -m -gof nuttx passes on the commit.