Skip to content

ci: run KVM selftests after x86 SH kernel builds - #6314

Merged
JackThomson2 merged 2 commits into
firecracker-microvm:feature/secret-hidingfrom
JackThomson2:sh/kvm-selftests-nested-x86
Nov 4, 2026
Merged

JackThomson2 merged 2 commits into
firecracker-microvm:feature/secret-hidingfrom
JackThomson2:sh/kvm-selftests-nested-x86

Conversation

@JackThomson2

Copy link
Copy Markdown
Contributor

Creating a script to build and install a modified kernel with patches
applied.

Signed-off-by: Jack Thomson jackabt@amazon.com## Changes

...

Reason

...

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle --no-clippy to verify that the PR
    passes the automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.63%. Comparing base (bff7dc1) to head (a905f5f).
⚠️ Report is 1 commits behind head on feature/secret-hiding.

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/secret-hiding    #6314   +/-   ##
======================================================
  Coverage                  81.63%   81.63%           
======================================================
  Files                        282      282           
  Lines                      33619    33619           
======================================================
  Hits                       27446    27446           
  Misses                      6173     6173           
Flag Coverage Δ
5.10-m5n.metal 81.54% <ø> (+0.01%) ⬆️
5.10-m6a.metal 80.88% <ø> (-0.03%) ⬇️
5.10-m6g.metal 78.73% <ø> (ø)
5.10-m6i.metal 81.52% <ø> (-0.04%) ⬇️
5.10-m7a.metal-48xl 80.87% <ø> (-0.06%) ⬇️
5.10-m7g.metal 78.73% <ø> (ø)
5.10-m7i.metal-24xl 81.50% <ø> (-0.01%) ⬇️
5.10-m7i.metal-48xl 81.51% <ø> (-0.05%) ⬇️
5.10-m8g.metal-24xl 78.73% <ø> (ø)
5.10-m8g.metal-48xl 78.73% <ø> (ø)
5.10-m8i.metal-48xl 81.53% <ø> (-0.02%) ⬇️
5.10-m8i.metal-96xl 81.53% <ø> (-0.03%) ⬇️
5.10-m9g.metal-48xl 78.73% <ø> (ø)
6.1-m5n.metal 81.65% <ø> (+<0.01%) ⬆️
6.1-m6a.metal 81.01% <ø> (-0.06%) ⬇️
6.1-m6g.metal 78.73% <ø> (ø)
6.1-m6i.metal 81.64% <ø> (-0.05%) ⬇️
6.1-m7a.metal-48xl 81.00% <ø> (-0.06%) ⬇️
6.1-m7g.metal 78.72% <ø> (-0.01%) ⬇️
6.1-m7i.metal-24xl 81.66% <ø> (-0.01%) ⬇️
6.1-m7i.metal-48xl 81.66% <ø> (-0.06%) ⬇️
6.1-m8g.metal-24xl 78.72% <ø> (-0.01%) ⬇️
6.1-m8g.metal-48xl 78.73% <ø> (+<0.01%) ⬆️
6.1-m8i.metal-48xl 81.69% <ø> (-0.01%) ⬇️
6.1-m8i.metal-96xl 81.69% <ø> (-0.02%) ⬇️
6.1-m9g.metal-48xl 78.73% <ø> (ø)
6.18-m5n.metal 81.64% <ø> (-0.04%) ⬇️
6.18-m6a.metal 81.00% <ø> (-0.06%) ⬇️
6.18-m6g.metal 78.82% <ø> (ø)
6.18-m6i.metal 81.64% <ø> (-0.01%) ⬇️
6.18-m7a.metal-48xl 81.00% <ø> (-0.06%) ⬇️
6.18-m7g.metal 78.82% <ø> (ø)
6.18-m7i.metal-24xl 81.65% <ø> (-0.01%) ⬇️
6.18-m7i.metal-48xl 81.66% <ø> (-0.05%) ⬇️
6.18-m8g.metal-24xl 78.82% <ø> (ø)
6.18-m8g.metal-48xl 78.82% <ø> (-0.03%) ⬇️
6.18-m8i.metal-48xl 81.69% <ø> (-0.02%) ⬇️
6.18-m8i.metal-96xl 81.69% <ø> (-0.03%) ⬇️
6.18-m9g.metal-48xl 78.82% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JackThomson2
JackThomson2 force-pushed the sh/kvm-selftests-nested-x86 branch 2 times, most recently from e78859b to 471fffb Compare October 20, 2026 14:13
@zulinx86
zulinx86 force-pushed the feature/secret-hiding branch from 04f1748 to 01fc1a9 Compare October 23, 2026 14:44
@JackThomson2
JackThomson2 force-pushed the sh/kvm-selftests-nested-x86 branch from 471fffb to 2a51467 Compare October 28, 2026 12:46
The secret hiding build job only checked that the patched kernels
compile. On x86 it now also boots the freshly built bzImage under nested
KVM with virtme-ng, reusing the dev container's root filesystem
read-only, and runs every KVM selftest installed from the same patched
tree. arm64 stays build-only.

The x86 job runs on the m6i.metal agents tagged os=al2023 and
kv=linux_6.1_nested, which have kvm_intel nested=1 set; the job only
checks for it and never reboots or reconfigures the agent. The per-arch
helper applies one platform to both architectures, so each variant gets
an x86 build-and-test group on those agents and an arm64 build-only
group on the default agents with the default timeout.

run_kselftest.sh exits 0 even when tests fail, so the guest writes its
TAP output to a writable 9p directory and the host checks it against the
installed test list: any not-ok result, missing result, all-skipped run,
bail-out or kernel panic fails the job, while hardware-dependent skips
are allowed. The TAP goes to a file rather than the console because
virtme relays guest stdout and stderr separately and the lines can
interleave. The per-test timeout is raised to 600s with -o because the
kselftest default of 120s is too tight for the slower tests under nested
virtualization.

Verified in the dev container against both variants: 6.18-amazon-linux
passes with 70 tests passed and 22 skipped, and 6.18-secret-hiding is
correctly reported as failing on guest_memfd_test.

Signed-off-by: Jack Thomson <jackabt@amazon.com>
@JackThomson2
JackThomson2 force-pushed the sh/kvm-selftests-nested-x86 branch from 2a51467 to bce0ec8 Compare October 28, 2026 12:55
@JackThomson2
JackThomson2 marked this pull request as ready for review October 28, 2026 13:12
@zulinx86
zulinx86 self-requested a review October 30, 2026 14:55

@zulinx86 zulinx86 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. although I left small nits, they are not blockers.

#
# Boot a freshly built kernel tree under nested KVM with virtme-ng and run every
# KVM selftest installed from that same tree. The host must already allow
# nested VMX (kvm_intel nested=1); the Buildkite agent is never rebooted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "the Buildkite agent" is just a process.

Suggested change
# nested VMX (kvm_intel nested=1); the Buildkite agent is never rebooted.
# nested VMX (kvm_intel nested=1); this script only checks for it and never
# reloads kvm_intel or reboots the host.

Comment on lines +79 to +80
`kvm_selftests.config`, boots the freshly built `bzImage` with
[virtme-ng](https://github.com/arighi/virtme-ng) under nested KVM, and runs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "under nested KVM" sounds a bit ambiguous to me. The nested guest is a VM launched for kernel selftests, but the VM booted with the built bzImage is L1 guest (non-nested).

Suggested change
`kvm_selftests.config`, boots the freshly built `bzImage` with
[virtme-ng](https://github.com/arighi/virtme-ng) under nested KVM, and runs
[virtme-ng](https://github.com/arighi/virtme-ng) as a KVM guest, and runs

trap 'rm -rf "$STAGE"' EXIT

make -C "$KERNEL" headers >"$RESULTS/build.log" 2>&1
make -C "$KERNEL/tools/testing/selftests" TARGETS=kvm SKIP_TARGETS= FORCE_TARGETS=1 \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is SKIP_TARGETS= needed?

@JamesC1305
JamesC1305 self-requested a review November 2, 2026 17:05
Comment thread .buildkite/pipeline_pr.py
Comment on lines 151 to 156
pipeline.build_group_per_arch(
f"🕵️ Build Secret Hiding Kernel [{variant}]",
pipeline.devtool_test(
pytest_opts=(
"-m secret_hiding "
f'-k "test_build_hiding_kernel[{variant}]" '
"integration_tests/build/test_hiding_kernel.py"
),
),
hiding_kernel_test,
instances=["m7g.metal"],
depends_on_build=False,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we not do run self-tests on ARM? Is there a reason preventing it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a NV ARM host at the moment

@JackThomson2

Copy link
Copy Markdown
Contributor Author

Doing a bypass merge as the tests are expected to fail here.

@JackThomson2
JackThomson2 merged commit abc6e00 into firecracker-microvm:feature/secret-hiding Nov 4, 2026
6 of 8 checks passed
@JackThomson2
JackThomson2 deleted the sh/kvm-selftests-nested-x86 branch November 4, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants