Bug 1 — Fork FD race (HIGH severity):
process_fork_create() enqueued the child to the runqueue under
sched_lock, but syscall_fork_impl() copied file descriptors AFTER
the function returned — with sched_lock released. On SMP, the child
could be scheduled on another CPU and reach userspace before FDs
were populated, seeing NULL file descriptors.
Fix: move FD copying (with refcount bumps) into process_fork_create()
itself, under sched_lock, before the child is enqueued. Added proper
rollback of refcount bumps if kstack_alloc fails.
Bug 2 — Orphaned zombie leak (MEDIUM severity):
When a process exited, its children were not reparented to PID 1
(init). Zombie children of exited parents could never be reaped via
waitpid, leaking process structs and kernel stacks forever.
Fix: in process_exit_notify(), iterate the process list and reparent
all children to PID 1. If any reparented child is already a zombie
and init is blocked in waitpid(-1), wake init immediately.
Also verified (no bugs found):
- EOI handling correct (sent before handlers, spurious skips EOI)
- Lock ordering safe (all locks use irqsave, no cross-CPU ABBA)
- Heap has double-free and corruption detection
- User stack has guard pages