Skip to content

test(coganchor): verify Landlock ABIs on pinned kernels - #912

Merged
futrime merged 2 commits into
humanfia:mainfrom
yydawx:test/landlock-kernel-matrix
Nov 25, 2026
Merged

futrime merged 2 commits into
humanfia:mainfrom
yydawx:test/landlock-kernel-matrix

Conversation

@yydawx

@yydawx yydawx commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Closes #911

MFCP task: missionhub-oss/mfcp#248

What and why

The fence has different guarantees at Landlock ABI 1, 4, 5 and 6, but the
existing tests exercise whichever kernel the runner happens to use. Add a GitHub
Actions matrix that boots pinned Linux 5.15, 6.8, 6.10 and 6.12 kernels under
QEMU TCG and runs the real tests in each guest.

The matrix:

  • pins kernel.org source archives by SHA-256;
  • builds one minimal kernel configuration with Landlock, YAMA, seccomp
    filtering and pidfd_getfd;
  • builds static musl coganchor and test binaries once;
  • asserts the guest's Landlock ABI exactly instead of allowing a missing
    prerequisite to skip;
  • checks path read/write, TCP connect and loopback listening, cross-fence
    signals and abstract Unix sockets;
  • adds four named matrix legs to ci-ok.

KVM is deliberately unnecessary: these jobs check kernel behaviour, not speed.
The user and contributor docs now name the capabilities added at kernels 5.13,
6.7 and 6.12. No protocol document changes are needed.

How it was tested

Each pinned kernel was built and booted locally under QEMU TCG:

Kernel Landlock ABI Result
5.15 1 PASS: paths held; network fence refused as needing ABI 4
6.8 4 PASS: paths and TCP held
6.10 5 PASS: paths and TCP held
6.12 6 PASS: paths and TCP held; signals and abstract sockets scoped

Other checks:

  • cargo fmt --all -- --check: pass
  • cargo clippy --locked --all-targets -- -D warnings: pass
  • cargo test --locked: 388 library tests and all crate integration tests pass
  • uv run pytest tests/integration/test_core_ci_caches.py tests/integration/test_core_ci_filters.py: 48 passed
  • Ruff and Pyright: pass
  • Actionlint, Zizmor and workflow YAML parsing: pass
  • Docs build, anchors and 390px phone check: pass

A local full uv run pytest reached 8386 passed and 9 skipped, with four
failures in untouched code paths: one price-parsing assertion, two login-shell
tests affected by the local zsh first-run state, and one daemon test blocked by
local temporary-directory permissions. The affected files are not changed by
this PR; CI is the authoritative full-suite result.

The commit carries the author's DCO as Yapeng Wang <snowmantin@foxmail.com>.

Checklist

  • The title is a Conventional Commit.
  • New and changed tests are in crates/coganchor/tests/, where the crate's
    integration tests live.
  • The docs match the tested ABI behavior; no protocol document changed.
  • uv run pre-commit run --all-files and uv run pytest pass locally.
    Their individual checks were run as described above; the full pre-commit
    environment fetch timed out, and the full pytest result was not green for the
    unrelated local environment failures listed above.

Run the fence tests inside Linux 5.15, 6.8, 6.10 and 6.12 guests under QEMU TCG. Assert ABI 1, 4, 5 and 6 and cover paths, TCP, signals and abstract Unix sockets, with the four results wired into ci-ok.

Refs: humanfia#911
Signed-off-by: Yapeng Wang <snowmantin@foxmail.com>
@yydawx
yydawx force-pushed the test/landlock-kernel-matrix branch from daf7c4a to d2caa0a Compare November 22, 2026 02:30
futrime
futrime previously approved these changes Nov 25, 2026

@futrime futrime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Read the whole diff and the four landlock logs. The matrix asserts the guest's ABI exactly, a leg can only pass on the guest's own RUN PASS line, and the tarballs are pinned by SHA-256. landlock::abi, landlock::able and the refusal text it checks are unchanged on current main, and the branch merges cleanly; the merge queue reruns CI there.

Two nits, neither blocking, fine as a follow-up:

  1. The rust-cache step in landlock never hits (No cache found in all four legs): cache.yml saves no musl test build under that key. Either drop the step or have cache.yml save one. A cached bzImage per kernel and config hash would save more, since each leg rebuilds its kernel.
  2. find … -name 'landlock_kernel-*' | head -n 1 can pick a stale binary in a local target/; cargo test --no-run --message-format=json names the one just built.

@futrime
futrime added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
curl reads --max-time as seconds and took "10m" as 10, so a kernel.org
download slower than about 14 MB/s failed all its retries.
@futrime

futrime commented Nov 25, 2026

Copy link
Copy Markdown
Member

The merge queue dropped this: landlock (6.10, ABI 5) failed downloading the kernel (run). curl reads --max-time as seconds and took 10m as 10, so the 138 MB archive had to arrive in ten seconds; it did on the earlier runs and not on this one. I pushed 0d7f279, which says --max-time 600, and will queue it again once CI is green.

@futrime
futrime enabled auto-merge November 25, 2026 03:18

@futrime futrime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving again after 0d7f279 (the push dismissed the first approval); the review above stands.

@futrime
futrime added this pull request to the merge queue Nov 25, 2026
Merged via the queue into humanfia:main with commit a797427 Nov 25, 2026
29 of 31 checks passed
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.

[Feature]: test Landlock ABI 1, 4, 5 and 6 on pinned kernels

2 participants