nuttx/sched
Justin Hammond 27ff1e74e1 sched/signal: Unblock sigtimedwait through kernel memory.
nxsig_timedwait parked a pointer to the caller's siginfo buffer in the
TCB, for whoever eventually posts the signal to fill in.  But the
poster fills it in from its own context (another task, a kernel
thread, an interrupt), and in a kernel build the caller's buffer is
an address in the caller's private address space, which the poster
does not share.  The write lands wherever the currently active
mappings put it: the waiter wakes to find garbage where the signal
number should be, and some other process is left with a corrupted
page.  Flat builds share one address space, which is why this never
showed there.

Park the stack local in the TCB instead.  That is kernel memory,
mapped in every context, and it is copied out to the caller's buffer
after waking, in the caller's own context, exactly where the
pending-signal path already does the same thing.

Found on the EIC7700X port by an RTC alarm: the alarm signal, posted
from the low-priority work queue, woke a sigwaitinfo caller into an
assertion on the unblocking signal number while the init process,
whose address space had received the stray write, died of a jump to
address zero.  With this change the same test arms, waits and wakes
cleanly, repeatedly.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:59:21 -03:00
..
addrenv sched/addrenv: do not dereference a NULL address environment 2026-07-28 10:14:44 +08:00
clock drivers/timers, sched/clock: use file_get/file_put 2026-07-11 17:22:07 -04:00
environ fs/binfmt: close symlink TOCTOU and harden setuid/setgid exec hygiene 2026-08-01 15:32:03 -03:00
event sched/event: Fix uninitialized need_switch flag issue in event_post() 2025-11-04 21:43:59 +08:00
group fs/binfmt: close symlink TOCTOU and harden setuid/setgid exec hygiene 2026-08-01 15:32:03 -03:00
hrtimer sched/hrtimer: Simplify the hrtimer. 2026-02-02 13:26:22 +08:00
init arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-16 17:07:32 +08:00
instrument gprof: move gprof function from sched to libbuiltin/libgcc 2024-11-13 02:42:31 +08:00
irq !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
misc sched: avoid dumping raw memory at address 0 for tasks without kstack 2026-07-20 20:57:45 -03:00
module libc/dlfcn: Count opens so a library can be shared. 2026-08-04 11:12:49 -03:00
mqueue !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
paging include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched sched/setpriority: handle CPU affinity change for running task 2026-08-05 21:13:56 +08:00
semaphore sched/semaphore: Clear mutex blocking bit after timeout 2026-08-04 11:14:33 -03:00
signal sched/signal: Unblock sigtimedwait through kernel memory. 2026-08-08 14:59:21 -03:00
task fs/binfmt: close symlink TOCTOU and harden setuid/setgid exec hygiene 2026-08-01 15:32:03 -03:00
timer !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
tls include/fcntl.h: remove O_RDOK/O_WROK aliases 2026-06-28 09:10:11 -03:00
wdog !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
wqueue include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
CMakeLists.txt sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
Kconfig arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-16 17:07:32 +08:00
Makefile tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00