Skip to content

run-aarch64-test.sh/run-aarch64-userspace.sh kill ANY concurrent Docker container of the same image, not just their own #829

Description

@ryanbreen

What happens

docker/qemu/run-aarch64-test.sh and docker/qemu/run-aarch64-userspace.sh
both end with:

docker kill $(docker ps -q --filter ancestor=breenix-qemu-aarch64) 2>/dev/null || true

docker ps --filter ancestor= matches on the image, not the container id,
so this kills any container currently running from breenix-qemu-aarch64 --
not only the one this invocation started. Two concurrent invocations of
either script (or one of each) on the same host share that image, so the
first invocation to finish can kill the second invocation's still-running
QEMU container out from under it.

How it was found

Found while auditing docker/qemu/*aarch64*.sh for the fixed-/tmp-path
hazard #825 reports, in the same pass that gave both scripts'
OUTPUT_DIR a BREENIX_GATE_TMP base. BREENIX_GATE_TMP does not
address this: it separates the two runs' files, but this line still
terminates the other run's process regardless of where its output
lands.

Why it matters

Same failure class as #825: a concurrent run's evidence is corrupted, but
here by killing the peer's QEMU process rather than by overwriting its
serial file. Both scripts are Docker-wrapped legacy tools, superseded by
the native-QEMU scripts CLAUDE.md's Test Scripts section documents, so
this is lower traffic than #825's targets -- but the hazard is real
whenever either script runs.

Shape of a fix

Capture this invocation's own container id (docker run --cidfile or
docker run -d plus the captured id, rather than the current
fire-and-forget &) and docker kill that one id, instead of the whole
image-filter match the current line uses.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions