casaroli opened a new pull request, #20716:
URL: https://github.com/apache/nuttx/pull/20716
## Summary
`up_create_stack()` returns `ERROR` (-1) on every architecture, and
`nxtask_init()` and `nxtask_setup_fork()` passed that value on as a negated
errno. So `exec()`, `task_create()` and `fork()` failed with `EPERM`
("Operation not permitted") when the stack could not be allocated.
`pthread_create()` already returns `ENOMEM` in this case.
This PR returns `-ENOMEM`.
## Impact
Only the error code changes: callers now see `ENOMEM` instead of `EPERM`
when a stack allocation fails.
## Testing
Builds: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`.
Runtime, QEMU 11 with HVF on an Apple M4: `ostest` on `qemu-armv8a:knsh`
(kernel build) and `qemu-armv8a:nsh` (flat build) ends with `ostest_main:
Exiting with status 0`.
`tools/checkpatch.sh -c -u -m -g` passes.
The error path was reached with page-allocation fault injection on
`qemu-armv8a:knsh` (a failing stack allocation in `fork()` and `exec()`):
before, the programs reported "Operation not permitted"; with the change, "Out
of memory".
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]