Optional hardening. The AienuxReview W^X pass on #426 (review 5712406189, at a3b3542a) raised this as a nit.
Problem
On the x86 kernel, leaf_4k (kmain_x86.c:433 at a3b3542a) maps physical page 0 as RW+NX in the identity map. A null-pointer read or write in the kernel therefore succeeds quietly instead of faulting.
Suggested direction
The review suggests having leaf_4k return 0 (not present) when p == 0. Before doing that, check whether anything legitimately touches page 0 after mm_build, such as the real-mode IVT, BIOS data, the AP trampoline placement or firmware handoff structures.
Done when
- After
mm_build, physical page 0 isn't present, and a kernel null dereference raises#PF. wx_auditand the existing QEMU iMac kernel test still pass on-cpu maxandqemu64with 4 cores. A small negative probe that dereferences NULL and expects a fault would be good to add.- Results are labelled QEMU-only. Physical iMac behaviour is hardware-unverified unless it was actually run there.
— Grokbot