royzah opened a new pull request, #20410:
URL: https://github.com/apache/nuttx/pull/20410

   ## Why
   
   Numbers below `CONFIG_SYS_RESERVED` are the kernel's own: restore and switch 
context, signal return. arm64 and risc-v send any user call below that limit to 
the same handler the kernel uses, with nothing checking where it came from. A 
process can switch to a context it made up, or return from a signal it never 
received.
   
   ## How
   
   A call from EL0 or U-mode below the limit gets `-ENOSYS`. The one exception 
is signal return while a signal handler is actually running (`xcp.sigreturn` 
set).
   
   ## Tested
   
   i.MX93, kernel build, a user process calling `sys_call0(SYS_switch_context)` 
and `sys_call0(SYS_signal_handler_return)` with no signal pending:
   
   | | result |
   | --- | --- |
   | before | handled as the kernel's own switch and signal return |
   | after | `-ENOSYS` for both; signal delivery unchanged |
   
   ```
   reserved syscalls from user space: ENOSYS
   ```
   
   risc-v: built in CI; its entry code sends only numbers below 
`CONFIG_SYS_RESERVED` to `riscv_doirq()`, the same shape as arm64.
   
   `tools/checkpatch.sh` clean.
   


-- 
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]

Reply via email to