fix: stream ELF program loading instead of buffering whole files

ElfLoad read the entire binary into one kernel heap allocation before
copying segments out. The heap grows through ReallocConsecutive, so a
40 MB cc1plus required 10k physically contiguous pages - effectively
impossible after boot with a 368 MB ramdisk module resident, and the
failed spawn surfaced as posix_spawnp ENOENT in the gcc driver.

The loader now reads the ELF header and program header table (bounded
at 64 entries), then copies each PT_LOAD page and the PT_TLS template
directly from the VFS into freshly mapped process pages. Peak kernel
memory per load drops from fileSize to one page regardless of binary
size. Boot-smoke verified: all userspace loads through this path.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-17 10:25:30 +02:00
co-authored by Claude Fable 5
parent 78ce551688
commit 2f1010b02e
2 changed files with 60 additions and 54 deletions
+1 -1
View File
@@ -12,4 +12,4 @@
#pragma once
#define MONTAUK_BUILD_NUMBER 22
#define MONTAUK_BUILD_NUMBER 23