Skip to content

tools/aurora-sep: policy-change: don't crash where restorecon is missing - #1189

Merged
RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
jgoyvaerts:pr/aurora-sep-no-restorecon
Nov 8, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
jgoyvaerts:pr/aurora-sep-no-restorecon

Conversation

@jgoyvaerts

Copy link
Copy Markdown
Contributor

aurora-sep-policy-change crashes on distributions without SELinux, after it has already armed the allowance:

FileNotFoundError: [Errno 2] No such file or directory: 'restorecon'

arm() writes and fsyncs the one-boot allowance, then runs restorecon on it with check=False. check=False doesn't cover a missing program, so on Arch Linux ARM (whose package ships this tool) the user gets a traceback instead of "armed: … Reboot to finish." The allowance is in place and the reboot works, but the tool says it failed.

Change

Run restorecon only when shutil.which finds it. The Fedora spec also guards its own restorecon calls, with selinuxenabled. On Fedora nothing changes: shutil.which searches the same PATH that subprocess.run used.

Testing

  • New tests/test_policy_change.py arms an allowance with no restorecon on PATH. It fails on integration/aurora (FileNotFoundError) and passes with this change: python3 -m unittest discover -s tools/aurora-sep/tests -p test_policy_change.py -v.
  • J616s (T6040), Arch Linux ARM: the tool crashed this way after a boot policy change. The allowance it had armed was used on the next boot (xART guard: allowed one rewrite of kind-4 record … for a boot policy change), and Touch ID came back (Touch ID: restored 1 enrolled identity).

🤖 Generated with Claude Code

arm() writes the one-boot allowance, fsyncs it, and then relabels it
with restorecon, ignoring its exit status (check=False). On a
distribution without SELinux, such as Arch Linux ARM (the Arch package
ships this tool), there is no restorecon, so subprocess.run() raises
FileNotFoundError and the tool dies with a traceback after the
allowance is already in place. The reboot then works, but the user is
told the tool failed and never sees "Reboot to finish."

Relabel only when restorecon exists. The Fedora spec also guards its
own restorecon calls, with selinuxenabled.

tests/test_policy_change.py arms an allowance with no restorecon on
PATH. It fails before this change and passes after it.

Tested on a J616s (T6040, Arch Linux ARM). The allowance the old tool
armed before its crash was used on the next boot ("allowed one rewrite
of kind-4 record ..."), and Touch ID came back.

Fixes: ff7f73d ("tools/aurora-sep: keep Touch ID across a boot policy change, and never hold the boot for it")
Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide merged commit 8048b5c into aurora-silicon:integration/aurora Nov 8, 2026
3 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.

2 participants