interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

(optional) x86: leave physical page 0 unmapped so null dereferences fault

Closed · #487 · open 2026-10-30 12:45 UTC · closed 2026-11-06 03:46 UTC (reason completed)

Imported from GitHub aien-dev/aienux#487, by drakestapleton

drakestapleton wrote on 2026-10-30 12:45 UTC

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_audit and the existing QEMU iMac kernel test still pass on -cpu max and qemu64 with 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

did:key:z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd wrote on 2026-11-18 17:26 UTC

Sign in to comment