mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
cpu-exec exists so that a binary needing an instruction-set feature the CPU does not have (AVX masked by a hypervisor - QEMU/KVM/Proxmox, the reported #6458 environment - an old CPU, or ARMv8.0 on a Raspberry Pi) runs through bundled qemu-user instead of dying instantly with SIGILL. With no features declared it is a plain exec, so it is safe and free to route EVERY binary through it - which is why the design is "route everything". Two platforms were not doing that: * Sandstorm SHIPPED cpu-exec and qemu-x86_64 (sandstorm-src/build-deps.sh) but the grain launcher spawned all eight bundled binaries directly - ferretdb, mongod 3.0 (twice), niscud, the legacy mongo CLI (twice) and node for the bridge and the importer. So the safety net was in the package and unreachable, on the platform with the LEAST control over its hardware: a grain runs on whatever CPU the Sandstorm host has. * The snap routed mongod (mongodb-control, migration-control) but not FerretDB (ferretdb-control, both the external-DB and SQLite launches) and not node (wekan-control: the main application start and both maintenance-page starts). Both now route through cpu-exec, each with a direct-exec fallback so an older deps image or snap revision still works. On Sandstorm the guard also requires /bin/bash, since cpu-exec is a bash script; without it the binary runs directly exactly as before. The snap's main start keeps its `ulimit -s 65500` - the limit is set before the exec and inherited across it (verified by expanding the line). Docker (releases/ferretdb/wekan-entrypoint.sh) and the bundle launcher (releases/ferretdb/start-wekan.sh) already routed ferretdb and node, and were checked for other unrouted launches - there are none. tests/cpuExecWiring.test.cjs previously asserted only that the Sandstorm build SHIPS cpu-exec, which is exactly how the gap survived: it now asserts that the grain launcher routes each of the six bundled binaries, that no bundled binary is spawned directly any more (/bin/sleep is a grain utility, not bundled, so it is exempt), and that the snap routes FerretDB and node with their fallbacks intact. Thanks to xet7 !