Repository navigation
Conversation
The SELinux policy moves bootc into `install_t` when systemd executes it directly. A unit that starts bootc from a script or a shell runs it in `unconfined_service_t` or `initrc_t`, and bootc then re-executes a relabeled copy of itself from `$TMPDIR`. When `$TMPDIR` is mounted `noexec`, that fails with only `execve: Permission denied`, which names neither the cause nor a fix. The error now names the SELinux context bootc ran in, the copy it tried to execute, the likely cause, and both fixes: run bootc directly from `ExecStart=`, or add the transition that fedora-selinux/selinux-policy#3327 adds to the base policy. The `execve` error stays inside the message. bootc also writes the message to the journal at error priority, with `MESSAGE_ID=6ef49a449e1140d8835ada26ce80e0b9` and the context in `BOOTC_SELINUX_CONTEXT`. A wrapper script may discard bootc's stderr, and the fixed ID lets `journalctl MESSAGE_ID=...` find the entry. The entry goes through `journal_send` rather than `tracing`, as the boot journal entry does, so the ID lands in a standard `MESSAGE_ID` field. bootc-compatible-images(7) documents the requirement, the journal entry, and the fixes. Test 71 runs `bootc status` from a `bin_t` wrapper with a `noexec` `TMPDIR` and checks the error and the journal entry. The lsm unit tests pass, and clippy reports nothing in the changed files. The booted test has not run outside CI. Generated-by: AI Signed-off-by: Varun Iyer <viyer9@uic.edu>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a systemd unit starts bootc from a script or a shell, bootc runs in
unconfined_service_torinitrc_tand re-executes a relabeled copy of itself from$TMPDIR. On anoexec$TMPDIRthat fails with onlyexecve: Permission denied.This follows up on the review of #2692, which closed a lint for this case as too heuristic. Instead of guessing at build time, bootc now explains the failure when it happens:
ExecStart=, or add the transition from Allow initrc_t and unconfined_service_t to transition to install_t fedora-selinux/selinux-policy#3327. Theexecveerror stays in the message, so the assertion in tests: Verify a policy module lets wrapped bootc enter install_t #2689's test still matches.MESSAGE_ID=6ef49a449e1140d8835ada26ce80e0b9and the context inBOOTC_SELINUX_CONTEXT, since a wrapper script may discard bootc's stderr. It goes throughjournal_send, asbootc-log-bootdoes, so the ID lands in a standardMESSAGE_IDfield.journalctlquery and the fixes.bootc statusfrom abin_twrapper with anoexecTMPDIR, then checks the error and the journal entry.Tested: the
lsmunit tests pass, and clippy reports nothing in the changed files. The booted test has only been run by CI.Generated-by: AI
I reviewed it carefully.