brintos

brintos / linux public Read only

0
0

wasm32: 16 MiB exec-image staging ceiling refuses a dlopen'd full-language runtime (libpython3.13.so) #6

Open dmitry opened this issue · 1 comment
D dmitry commented

wasm32_user_dlopen_load stages a .so through the same F28 exec-image slots as exec (binfmt_wasm.c), so wasm32_exec_image_max() = one slot = 16 MiB also caps dlopen. A full-language runtime shipped as a shared object exceeds that: CPython 3.13.5 as libpython3.13.so is ~39 MB unstripped, ~17.4 MB stripped — both refuse with -EFBIG:

binfmt_wasm: /usr/lib/libpython3.13.so is 40910266 bytes, over the 16777216-byte exec-image staging ceiling (strip debug info or grow the setup.c staging reservation)
PYDL-FAIL dlopen(/usr/lib/libpython3.13.so): ... host failed to stage/instantiate the shared object: File too large

Reproduction: glibc distro, M4 dynamic split of CPython 3.13.5 (wasmld -shared --export=Py_BytesMain), python3-dyn dlopens the .so at startup — refused before the host ever sees the bytes.

Proposed fix

Grow the setup.c reservation 2×16 → 2×48 MiB. The small-RAM guard still skips the reservation where it does not fit; the two-slot concurrent-exec model (busybox pipes) is unchanged. Verified end-to-end on the fra2 harness and on a deployed machine (dmitry/linux-6.12-glibc-dynamic-linking — Python 3.13.5 through the 17.4 MB .so).

Branch: BRINTOS-28-exec-staging Commit: 284eafe6c

A dynamic-sizing alternative (reserve from bootinfo RAM, or a transient non-reserved path for dlopen staging) may be preferable upstream — the branch is the minimal working form.

Proposed fix targets brintos/linux only — no distro submodule pins moved. All distros share one lineage, so pin bumps are coordinated on merge, not per-engineer.

jdbrinton jdbrinton commented

Triage (agent for joel, 2026-07-14 nightly): real limit, deliberate scope decision needed rather than a quick fix — the F28 exec-image slot size caps dlopen at 16 MiB and a full-language runtime (libpython3.13.so at ~17.4 MB stripped) doesn't fit. Options when staffed: (a) raise the slot size (memory cost multiplies across slots), (b) chunked/streaming staging for dlopen specifically (dlopen doesn't need the exec fast path's atomicity), (c) multi-slot spanning for oversized images. Deprioritized tonight in favor of the guest-killer and syscall-surface tickets. Leaving open.