]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
kernel: fix COW page write + signal delivery; add 6 new tests
authorTulio A M Mendes <[email protected]>
Sun, 26 Apr 2026 23:51:23 +0000 (20:51 -0300)
committerTulio A M Mendes <[email protected]>
Sun, 26 Apr 2026 23:51:23 +0000 (20:51 -0300)
commit1b6b07a7b168b8d784758dfc8d06b8330bf8cabe
tree30ed99e496dcf1758d3edda07753d3a596c6f80d
parentf30e384b0a2cabca34ee17fd1842a6664fb3ba6f
kernel: fix COW page write + signal delivery; add 6 new tests

Kernel fixes:
- uaccess: x86_user_page_writable_user() now recognizes COW pages as
  logically writable (checks X86_PTE_COW flag bit 9).  Previously,
  copy_to_user() rejected writes to forked COW pages, preventing
  signal frame delivery after fork().
- idt: handle COW faults in kernel mode before uaccess_try_recover().
  A write from copy_to_user() to a COW page now triggers page fault
  resolution (private copy) instead of returning -EFAULT.
- scheduler: fork inherits sigactions and sig_blocked_mask from parent
  (POSIX requirement).  Pending signals stay 0 per POSIX spec.
- syscall: sigprocmask how values now match POSIX (0=BLOCK, 1=UNBLOCK,
  2=SETMASK).  sigsuspend no longer restores old mask before signal
  delivery, allowing the handler to run.

New tests (fulltest.c):
- I12: clone — CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND thread
  creation with shared memory verification
- I13: sigqueue — send SIGUSR1 with value via sigsuspend
- I14: inotify_init1 — basic inotify with flags=0
- I15: dlopen/dlsym/dlclose — dynamic linker via libpietest.so
- I16: execveat — execute /bin/echo with AT_FDCWD
- I17: pivot_root — mount tmpfs, pivot, verify in isolated fork

Test harness updates:
- smoke_test.exp: +6 patterns (114→120)
- test_battery.exp: +6 patterns (27→33)

Results: smoke 119/120 (echo execve flaky), battery 33/33 PASS
src/arch/x86/idt.c
src/arch/x86/signal.c
src/arch/x86/uaccess.c
src/kernel/scheduler.c
src/kernel/syscall.c
tests/smoke_test.exp
tests/test_battery.exp
user/cmds/fulltest/fulltest.c