From daee226afba9244c07085305f54b0437890f82c5 Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 14:15:14 +0100 Subject: [PATCH] Allow KVM for matching-architecture package guests --- tests/FEED.md | 2 +- tests/busybox/boot.v | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/FEED.md b/tests/FEED.md index 9c93d1a..43f1f62 100644 --- a/tests/FEED.md +++ b/tests/FEED.md @@ -155,6 +155,6 @@ Changing the netbase archive after signing caused assembly to fail its signed in The installed-root auditor checks each nonempty ELF load segment against the released kernel page size, 4 KiB on x86_64 and 16 KiB on aarch64. It also checks required symbol-version namespaces against the actual resolved package-owned provider using GNU readelf and objdump. The 106-package x86_64 root and the corrected arm64 loader passed. An old arm64 BusyBox failed its segment congruence check. An x86_64 libcrypto with its original SONAME and a changed version tag failed the OpenSSL consumer check. See `foundation/load-and-versions-02`, receipt SHA-256 `fd32f6b69db215ff6b79ec1f58c8457cf7f514dd162fbde410d9f6882072b979`. Use `tests/exec-linkage.py` as well to exercise actual dynamic symbol resolution. -Run the target vpac binary on the release kernel with `python3 tests/vpac-guest.py "$arch" "$repo" "$test_keys" "$fingerprint_file" "$update_receipt" "$auditor" "$boot" "$iso" "$output"`. Use a signed initial feed containing netbase and CA bundle release 2 and pass the receipt for CA bundle release 3. The guest has no network interface. The fixture tests a same-length package modification, authentic installation, local and remote lookup, and a signed in-place upgrade. Pass `--scenario install` or `--scenario upgrade` to replay either operation on a fresh copy of the same image inputs. The runner defaults to 720 seconds under QEMU TCG. `VINIX_QEMU_TIMEOUT` overrides that limit in seconds. +Run the target vpac binary on the release kernel with `python3 tests/vpac-guest.py "$arch" "$repo" "$test_keys" "$fingerprint_file" "$update_receipt" "$auditor" "$boot" "$iso" "$output"`. Use a signed initial feed containing netbase and CA bundle release 2 and pass the receipt for CA bundle release 3. The guest has no network interface. The fixture tests a same-length package modification, authentic installation, local and remote lookup, and a signed in-place upgrade. Pass `--scenario install` or `--scenario upgrade` to replay either operation on a fresh copy of the same image inputs. The runner defaults to 720 seconds under QEMU TCG. `VINIX_QEMU_TIMEOUT` overrides that limit in seconds. Set `VINIX_QEMU_ACCEL=kvm` when the host matches the guest architecture and the worker can open `/dev/kvm`. To exercise the original release binaries against the installed libraries on a worker of the same architecture, run `python3 tests/exec-linkage.py "$arch" "$client" "$auditor" --proot "$proot" --release "$archive" "$sha256" "$report"`. The probe binds one original executable over its guest path and runs the installed musl loader with `--list`. A negative control changed a library import in the original input and verified that the installed loader diagnosed the changed SONAME. In the 129-package x86_64 root, 52 of 95 dynamic image executables relocated, 27 reported failures and 16 fixed-address executables needed direct execution. Twelve of 17 X11 sidecar executables relocated. See `foundation/release-binary-relocation-02`, receipt SHA-256 `8483666ef4294f1ac5d44c1eb637a8f5200be4e613e635d835ef4f86e7ffa37b`. Directly starting the release `cpp` and `cc1` in that root expanded `__SIZEOF_POINTER__` to 8. See `foundation/release-original-exec-02`, receipt SHA-256 `b9f1659e4669df9f3d4aeddea37fd9b85abc40f9d55045fff1fc7096f091a209`. diff --git a/tests/busybox/boot.v b/tests/busybox/boot.v index 96995da..d13407b 100644 --- a/tests/busybox/boot.v +++ b/tests/busybox/boot.v @@ -25,6 +25,11 @@ fn boot_image(root string, iso string, output string, mode string, fixture strin userland := mode in ['--userland', '--aarch64-userland'] || fixture != '' musl := mode in ['--musl', '--aarch64-musl'] machine := if arm { 'aarch64' } else { 'x86_64' } + acceleration := os.getenv_opt('VINIX_QEMU_ACCEL') or { 'tcg' } + if acceleration !in ['tcg', 'kvm'] || (acceleration == 'kvm' && os.uname().machine != machine) { + return error('VINIX_QEMU_ACCEL must be tcg or kvm on a matching host') + } + cpu := if acceleration == 'kvm' { 'host' } else { 'max' } loader := '/lib/ld-musl-${machine}.so.1' if root == '/' || output == root || output.starts_with(root + '/') { return error('place the output outside a separate BusyBox package root') @@ -132,7 +137,7 @@ fn boot_image(root string, iso string, output string, mode string, fixture strin } else { '1024' } - emulator << ['-accel', 'tcg', '-cpu', 'max', '-m', memory, '-smp', '2', '-nic', 'none', '-display', + emulator << ['-accel', acceleration, '-cpu', cpu, '-m', memory, '-smp', '2', '-nic', 'none', '-display', 'none', '-monitor', 'none', '-serial', 'file:' + log, '-no-reboot'] run(['timeout', '${deadline}s', ...emulator])! lines := os.read_lines(log)!.map(it.trim_space()) -- 2.56.1