Skip to content

packaging: add initial SELinux policy and RPM hooks for smoo-gadget#15

Open
samcday wants to merge 1 commit intomainfrom
codex/github-mention-selinux
Open

packaging: add initial SELinux policy and RPM hooks for smoo-gadget#15
samcday wants to merge 1 commit intomainfrom
codex/github-mention-selinux

Conversation

@samcday
Copy link
Owner

@samcday samcday commented Feb 20, 2026

Motivation

  • SELinux denials during early boot/switchroot prevent smoo-gadget from initializing, so provide a minimal, scoped policy to unblock boot and enable iteration from AVC logs.

Description

  • Add packaging/selinux/smoo_gadget.te which defines smoo_gadget_t/smoo_gadget_exec_t and allows the current FunctionFS/configfs/ublk interactions the gadget needs.
  • Add packaging/selinux/smoo_gadget.fc to label /usr/bin/smoo-gadget so it transitions into the new domain at exec time.
  • Update smoo.spec to add SELinux build/runtime deps (checkpolicy, selinux-policy-devel, policycoreutils), build the module (smoo_gadget.pp) during %build, install the .pp into the gadget subpackage, and automatically install/remove the module in %post gadget / %postun gadget using semodule.

Testing

  • Ran cargo fmt --all -- --check and it succeeded.
  • Ran cargo check --workspace --locked and it completed successfully.
  • Ran cargo clippy --workspace and it completed successfully.
  • Attempted to expand the spec with rpmspec -P smoo.spec, but rpmspec is not available in this environment so that validation could not be performed here.

Codex Task

Add a permissive-but-scoped SELinux module for smoo-gadget covering FunctionFS, configfs, and ublk device/control interactions used during switchroot bring-up. Build the .pp in the RPM, install it in the gadget subpackage, and auto-install/remove it via %post/%postun hooks so SELinux-enabled systems can boot and iterate on tighter policy rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant