Repository navigation
aurora-sep: selinux: allow catacomb publication by atomic replacement - #2978
Conversation
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>
There was a problem hiding this comment.
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.fcregex/var/lib/\.apple-sep-catacomb-(master|owner|user)\.bin\.new -- gen_context(system_u:object_r:aurora_sep_state_t,s0), matchingstore_shim.c's".%s.new"names so renamed inodes preserveaurora_sep_state_t. - Adds valid refpolicy macros
setattr_file_perms({ setattr }),rename_file_perms({ getattr rename }), anddelete_file_perms({ getattr unlink }) toallow kernel_t aurora_sep_state_t:file, matchingnotify_change(),vfs_rename(), andvfs_unlink()executed underoverride_creds(kern)in #2966. - Preserves the
test_no_access_to_generic_var_libinvariant (noallow ... var_lib_tadded).
- Bumps
- Spec & backward compatibility (
aurora-sep.spec,test_sep_selinux_state.py):- Cleanly bumps
Release: 14%{?dist}with upgrade-order changelog note; strictly additive over1-13and backwards-compatible with current truncate-in-place kernels. - Unit tests verify
.fc,type_transition, andallowrules without depending onstore_shim.c. - (Non-blocking packaging note:
fedora-aurora/packages/aurora-sepis currently ahead oflinux/tools/aurora-sepat1-22, so once this precursor lands, the same.te/.fcdelta will need to be mirrored into the distribution package before shipping #2966.)
- Cleanly bumps
Blockers Before Approval
- CI not executed (
action_required): Fork PR (mmdisbrow/aurora-silicon-linux) has emptystatusCheckRollup; bothSEP source checks(run45183622208) andHost tests(run45183621928) areaction_required. Both workflows must be run and green on the final head before merge. - §5 Policy build & Fedora SELinux Enforcing verification missing:
test_sep_selinux_state.pyonly inspects.te/.fctext with regexes; it does not compileaurora_sep.ppviaselinux-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.ppcompilation / RPM build withselinux-policy-devel. - Fedora SELinux Enforcing upgrade check (
1-13->1-14) on a Mac with SEP/Touch ID running the current kernel, confirmingsemoduleinstallation,matchpathconon/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).
- Successful
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
41a02cefcf58carries human author/committer (Matt <mmdisbro@gmail.com>) and humanSigned-off-by:only, with zero AI trailers in commits; PR body includesAssisted-by:. - §5 Evidence: Blocked (see Blocker #2).
- §6 Naming & CI: Naming Pass; CI Blocked (
action_required, 0 checks run).
|
Added Fedora 45 (
Remaining open blockers on this PR:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
Superseded by the review at 41a02ce
|
Verdict: FINISH, then merge at Blockers: The branch now conflicts with 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. |
|
Merge readiness at
Areas: none matched in CODEOWNERS 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>
|
Merged Resolution in
Re-verified at
Still needed before merge:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
|
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. |
|
J700 (MacBook Neo) row at
|
What: Label
/var/lib/.apple-sep-catacomb-{master,owner,user}.bin.newasaurora_sep_state_tand allowkernel_tsetattr,rename, andunlinkonaurora_sep_state_tfiles soaurora-sep-selinux1-15 (module 1.4.0) can land ahead of #2966's atomic catacomb replacement.Tested: Host tests and Fedora 45 (
aarch64) container build/offline1-14to1-15semoduleupgrade pass at914a6baf4d77; 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
914a6baf4d77under SELinux Enforcing confirming1-14to1-15package 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 to0600when a caller's umask cleared bits, renames it over the target file, and unlinks any leftover temporary file. Underaurora-sep-selinux1-14 (module 1.3.0), those temporary files inheritvar_lib_tinstead ofaurora_sep_state_tandkernel_tlacks module-scopedsetattr,rename, andunlinkrules onaurora_sep_state_t. Splitting the SELinux policy update letsaurora-sep-selinux1-15 land and ship ahead of the kernel consumer.Changes vs
main(6f05cf2940c5):tools/aurora-sep/aurora_sep.te: bump module to1.4.0, addsetattr_file_perms rename_file_perms delete_file_permstoallow kernel_t aurora_sep_state_t:file, and add namedtype_transitionrules 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: mergemain(6f05cf2940c5), retain05-aurora-sep.confand the1-14changelog entry from3676688b7560, and bump Release to1-15for module1.4.0.tools/aurora-sep/tests/test_sep_selinux_state.py: verify the temporary file contexts,type_transitionrules, andkernel_tallow rule without depending ondrivers/soc/apple/store_shim.c.Scope: SELinux policy, Fedora RPM spec, and policy unit tests only (
drivers/unchanged frommain). Backwards-compatible with current truncate-in-place kernels.Evidence
Verified at merged head
914a6baf4d777e3f2c29fbca0253ea12c4734b05(merge oforigin/main6f05cf2940c5dinto41a02cefcf581):origin/main: 4 files intools/aurora-sep/(+34/-3).git diff --checkis clean;scripts/checkpatch.pl --no-signoffreports 0 errors and 0 warnings across 78 lines..github/workflows/sep-source.ymlplustest_sep_selinux_state.pypass under Rust 1.85.0 (test_sep_selinux_state.py14/14,test_packaging.py4/4,test_sep_writes_always_on.py22/22).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.shbuiltaurora-sep-1-14.fc45.noarch.rpm(66277bytes) andaurora-sep-selinux-1-14.fc45.noarch.rpm(25345bytes) fromorigin/main(6f05cf2940c5d), then builtaurora-sep-1-15.fc45.noarch.rpm(66612bytes),aurora-sep-selinux-1-15.fc45.noarch.rpm(25677bytes), andaurora-sep-1-15.fc45.src.rpm(92488bytes) from914a6baf4d77with 0 errors.rpm -qlp aurora-sep-1-15.fc45.noarch.rpmconfirms/usr/lib/systemd/logind.conf.d/05-aurora-sep.confis retained alongside all current package files, andrpm -qp --changelogshows1-15above Ryan's1-14entry.semodule -s targeted -N -iupgrade from1-14to1-15succeeded cleanly (400 aurora_sep pp) intopolicy.35.matchpathcon -f /etc/selinux/targeted/contexts/files/file_contextsmoved/var/lib/.apple-sep-catacomb-{master,owner,user}.bin.newfromsystem_u:object_r:var_lib_t:s0(1-14) tosystem_u:object_r:aurora_sep_state_t:s0(1-15), while canonical catacombs,aurora-sep-keybag.bin, and/dev/sep-biostayed unchanged.sesearchon/etc/selinux/targeted/policy/policy.35confirmed all 13type_transition kernel_t var_lib_t:file aurora_sep_state_trules (including the three.newnames).