From 4ee5d8198fbb8eab2987480c18cdc7df9343357c Mon Sep 17 00:00:00 2001 From: Danathar Date: Fri, 13 Nov 2026 20:40:40 -0500 Subject: [PATCH] fix(e2e): drop the recursive tmpfiles relabel of the test home The harness's /etc/tmpfiles.d/ci-user.conf began with a recursive `Z /var/home/bluefin-test` rule. Once the runner container is loaded, the home holds Podman storage, and every later boot made systemd-tmpfiles walk its hardlinks, producing systemd_tmpfiles_t -> proc_security_t denials on /proc/sys/fs/protected_hardlinks on every boot after the first (44 in lifecycle run 43510394355). The non-recursive `d` entries already create the home and .ssh and set their mode, owner and label. Found by castrojo in #1205 (whose utah lifecycle run 43535082068 has none of these denials once the rule is gone); redone here with a sign-off and a regression test, since #1205's commit has none. Assisted-by: Claude Opus 5.5 via Claude Code Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcWm7qQa538Zjcuvv8jBtn Signed-off-by: Danathar --- .github/workflows/e2e.yml | 6 ++++-- .../e2e-workflow/references/selinux-enforcing.md | 9 +++++++++ tests/unit/test_e2e_workflow.py | 11 +++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c491cd4fc..dec13743b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -727,8 +727,10 @@ jobs: # Create home dir via tmpfiles.d so it exists at runtime regardless # of whether bootc initialises the stateroot var from the image's /var. sudo mkdir -p "${DEP}/etc/tmpfiles.d/" - printf 'Z /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test/.ssh 0700 %d %d -\n' \ - "${BFT_UID}" "${BFT_UID}" \ + # Non-recursive `d` only: a recursive `Z` on the home would walk + # the runner container's Podman storage on every later boot and + # trip systemd-tmpfiles SELinux denials (#1205, run 43535082068). + printf 'd /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test/.ssh 0700 %d %d -\n' \ "${BFT_UID}" "${BFT_UID}" \ "${BFT_UID}" "${BFT_UID}" | \ sudo tee "${DEP}/etc/tmpfiles.d/ci-user.conf" diff --git a/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md b/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md index 33d8af4ea..211e57b6e 100644 --- a/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md +++ b/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md @@ -65,6 +65,15 @@ read only by `ostree`/`bootc`, which run unconfined. Never fix a denial by relabeling the whole tree, `-F` over candidate files, `chcon` to a broad type, `setenforce 0`, or a permissive domain. +The harness's injected `/etc/tmpfiles.d/ci-user.conf` creates the test home +and its `.ssh` with non-recursive `d` entries, which also set their mode, +owner and label on later boots. Don't add a recursive `Z` rule for the home. +Once the runner container is loaded, the home holds Podman storage, and `Z` +makes `systemd-tmpfiles` walk its hardlinks on every later boot. That produced +`systemd_tmpfiles_t` → `proc_security_t` denials (reading +`/proc/sys/fs/protected_hardlinks`) on every boot after the first. Found by +#1205; run 43535082068 has none of them once the rule is gone. + ## AVC collection and canary `selinux_collect_avc.sh` runs in the guest as root and prints AVC/USER_AVC diff --git a/tests/unit/test_e2e_workflow.py b/tests/unit/test_e2e_workflow.py index d7542e790..6ea35a27d 100644 --- a/tests/unit/test_e2e_workflow.py +++ b/tests/unit/test_e2e_workflow.py @@ -37,3 +37,14 @@ def test_manual_runs_checkout_the_selected_fork_ref_without_changing_callers(): assert 'default: "projectbluefin/testsuite"' in reusable assert "repository: ${{ inputs.test_repository }}" in reusable assert "test_repository: ${{ github.repository }}" in manual + + +def test_e2e_ci_user_tmpfiles_has_no_recursive_home_relabel(): + # A recursive `Z` on the test home walks the runner's Podman storage on + # every later boot and trips systemd-tmpfiles SELinux denials (#1205). + workflow = _workflow("e2e.yml") + start = workflow.index('"${DEP}/etc/tmpfiles.d/"') + block = workflow[start:workflow.index("ci-user.conf", start)] + assert "'Z " not in block and "\\nZ " not in block + assert "d /var/home/bluefin-test 0700" in block + assert "d /var/home/bluefin-test/.ssh 0700" in block