casaroli opened a new pull request, #21078:
URL: https://github.com/apache/nuttx/pull/21078
## Summary
fd57ce76957 ("arch/risc-v: refuse reserved syscalls from user mode") and
50a4f8061da ("arch/arm64: refuse reserved syscalls from user space") read
`tcb->xcp.sigreturn`. `struct xcptcontext` has that field only with
`CONFIG_ENABLE_ALL_SIGNALS`, so a kernel build with
`CONFIG_ENABLE_PARTIAL_SIGNALS` or `CONFIG_DISABLE_ALL_SIGNALS` does not
compile:
```
common/riscv_doirq.c:82:20: error: 'struct xcptcontext' has no member named
'sigreturn'
common/arm64_syscall.c:186:52: error: 'struct xcptcontext' has no member
named 'sigreturn'
```
The check lets only one reserved system call through from user mode:
`SYS_signal_handler_return` for a signal handler that the kernel dispatched.
Without full signals the kernel dispatches no user signal handler, so this PR
refuses every reserved system call from user mode in that case. With full
signals the check is the same as before. One commit per architecture.
## Impact
Kernel builds (riscv, arm64) and protected builds (riscv) with partial or no
signals compile again. No change with `CONFIG_ENABLE_ALL_SIGNALS` (the default).
## Testing
`qemu-armv8a:knsh` and `rv-virt:knsh`, GCC:
| Configuration | master, `ENABLE_PARTIAL_SIGNALS` | this PR,
`ENABLE_ALL_SIGNALS` | this PR, `ENABLE_PARTIAL_SIGNALS` |
|---|---|---|---|
| `qemu-armv8a:knsh` | error above | builds | builds |
| `rv-virt:knsh` | error above | builds | builds |
Runtime (QEMU), with this PR together with #21073 and the other
signal-option PRs, which the protected and no-signal builds also need:
- `qemu-armv8a:knsh` (HVF), full signals: a user program installs a
`SIGUSR1` handler and sends `SIGUSR1` to itself; the handler runs once and
returns through `SYS_signal_handler_return` (`ushand: count=1 signo=10`, PASS).
`ostest` ends with `Exiting with status 0`.
- `qemu-armv8a:knsh`, partial signals: NSH starts, a user program runs,
`ostest` ends with `Exiting with status 0`.
- `rv-virt:pnsh` (protected), full signals: the same handler test passes;
partial signals: NSH starts and a user program runs.
`tools/checkpatch.sh -c -u -m -g` passes.
--
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]