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

   ## Summary
   
   A protected or kernel build links every system call, so code that a flat 
build never pulls in must still link. With `CONFIG_DISABLE_ALL_SIGNALS` three 
places need signal code that is not built, and the link fails:
   
   ```
   fs_epoll.c:769: undefined reference to `nxsig_procmask'
   pthread_sigmask.c:82: undefined reference to `nxsig_procmask'
   task_exithook.c:208: undefined reference to `group_signal'
   sched_waitpid.c:193: undefined reference to `nxsig_timedwait'
   sched_waitid.c:216: undefined reference to `nxsig_timedwait'
   ```
   
   One commit for each:
   
   1. `sched/Kconfig`: `SCHED_HAVE_PARENT` depends on `!DISABLE_ALL_SIGNALS`. 
With it, an exiting task sends `SIGCHLD` to its parent, and `waitpid()` and 
`waitid()` wait for `SIGCHLD`. `waitpid()` without `SCHED_HAVE_PARENT` does not 
use signals.
   2. `fs/vfs`: `epoll_pwait()` sets the signal mask only when signals are 
enabled; without signals there is no mask.
   3. `syscall`: the `pthread_sigmask()` system call needs signals, as 
`sigprocmask()` already does.
   
   ## Impact
   
   Only builds with `CONFIG_DISABLE_ALL_SIGNALS`; no in-tree defconfig uses it 
with `SCHED_HAVE_PARENT`. Such a build now has no `SCHED_HAVE_PARENT`, so the 
options that depend on it are off too (`SCHED_CHILD_STATUS`, and in apps 
`SYSTEM_NXINIT`, `netutils/dropbear`, `system/toybox`, ...). A configuration 
that starts nxinit as the init task (`rv-virt:pnsh`, `esp32s3-devkit:knsh`) 
then needs another `CONFIG_INIT_ENTRYPOINT`, for example `nsh_main`.
   
   ## Testing
   
   With `CONFIG_DISABLE_ALL_SIGNALS=y`, GCC, together with #21073 and #21078, 
which these builds also need (board files, `xcp.sigreturn`):
   
   | Configuration | Build | Result |
   |---|---|---|
   | `mps2-an500:knsh` | protected, armv7-m | links; QEMU: NSH starts and a 
user program runs |
   | `qemu-armv7r:pnsh` | protected, armv7-r | links (with #21073 and without 
this PR: all five errors above) |
   | `fvp-armv8r:pnsh` | protected, arm64 | links |
   | `rv-virt:pnsh` | protected, riscv32 | links with 
`INIT_ENTRYPOINT="nsh_main"`; QEMU: a user program runs |
   | `esp32s3-devkit:knsh` | protected, xtensa | links with 
`INIT_ENTRYPOINT="nsh_main"` |
   | `qemu-armv8a:knsh` | kernel, arm64 | links |
   | `rv-virt:knsh` | kernel, riscv32 | links |
   
   The same configurations build with `CONFIG_ENABLE_ALL_SIGNALS` and 
`CONFIG_ENABLE_PARTIAL_SIGNALS`. `ostest` on `qemu-armv8a:knsh` (HVF) ends with 
`Exiting with status 0` with full and with partial signals. 
`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