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

   ## Summary
   
   Commit 0ea686bc5b3 ("sched/signal: Add support for partially disabling 
signals") declares `userspace_s.signal_handler` (`include/nuttx/userspace.h`) 
only with `CONFIG_ENABLE_ALL_SIGNALS`. The 46 `boards/*/kernel/*_userspace.c` 
files of the protected boards still set the field, so a protected build with 
`CONFIG_ENABLE_PARTIAL_SIGNALS` or `CONFIG_DISABLE_ALL_SIGNALS` does not 
compile:
   
   ```
   mps_userspace.c:113:4: error: 'const struct userspace_s' has no member named 
'signal_handler'
   ```
   
   This PR sets the field only with `CONFIG_ENABLE_ALL_SIGNALS`. That is the 
condition under which the kernel uses it (the `SYS_signal_handler` case of each 
architecture), and on arm `up_signal_handler()` itself (`arm_signal_handler.S`) 
is built only with it. `fvp-armv8r` defines its own trampoline; it is now built 
under the same condition. (`arch/ceva/src/common/ceva_userspace.c` still tests 
the old `CONFIG_DISABLE_SIGNALS`; no board uses ceva, and this PR does not 
change it.)
   
   ## Impact
   
   Protected builds with partial signals compile again. With 
`CONFIG_ENABLE_ALL_SIGNALS` (the default) the boards build the same code as 
before. Only `boards/*/kernel/*_userspace.c` change; no flat or kernel build 
uses these files.
   
   ## Testing
   
   Builds of protected configurations with this PR (GCC, make), with each 
signal option:
   
   | Configuration | Arch | `ENABLE_ALL_SIGNALS` | `ENABLE_PARTIAL_SIGNALS` | 
`DISABLE_ALL_SIGNALS` |
   |---|---|---|---|---|
   | `mps2-an500:knsh` | armv7-m | builds | builds (master: the error above) | 
`mps_userspace.c` compiles; link fails (1) |
   | `qemu-armv7r:pnsh` | armv7-r | builds | builds | `qemu_userspace.c` 
compiles; link fails (1) |
   | `fvp-armv8r:pnsh` | arm64 | builds | builds | `fvp_userspace.c` compiles; 
link fails (1) |
   | `esp32s3-devkit:knsh` | xtensa | builds | `esp32s3_userspace.c` compiles; 
link fails (2) | `esp32s3_userspace.c` compiles; link fails (1) |
   | `rv-virt:pnsh` | risc-v | builds | fails before the board file (3) | fails 
before the board file (3) |
   
   Runtime on `mps2-an500:knsh` under QEMU:
   
   - `ENABLE_ALL_SIGNALS`: a user program installs a `SIGUSR1` handler with 
`sigaction()` and sends `SIGUSR1` to itself with `kill()`. The handler runs 
once through the trampoline: `ushand: count=1 signo=10`.
   - `ENABLE_PARTIAL_SIGNALS`: NSH starts and runs a user program.
   
   The other failures are in files that this PR does not change; they are not 
fixed here:
   
   1. With `CONFIG_DISABLE_ALL_SIGNALS`, the link needs `nxsig_procmask()` 
(`fs/vfs/fs_epoll.c`, `sched/pthread/pthread_sigmask.c`), and on 
`qemu-armv7r:pnsh` also `sigemptyset()`, `nxsig_timedwait()` (`sched_waitid.c`, 
`sched_waitpid.c`) and `group_signal()` (`task_exithook.c`). On 
`esp32s3-devkit:knsh`, `apps/system/nxinit` also needs the signal set functions.
   2. With `CONFIG_ENABLE_PARTIAL_SIGNALS`, `sched/signal/sig_default.c` needs 
`nxsig_action()`.
   3. `arch/risc-v/src/common/riscv_doirq.c:82`: `'struct xcptcontext' has no 
member named 'sigreturn'` (also on master).
   
   `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]

Reply via email to