anjiahao1 opened a new pull request, #22311:
URL: https://github.com/apache/nuttx/pull/22311
## Summary
up_schedule_sigaction() copies the register context XCPTCONTEXT_SIZE
bytes below the current regs without checking that the destination is
still inside the task stack. A task whose stack is nearly full makes
the memcpy write below the stack allocation.
Add a PANIC() when the duplicated frame would fall below the task stack
allocation. The check is added to the architectures that share the same
regs-shift pattern: ARM Cortex-M, ARM Cortex-A/R, RISC-V and tc32. On
Cortex-M the check runs after the 8-byte stack alignment, so it
validates the address that is actually used for the copy.
## Impact
* Is new feature added? NO
* Impact on user: YES - a task whose stack cannot hold the duplicated
signal frame now panics instead of silently corrupting the memory
below its stack.
* Impact on build: NO
* Impact on hardware: NO
* Impact on documentation: NO
* Impact on security: NO
* Impact on compatibility: NO
## Testing
Build host: Linux x86_64, NuttX CI Docker image
(ghcr.io/apache/nuttx/apache-nuttx-ci-linux).
Targets:
- nucleo-f103rb:nsh (Cortex-M, arm_m)
- qemu-armv7a:nsh (Cortex-A, arm_a_r)
- rv-virt:nsh (RISC-V)
```
tools/configure.sh -a <apps> <board>:nsh
make -j10
```
All three configurations build. The tc32 change is the same check in
the tlsr82 chip file; the local CI Docker image does not include the
tc32 toolchain, so that configuration was not built here.
## PR verification
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation.
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
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]