You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rootfs/qemu-static): close codex P1/P2 races + symmetrize K state + clarify ordering invariant
Addresses codex review feedback on PR #113 / armbian#9769.
N-builder entry race: EX-NB → release → re-take SH split let a K-builder
slip in between observation and the state-check write, silently disabling
qemu-arm while K relied on it. Hold EX during state check + echo 0, then
atomically downgrade EX→SH on the same fd via Linux flock(2)'s flc_lock
transition. SH waiters are granted only after our SH is in place and
qemu-arm is already 0.
K-builder symmetric state check: after acquiring the emulation-mode
SH-NB, verify state=1; if 0, concurrent N-builders have disabled qemu-arm
and the killswitch cannot honor its contract — bail with a clear error
rather than running a broken anchor.
Joiner state-recheck: in the state=0 / EX-NB-fail path, between observing
state=0 and acquiring SH the last live N-builder may release SH and run
the restorer (echo 1). Recheck state after SH and bail back to emulation
if state has flipped — otherwise we'd skip qemu deploy while binfmt
actually routes to qemu, and chroot exec fails because the qemu binary
is not in the chroot.
Killswitch gated by ARCH/host: NATIVE_ARMHF_ON_ARM64=no only meaningful
for armhf builds on aarch64 hosts. Moved idempotent + ARCH/host gates
above killswitch evaluation so unrelated builds (amd64/arm64 targets,
x86 hosts) skip qemu-arm entirely.
Early call site removed: prepare_host_binfmt_qemu_cross previously called
_native_armhf_setup_binfmt_elf BEFORE mmdebstrap, leaving the bootstrap
phase without qemu registration on a chroot that has no libc/ld-linux
yet — armhf maintainer-script exec fails. Native activation stays where
it belongs: post-mmdebstrap call sites in rootfs-create.sh and
rootfs-image.sh.
Cleanup-ordering invariant comment was inverted. add_cleanup_handler
PREPENDS, so later registrations run FIRST. The invariant survives
because setup is called before mount_chroot in both call sites; the
comment now states the actual mechanism and documents the failure mode
if a future call site inverts the order.
Assisted-by: Claude:claude-opus-4.7
display_alert "Native armhf via binfmt_elf""killswitch requested but qemu-arm already disabled by concurrent native-armhf builders""err"
216
+
exit_with_error "cannot honor NATIVE_ARMHF_ON_ARM64=no: concurrent native-armhf builders have disabled qemu-arm. Wait for them to finish or run on a separate host."
display_alert "Native armhf via binfmt_elf""concurrent build holds emulation-mode lock (NATIVE_ARMHF_ON_ARM64=no)""err"
244
279
exit_with_error "cannot enable native armhf: concurrent build with NATIVE_ARMHF_ON_ARM64=no holds emulation lock. Wait for it to finish or run on a separate host."
0 commit comments