packaging(systemd): add cgroup to RestrictNamespaces (closes #163)#184
Merged
Conversation
…oken Closes #163. Thanks to @mrvellang for catching the latent trap. RestrictNamespaces is an allowlist — anything not enumerated returns EPERM on unshare/clone. Two changes: 1. Add `cgroup` to the allowlist. Without it, the moment we wire up per-child cgroup-v2 namespaces (the natural next step for fork-out isolation), `unshare(CLONE_NEWCGROUP)` silently returns EPERM. As #163 notes, the kind of trap that costs an afternoon to debug. 2. Inline-comment each token (net / mnt / user / pid / cgroup) so a future well-intentioned hardening pass doesn't quietly remove one without noticing what it gates.
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.
Closes #163. Thanks @mrvellang for catching the latent trap.
`RestrictNamespaces` is an allowlist — anything not enumerated returns `EPERM` on `unshare`/`clone`. Two changes to `packaging/systemd/forkd-controller.service`:
Add `cgroup` to the allowlist. Without it, the moment we wire up per-child cgroup-v2 namespaces (the natural next step for fork-out isolation, and one we're sketching for v0.4 — see `DESIGN-v0.4-USER-API.md`), `unshare(CLONE_NEWCGROUP)` silently returns `EPERM` from inside the service. The kind of trap that costs an afternoon to debug, exactly as systemd unit:
RestrictNamespaces=net mnt user pidblockscgroupnamespace #163 warned.Inline-comment each token (net / mnt / user / pid / cgroup) explaining why it's there. The previous one-line directive made each token equally easy to remove on a future hardening pass; now a reviewer can see what gates what.
No behaviour change today — the controller doesn't yet `unshare(CLONE_NEWCGROUP)`. This unblocks future per-child cgroup namespacing without surfacing the EPERM at the worst moment.