Skip to content

Carried patches: no static analysis, no fuzzing, and the patched packages' own tests are off #653

Closed

Description

@aledbf

The machine carries 22 patches in C: kernel 10, QEMU 7 (0007 is #652), qboot 4, systemd 1 and OpenSSH 1. Nothing analyses or fuzzes them. Read 2026-11-23 at origin/main:

  • Fuzzing: none. There is no func Fuzz in the Go tree, no QEMU fuzz target (tests/qtest/fuzz) and no syzkaller. The "fuzz" in the Dockerfiles is patch --fuzz=0, the context a patch is applied with.
  • Static analysis of C: none. No Coverity, CodeQL, scan-build, GCC -fanalyzer, cppcheck, sparse or smatch runs. kernel/Dockerfile says the kernel patches are checkpatch.pl --strict clean, but no build checks it.
  • Sanitizers: none. QEMU and qboot are never built with ASan or UBSan.
  • The patched packages' own tests are off. image/openssh/Dockerfile and image/systemd/Dockerfile build with DEB_BUILD_OPTIONS=nocheck. OpenSSH's regress suite never runs over userauth-delay-failures.patch, which is in the authentication path, and systemd's tests never run over 0001-dropin-derive-candidate-names-once.patch.
  • What does run: the functional probes (boot:record, boot:compat, the release's pause checks, the lab), osv.yml over the image's packages, and for Go gofmt, go vet, go-tools' linters and mutation testing.

Where the risk is, by what an attacker reaches

The trust boundary is the host. A guest is the tenant's, so a QEMU patch that a guest can drive is the first priority.

patch reached by priority
OpenSSH userauth-delay-failures anyone who reaches the guest's sshd, the auth path high
QEMU 0005, an incoming machine's TSC from its migration a state file (spin's, but stored and copied) high
QEMU 0002 virtio-scsi max_target, 0003, 0004, 0007 the guest (0002, its SCSI scan), QMP (0003, 0004), the host's kernel file (0007) medium
qboot's 4 patches the guest's own firmware, inside the guest medium
kernel 0012 and 0013, BPF and BTF a process in the guest loading BPF: the verifier path medium (in-guest privilege)
kernel 0001-0010, ftrace, PCI, ORC the guest's own boot low
systemd 0001 unit files in the guest low

Proposal, cheapest first, each a step in the build that carries the patch ("fail where the cause is")

  1. Turn the packages' tests back on for what we patch. Run OpenSSH's make tests (or at least regress/ for auth) and systemd's meson tests for the unit-loading code in their Dockerfiles. This is the cheapest and the most important item.
  2. Enforce checkpatch, and add sparse. Run checkpatch.pl --strict on kernel/patches and make C=2 (sparse) on the files they touch, in kernel/Dockerfile. Also run the BPF selftests (test_verifier, test_progs) on a kernel with 0012 and 0013, in a guest on the bench.
  3. CodeQL for C/C++, scoped to the patched files. The repository is public, so it is free. It is GitHub's own action and needs no account outside, unlike Coverity Scan.
  4. A QEMU built with ASan and UBSan, as a lab tree, running boot:record, boot:compat, checkpoint-pause and a restore. 0005's migration path and 0002's SCSI scan run under the sanitizers.
  5. Fuzzing, where input crosses a boundary:
    • QEMU's generic-fuzz on virtio-scsi with max_target (0002).
    • A fuzzer over a state's TSC section (0005).
    • Go func Fuzz for what the machine parses from outside: Saved and the machine record (CanResume), and QMP replies.

How to settle: steps 1-2 land as build checks. Step 3 is a workflow. Steps 4-5 are lab trees and a scheduled run, each with its finding filed or "nothing found" recorded here.

Activity

  1. aledbf commented on Nov 23, 2026

    @aledbf
    MemberAuthor

    Steps 4 and 5. What runs where:

    • 5a, Go fuzzing (machine, qmp: fuzz the record, CanResume and QMP's replies (#653) #670, merged). FuzzARecordReadBack, FuzzCanResume and FuzzWhatQEMUSays run for 60 s each in ci.yml's fuzz job on every change (task fuzz). FuzzCanResume found that a record whose machine names a fact with no name was read, and that a refusal of it then named nothing. newHardware now refuses an empty name, and the input is kept in machine/testdata/fuzz.
    • 4, ASan and UBSan (qemu: the patches under ASan and UBSan, booted and fuzzed (#653) #678, open). sanitize.yml runs on a change to the qemu part and weekly. boots runs on the KVM fleet: the release's QEMU_FLAGS built from the patched tree under both sanitizers, then boot:record, boot:patches, checkpoint-pause, lab compat, and 3 ssh-first and 3 restore-first. patched reports fails on any report, names the patch whose file holds the innermost frame (or upstream), and fails on logs that record no process. Run 45239239212: every step passed, and the verb said "49 sanitized QEMU processes, no report" (measured).
    • 5b, QEMU fuzzing (qemu: the patches under ASan and UBSan, booted and fuzzed (#653) #678). generic-fuzz drives virtio-scsi with 0002's max_target=15: 5 min on a change, 30 min weekly. Run 45235332661 did 79194 inputs in 301 s and run 45239239212 did 80347, with no report in either (measured). A weekly report opens an issue once for each kind and place.
    • 0005's TSC is not fuzzed. Its code runs only under KVM, upstream has no migration-stream fuzzer, and the guest has no MSR device. The restores above run it under the sanitizers. Follow-up: qemu: no fuzzer reaches 0005's incoming TSC #677.

    Nothing found in QEMU's patches. This closes once #678 merges.

  2. aledbf commented on Nov 23, 2026

    @aledbf
    MemberAuthor

    All five steps are in: the patched packages' own tests (#655), checkpatch and sparse (#656), CodeQL on the patched files with an extraction guard and our own Go and workflows, daily on main (#657, #659, #668), ASan/UBSan QEMU booted and fuzzed over virtio-scsi on a QEMU change and weekly (#678), and Go fuzz targets over the record, CanResume and QMP replies, daily on main (#670, #688). Findings: one, a record with a nameless hardware fact, fixed in #670. #677 (0005's TSC) decided not worth a fuzzer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions