Skip to content

aurora-sep: selinux: allow catacomb publication by atomic replacement - #2978

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
mmdisbrow:sep-selinux-1-14
Nov 26, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:mainfrom
mmdisbrow:sep-selinux-1-14

Conversation

@mmdisbrow

@mmdisbrow mmdisbrow commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What: Label /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new as aurora_sep_state_t and allow kernel_t setattr, rename, and unlink on aurora_sep_state_t files so aurora-sep-selinux 1-15 (module 1.4.0) can land ahead of #2966's atomic catacomb replacement.
Tested: Host tests and Fedora 45 (aarch64) container build/offline 1-14 to 1-15 semodule upgrade pass at 914a6baf4d77; live Fedora SELinux Enforcing Touch ID Mac row still needed.
Risk: two-way door · all Touch ID Macs running Fedora SELinux (policy-only; backwards-compatible with current truncate-in-place kernels)
Not yet: Live Fedora Touch ID Mac run at 914a6baf4d77 under SELinux Enforcing confirming 1-14 to 1-15 package upgrade, ordinary host-state publication, 0 SELinux AVC denials, 0 failed units, and 0 new kernel errors (local test Mac runs Arch Linux ARM without SELinux).

Details

Atomic catacomb replacement in #2966 writes each catacomb to /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new, resets its mode to 0600 when a caller's umask cleared bits, renames it over the target file, and unlinks any leftover temporary file. Under aurora-sep-selinux 1-14 (module 1.3.0), those temporary files inherit var_lib_t instead of aurora_sep_state_t and kernel_t lacks module-scoped setattr, rename, and unlink rules on aurora_sep_state_t. Splitting the SELinux policy update lets aurora-sep-selinux 1-15 land and ship ahead of the kernel consumer.

Changes vs main (6f05cf2940c5):

  • tools/aurora-sep/aurora_sep.te: bump module to 1.4.0, add setattr_file_perms rename_file_perms delete_file_perms to allow kernel_t aurora_sep_state_t:file, and add named type_transition rules for .apple-sep-catacomb-{master,owner,user}.bin.new.
  • tools/aurora-sep/aurora_sep.fc: add file-context pattern for /var/lib/\.apple-sep-catacomb-(master|owner|user)\.bin\.new.
  • tools/aurora-sep/packaging/fedora/aurora-sep.spec: merge main (6f05cf2940c5), retain 05-aurora-sep.conf and the 1-14 changelog entry from 3676688b7560, and bump Release to 1-15 for module 1.4.0.
  • tools/aurora-sep/tests/test_sep_selinux_state.py: verify the temporary file contexts, type_transition rules, and kernel_t allow rule without depending on drivers/soc/apple/store_shim.c.

Scope: SELinux policy, Fedora RPM spec, and policy unit tests only (drivers/ unchanged from main). Backwards-compatible with current truncate-in-place kernels.

Evidence

Verified at merged head 914a6baf4d777e3f2c29fbca0253ea12c4734b05 (merge of origin/main 6f05cf2940c5d into 41a02cefcf581):

  • Net diff against origin/main: 4 files in tools/aurora-sep/ (+34/-3). git diff --check is clean; scripts/checkpatch.pl --no-signoff reports 0 errors and 0 warnings across 78 lines.
  • All 16 Python test commands from .github/workflows/sep-source.yml plus test_sep_selinux_state.py pass under Rust 1.85.0 (test_sep_selinux_state.py 14/14, test_packaging.py 4/4, test_sep_writes_always_on.py 22/22).
  • Throwaway registry.fedoraproject.org/fedora:45 (aarch64) container (selinux-policy-targeted-45.24-1.fc45, selinux-policy-devel-45.24-1.fc45, policycoreutils-3.11-2.fc45, setools-console-4.7.1-1.fc45):
    • tools/aurora-sep/packaging/fedora/build.sh built aurora-sep-1-14.fc45.noarch.rpm (66277 bytes) and aurora-sep-selinux-1-14.fc45.noarch.rpm (25345 bytes) from origin/main (6f05cf2940c5d), then built aurora-sep-1-15.fc45.noarch.rpm (66612 bytes), aurora-sep-selinux-1-15.fc45.noarch.rpm (25677 bytes), and aurora-sep-1-15.fc45.src.rpm (92488 bytes) from 914a6baf4d77 with 0 errors.
    • rpm -qlp aurora-sep-1-15.fc45.noarch.rpm confirms /usr/lib/systemd/logind.conf.d/05-aurora-sep.conf is retained alongside all current package files, and rpm -qp --changelog shows 1-15 above Ryan's 1-14 entry.
    • Offline semodule -s targeted -N -i upgrade from 1-14 to 1-15 succeeded cleanly (400 aurora_sep pp) into policy.35.
    • matchpathcon -f /etc/selinux/targeted/contexts/files/file_contexts moved /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new from system_u:object_r:var_lib_t:s0 (1-14) to system_u:object_r:aurora_sep_state_t:s0 (1-15), while canonical catacombs, aurora-sep-keybag.bin, and /dev/sep-bio stayed unchanged.
    • sesearch on /etc/selinux/targeted/policy/policy.35 confirmed all 13 type_transition kernel_t var_lib_t:file aurora_sep_state_t rules (including the three .new names).

A kernel that publishes a catacomb by atomic replacement writes the
complete file under a fixed temporary name, ".<name>.new", in /var/lib,
and renames it over the catacomb. SELinux labels a file when it is
created and rename keeps that label, so the temporary must be created
with the state type, not var_lib_t.

Give the three temporary names aurora_sep_state_t with type_transition
rules and file contexts, and let the kernel set attributes on (to reset
a temporary's mode to 0600 after a restrictive caller umask), rename and
unlink state files. Bump the module to 1.4.0 and the package to 1-14.

This policy has to be installed before a kernel with atomic catacomb
replacement, so it lands and ships on its own first. It only adds
labels and permissions; current kernels are unaffected.

Signed-off-by: Matt <mmdisbro@gmail.com>

@DjDeveloperr DjDeveloperr 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.

Formal §1–§6 pre-PR checklist audit at live head 41a02cefcf581d3905149bd012353d73ee69fc12.

Splitting the SELinux policy precursor out of #2966 directly addresses the §1 chicken-and-egg upgrade-order blocker, and the policy rules themselves are well-aligned with #2966 (store_shim.c). However, CI has not run on this fork PR and §5 policy-build + Fedora SELinux Enforcing verification is still missing, so this cannot enter MERGETRAIN-LINUX4 yet.

Technical Audit (Cross-checked against #2966)

  • SELinux TE/FC rules (aurora_sep.te, aurora_sep.fc):
    • Bumps policy_module(aurora_sep, 1.4.0) cleanly.
    • Adds named type_transition kernel_t var_lib_t:file aurora_sep_state_t ".apple-sep-catacomb-{master,owner,user}.bin.new"; and matching .fc regex /var/lib/\.apple-sep-catacomb-(master|owner|user)\.bin\.new -- gen_context(system_u:object_r:aurora_sep_state_t,s0), matching store_shim.c's ".%s.new" names so renamed inodes preserve aurora_sep_state_t.
    • Adds valid refpolicy macros setattr_file_perms ({ setattr }), rename_file_perms ({ getattr rename }), and delete_file_perms ({ getattr unlink }) to allow kernel_t aurora_sep_state_t:file, matching notify_change(), vfs_rename(), and vfs_unlink() executed under override_creds(kern) in #2966.
    • Preserves the test_no_access_to_generic_var_lib invariant (no allow ... var_lib_t added).
  • Spec & backward compatibility (aurora-sep.spec, test_sep_selinux_state.py):
    • Cleanly bumps Release: 14%{?dist} with upgrade-order changelog note; strictly additive over 1-13 and backwards-compatible with current truncate-in-place kernels.
    • Unit tests verify .fc, type_transition, and allow rules without depending on store_shim.c.
    • (Non-blocking packaging note: fedora-aurora/packages/aurora-sep is currently ahead of linux/tools/aurora-sep at 1-22, so once this precursor lands, the same .te/.fc delta will need to be mirrored into the distribution package before shipping #2966.)

Blockers Before Approval

  1. CI not executed (action_required): Fork PR (mmdisbrow/aurora-silicon-linux) has empty statusCheckRollup; both SEP source checks (run 45183622208) and Host tests (run 45183621928) are action_required. Both workflows must be run and green on the final head before merge.
  2. §5 Policy build & Fedora SELinux Enforcing verification missing: test_sep_selinux_state.py only inspects .te/.fc text with regexes; it does not compile aurora_sep.pp via selinux-policy-devel (make -f /usr/share/selinux/devel/Makefile aurora_sep.pp) or verify module installation/upgrade. As noted in the PR body, live Fedora SELinux Enforcing build and upgrade testing are still pending. Before approval, please report:
    • Successful aurora_sep.pp compilation / RPM build with selinux-policy-devel.
    • Fedora SELinux Enforcing upgrade check (1-13 -> 1-14) on a Mac with SEP/Touch ID running the current kernel, confirming semodule installation, matchpathcon on /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new -> aurora_sep_state_t, no regressions on existing truncate-in-place SEP state, and the §5 regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors).

Checklist (§1–§6)

  • §1 No model gating / chicken-and-egg: Pass (clean precursor split ahead of #2966).
  • §2 Production-ready, no hacks: Pass.
  • §3 Safety: Conditional on §5 policy compilation and Enforcing upgrade verification.
  • §4 Clean-room & attribution: Pass — commit 41a02cefcf58 carries human author/committer (Matt <mmdisbro@gmail.com>) and human Signed-off-by: only, with zero AI trailers in commits; PR body includes Assisted-by:.
  • §5 Evidence: Blocked (see Blocker #2).
  • §6 Naming & CI: Naming Pass; CI Blocked (action_required, 0 checks run).

@mmdisbrow

Copy link
Copy Markdown
Contributor Author

Added Fedora 45 (aarch64) container build and offline SELinux policy upgrade verification at 41a02cefc (against selinux-policy-targeted-45.24-1.fc45, selinux-policy-devel-45.24-1.fc45, policycoreutils-3.11-2.fc45, setools-console-4.7.1-1.fc45):

  1. build.sh / aurora_sep.pp compile: tools/aurora-sep/packaging/fedora/build.sh ran make -f /usr/share/selinux/devel/Makefile aurora_sep.pp with 0 errors and produced:
    • aurora-sep-1-14.fc45.noarch.rpm (66228 bytes)
    • aurora-sep-selinux-1-14.fc45.noarch.rpm (25498 bytes)
    • aurora-sep-1-14.fc45.src.rpm (91777 bytes)
  2. Offline 1-13 -> 1-14 semodule upgrade & matchpathcon:
    • Installing 1-13 (110861f43) via semodule -s targeted -N -i aurora_sep.pp left /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new labeled system_u:object_r:var_lib_t:s0.
    • Upgrading to aurora_sep.pp.bz2 extracted from aurora-sep-selinux-1-14.fc45.noarch.rpm succeeded cleanly (400 aurora_sep pp), and matchpathcon -f /etc/selinux/targeted/contexts/files/file_contexts resolved all three .new paths plus the canonical catacombs and aurora-sep-keybag.bin to system_u:object_r:aurora_sep_state_t:s0 (and /dev/sep-bio to system_u:object_r:aurora_sep_device_t:s0).
  3. Compiled binary policy (sesearch on /etc/selinux/targeted/policy/policy.35): All 13 type_transition kernel_t var_lib_t:file aurora_sep_state_t rules (including .apple-sep-catacomb-{master,owner,user}.bin.new) compiled into policy.35, with kernel_t, fprintd_t, kmod_t, and init_t access rules intact.

Remaining open blockers on this PR:

  • Maintainer approval to run SEP source checks and Host tests on 41a02cefc.
  • Live Fedora SELinux Enforcing 1-13 -> 1-14 upgrade check on a Touch ID Mac running the current kernel (0 SELinux denials, 0 failed units, 0 new kernel errors), which a container cannot cover.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 2026

@DjDeveloperr DjDeveloperr 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.

Verdict: FINISH, then merge at 41a02cefcf58: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: I've approved the two waiting CI runs; they have to pass. Then one Fedora Touch ID Mac with SELinux enforcing at this head, with the catacomb published by atomic replacement and no AVC denials.

Checked: thank you, especially for the offline policy-upgrade check against selinux-policy-targeted-45.24-1.fc45. No Apple material; policy, file contexts and the spec only.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 06:50

Superseded by the review at 41a02ce

@RyanTheTide

Copy link
Copy Markdown
Contributor

Verdict: FINISH, then merge at 41a02cefcf58.

Blockers: The branch now conflicts with main in tools/aurora-sep/packaging/fedora/aurora-sep.spec. Please bring main forward with a normal push and retain current package entries alongside this policy change.

Checked: The Fedora 45 container result covers policy build and offline upgrade. The forwarded head needs the usual installed Fedora Touch ID row with SELinux enforcing and no new denials across ordinary host-state publication.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 914a6baf: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at 914a6baf
Conflicts ok none
PR text ok Risk: two-way · all Touch ID Macs running Fedora SELinux (policy-only; backwards-compatible with current truncate-in-place kernels)

Areas: none matched in CODEOWNERS
Merge: gh pr merge 2978 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

Resolve the Fedora spec conflict with commit 3676688
("tools: aurora-sep: install the logind drop-in ahead of the
distribution's"), keeping the 05-aurora-sep.conf drop-in and 1-14
changelog entry and bumping the SELinux 1.4.0 policy release to 1-15.

Signed-off-by: Matt <mmdisbro@gmail.com>
@mmdisbrow

Copy link
Copy Markdown
Contributor Author

Merged main (6f05cf2940c5) into sep-selinux-1-14 at 914a6baf4d77 with a normal merge commit (no force push).

Resolution in tools/aurora-sep/packaging/fedora/aurora-sep.spec:

  • Kept 05-aurora-sep.conf and the 1-14 changelog entry from 3676688b7560.
  • Bumped Release: to 15%{?dist} with the 1-15 changelog entry for aurora-sep-selinux 1.4.0.

Re-verified at 914a6baf4d77:

  • Net diff vs main: 4 files in tools/aurora-sep/ (+34/-3); checkpatch.pl 0 errors, 0 warnings; all sep-source.yml Python tests plus test_sep_selinux_state.py (14/14) and test_packaging.py (4/4) pass under Rust 1.85.0.
  • Fedora 45 (aarch64) container (selinux-policy-targeted-45.24-1.fc45, selinux-policy-devel-45.24-1.fc45, policycoreutils-3.11-2.fc45, setools-console-4.7.1-1.fc45):
    • build.sh produced aurora-sep-1-15.fc45.noarch.rpm (retaining /usr/lib/systemd/logind.conf.d/05-aurora-sep.conf), aurora-sep-selinux-1-15.fc45.noarch.rpm, and aurora-sep-1-15.fc45.src.rpm.
    • Offline semodule -s targeted -N -i upgraded cleanly from main's 1-14 to 1-15; matchpathcon moved /var/lib/.apple-sep-catacomb-{master,owner,user}.bin.new from var_lib_t to aurora_sep_state_t, and sesearch confirmed all 13 type_transition rules in policy.35.

Still needed before merge:

  • Workflow approval for CI on 914a6baf4d77.
  • A live Fedora Touch ID Mac row at 914a6baf4d77 under SELinux Enforcing (1-14 to 1-15 upgrade, ordinary host-state publication, 0 SELinux AVC denials, 0 failed units, 0 new kernel errors). My local Touch ID Mac runs Arch Linux ARM without SELinux, so I cannot run the live Fedora Enforcing row locally. Could a lab Fedora Touch ID Mac run that row once CI passes?

@mmdisbrow
mmdisbrow requested review from a team as code owners November 25, 2026 13:29

@DjDeveloperr DjDeveloperr 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.

Re-reviewed after merging main at 914a6baf4d77: the aurora-sep.spec merge resolution cleanly preserves 05-aurora-sep.conf / 1-14 and bumps to 1-15, and the SELinux policy changes (aurora_sep 1.4.0) and tests remain clean.

@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed merge-conflict Conflicts with the base branch (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

914a6ba J616s (T6040, M4 Pro) PASS: guarded one-shot combined batch (0d2ac928b426 over main 5a4b951, 0 merge-tree diffs on 4 changed files, default cmdline, stock Stage 2 1.0.0b17, boot 3b6ced23-015d-4775-897b-81a51be1de72): 0 failed units, Enforcing, 0 new AVC, 0 GPU faults, 0 NVMe/PCIe errors, 0 new kernel errors, 2/2 real rtc1 s2idle, Borealis VK api.smoke 8/8 pre/post, Wi-Fi 3/3; stock 7.3.0-aurora-fleet89 restored.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 26, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo) row at 914a6baf4d777e3f2c29fbca0253ea12c4734b05: PASS for everything the J700 can exercise. Catacomb publication itself can't be triggered here; see below.

  • What was installed: the Neo doesn't run the linux-tree packaging. It runs fedora-aurora's aurora-sep/aurora-sep-selinux 1-22 (module 1.4.1). This PR's literal 1-15 would be a downgrade there, and on a copy of the Neo's policy store it drops policy the Neo needs: the aurora_touchid_rearm_t domain, and the /dev/sep-bio-rearm label. So the row installed the Neo's own 1-22 source plus exactly this PR's aurora_sep.te/aurora_sep.fc change, as 1-22.pr2978. Its module differs from the installed 1-22 by exactly the PR's 3 typetransitions, the filecon and the wider allow.
  • Results (Enforcing, Linux 7.3.0-41): the package installs cleanly with rpm -Uvh.
    • .apple-sep-catacomb-{master,owner,user}.bin.new label as aurora_sep_state_t.
    • The live policy has 14 kernel_t state transitions, 3 of them new for .bin.new.
    • The canonical catacomb paths keep aurora_sep_state_t, and the SEP state files are untouched.
    • Live and on two boots under the new policy: 0 AVC/SELINUX_ERR, 0 failed units and 0 new kernel error lines. The 7 Touch ID sensor error lines appear on every boot on this Neo.
  • Publication can't be exercised on the J700:
    • The kernel the Neo runs writes catacombs in place (drivers/soc/apple/catacomb.rs), so nothing renames a .bin.new until soc: apple: sep: publish catacomb files by atomic replacement #2966 lands.
    • Every save_catacomb caller needs an enrolment or a match, or else changes SEP state.
    • This Neo has 0 enrolled identities, and its sensor doesn't register at boot.
  • Review note: under Fedora's base policy kernel_t can already rename, setattr and unlink these files, so the PR's wider allow leaves the binary policy unchanged. Only the 3 transitions and the file context change behaviour.
  • Restored: the signed 1-22 pair is back, with the same header digests as before. 1-22's module is active again, .bin.new labels as var_lib_t, the policy has 11 transitions, and dnf's records are unchanged; all checked on a fresh boot. The PMU boot-error count read 00 on every boot.

@DjDeveloperr
DjDeveloperr merged commit 40e5e29 into aurora-silicon:main Nov 26, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants