Repository navigation
feat(proc,tty,syscall): implement pgid/sessions, controlling tty ioctls, kill(-pgid), and job-control wait (N2.5, #66) - #147
Merged
Conversation
…ls, kill(-pgid), and job-control wait (N2.5, #66) - Add process group, session, exec-barrier, controlling-terminal ownership, and atomic job-control wait-event tracking on ThreadGroup (~24 B inline, keeping PCB allocation budget safe for KCOV/fuzzing), plus CONSOLE_TTY session/fg-pgid management initialized for PID 1 and released on session-leader exit. - Wire POSIX job-control syscalls in syscall_table.rs and syscall dispatch: setpgid(109), getpgrp(111), setsid(112), getpgid(121), getsid(124), enforcing POSIX session/exec/leader constraints and PID-namespace translation. - Extend kill(62) to support pid == 0 (caller PGID), pid < -1 (target PGID -pid), and pid == -1 (broadcast excluding init/self), delivering to non-self targets before self; add controlling-terminal ioctls TIOCSCTTY, TIOCGPGRP, TIOCSPGRP, TIOCNOTTY (with SIGHUP+SIGCONT to former fg PGID), and TIOCGSID. - Extend wait4(61) and waitid(247) to support PGID selectors (wait4 pid == 0 / pid < -1 and waitid P_PGID), WUNTRACED/WSTOPPED, WCONTINUED, and CLD_STOPPED/CLD_CONTINUED reporting, with parent SIGCHLD/waiter notification on stop/continue transitions honoring SA_NOCLDSTOP. - Add 4 hosted kernel_core unit tests (235/235), update the pre-N2.5 waitid argument-validation oracle, and add a pinned Ring-3 N2.5 end-to-end oracle leg in syscall_test.rs and ring3_mm_oracle.sh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements N2.5 from #66 (Process groups, sessions, controlling terminal,
kill(-pgid), andWUNTRACED/WCONTINUED/P_PGIDjob-control wait):kernel/kernel_core/process.rs,fork.rs,syscall/exec.rs):ThreadGroup(pgid,sid,has_execed,has_ctty,job_wait_state— ~24 B inline so PCB memory budget stays safe for KCOV/fuzzing).pgid/sid/has_cttyacrossfork(), sethas_execedonexec(), initialized PID 1 as root session/fg-pgid owner ofCONSOLE_TTY, and released console controlling-terminal ownership on session-leader exit.kernel/seccomp/syscall_table.rs,kernel/kernel_core/syscall/mod.rs,syscall/proc.rs):setpgid(109),getpgrp(111),setsid(112),getpgid(121),getsid(124)with POSIX validation rules (session leader / cross-session / post-execEACCES/ existing-PGIDEPERM) and PID-namespace translation.kernel/kernel_core/syscall/fs.rs,kernel/kernel_core/syscall/signal.rs,kernel/kernel_core/signal.rs):TIOCSCTTY (0x540E),TIOCGPGRP (0x540F),TIOCSPGRP (0x5410),TIOCNOTTY (0x5422)(sendingSIGHUP+SIGCONTto the former foreground PGID), andTIOCGSID (0x5429)on console descriptors.kill(62)to handlepid == 0(caller PGID),pid < -1(target PGID-pid), andpid == -1(broadcast excluding init and self), delivering to non-self targets before self.ThreadGroupand notified parent waiters (honoringSA_NOCLDSTOP).wait4/waitid) (kernel/kernel_core/syscall/proc.rs):wait4(61)withpid == 0/pid < -1PGID selectors,WUNTRACED, andWCONTINUED(encoding(sig << 8) | 0x7fand0xffff).waitid(247)withP_PGID,WSTOPPED/WUNTRACED,WCONTINUED,CLD_STOPPED (5), andCLD_CONTINUED (6).kernel-coreunit tests (231 -> 235inscripts/tools/hosted_subcrate_tests.sh).waitidargument-contract check and added a pinned Ring-3 N2.5 oracle leg inuserspace/src/syscall_test.rsandscripts/gates/boot/ring3_mm_oracle.sh.Verification
make fmt-check: PASSmake abi-check: PASSmake lint: PASSbash scripts/tools/hosted_subcrate_tests.sh: PASS (kernel-core235/235, all suites green)make clippy: PASSmake build: PASSZERO_OS_STRICT_TESTS=1 bash scripts/gates/boot/boot_check.sh: PASS (50/50)ZERO_OS_STRICT_TESTS=1 SMP_CORES=4 bash scripts/gates/boot/kernel_test.sh: PASS (50/50)make test-ring3-mm: PASS (72/72 legs including new N2.5 Ring-3 oracle leg)make test-kcov: PASS (KCOV-E2E PASS)Refs #66