Skip to content

[SUBISSUE #2] Implement Process Control, Scheduling Policy, Credentials, and prctl Syscalls #293

Todo

Description

@marcobuschini

Parent Issue / Epic

#282 (Epic #265)

Prerequisite Sub-Issue

#286

Atomic Deliverable & Implementation Details

Implement process inspection, scheduling metadata, credentials, and prctl syscalls:

  • kernel/uapi/sys.hpp: Define P_ALL/P_PID/P_PGID, WEXITED/WSTOPPED/WCONTINUED/WNOWAIT, PR_SET_NAME/PR_GET_NAME/PR_SET_PDEATHSIG/PR_GET_PDEATHSIG/PR_SET_DUMPABLE/PR_GET_DUMPABLE/PR_SET_NO_NEW_PRIVS, SCHED_OTHER/SCHED_FIFO/SCHED_RR, and linux_cap_user_header_t/linux_cap_user_data_t with static_assert checks.
  • kernel/process/Process.hpp & kernel/process/Process.cpp: Store per-process comm (16-byte thread name), nice priority, real/effective/saved UID/GID, supplementary groups, pdeathsig (delivered on parent exit), and no_new_privs flag.
  • kernel/syscalls/ProcessSyscalls.cpp & SyscallDispatcher.cpp: Implement and dispatch capget (90), capset (91), waitid (95), sched_setparam (118), sched_setscheduler (119), sched_getscheduler (120), sched_getparam (121), sched_setaffinity (122), sched_getaffinity (123), setpriority (140), getpriority (141), setresuid (147), getresuid (148), setresgid (149), getresgid (150), getgroups (158), setgroups (159), and prctl (167).
  • tests/host/: Add Snitch ASan/UBSan tests covering all syscalls, permission/range checks, and PR_SET_PDEATHSIG delivery.

Out of scope: mremap/madvise ([SUBISSUE #1]), POSIX timers ([SUBISSUE #3]), ptrace (Phase 6).

Acceptance Criteria & Edge Cases

  • waitid fills linux_siginfo_t (si_pid, si_uid, si_signo = SIGCHLD, si_code = CLD_EXITED/CLD_KILLED, si_status) and supports WNOHANG/WNOWAIT
  • prctl supports PR_SET_NAME/PR_GET_NAME (NUL-terminated 16 bytes), PR_SET_PDEATHSIG/PR_GET_PDEATHSIG, PR_SET_DUMPABLE/PR_GET_DUMPABLE, and PR_SET_NO_NEW_PRIVS
  • sched_getaffinity returns bitmask 0x1 (single active CPU) and returns byte size of copied mask (matching Linux kernel ABI)
  • getpriority returns Linux raw value 20 - nice (1..40), and getresuid/getresgid/getgroups/capget handle -1 unchanged semantics and EFAULT/EINVAL properly
  • make format && make clean-tests && make -j"$(nproc)" all && make -j"$(nproc)" quality passes with zero warnings

Metadata

Metadata

Assignees

Labels

subissue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions