Repository navigation
systemd: DetectUID: use $ROOTLESSKIT_PARENT_EUID if set - #88
Merged
Merged
Conversation
When running in a user namespace, DetectUID uses
`busctl --user status` to get the OwnerUID. This fails when /proc
is mounted with hidepid=2, as busctl can't read /proc/<pid> of the
bus peer. In such case runc (which uses DetectUID to decide whether
to use rootless cgroup manager) assumes the UID is 0, and so it fails
to start a container under RootlessKit with systemd cgroup driver:
unable to start unit "runc-xxx.scope" (properties [... {Name:Slice Value:"system.slice"} ...]): ... read unix @->/run/systemd/private: read: connection reset by peer
RootlessKit sets $ROOTLESSKIT_PARENT_EUID (documented since
RootlessKit v0.8.0) for its child process, so use it if set.
Fixes opencontainers/runc#3124.
Signed-off-by: Kir Kolyshkin <[email protected]>
AkihiroSuda
approved these changes
Oct 15, 2026
| if !userns.RunningInUserNS() { | ||
| return os.Getuid(), nil | ||
| } | ||
| // RootlessKit sets $ROOTLESSKIT_PARENT_EUID for its child process. |
Contributor
There was a problem hiding this comment.
is it possible to inject this into a container env or anything and spoof EUID in a way that can gain access to UID a user isn't allowed to?
Contributor
Author
There was a problem hiding this comment.
This is runc host environment (not the container one, unless you are talking about running runc inside a container). You can also modify DBUS_SESSION_BUS_ADDRESS or PATH (to execute a different busctl binary) and change the UID that way.
More importantly, though, is how the UID is used. I see two users:
dbus.AuthExternal(uid), the dbus daemon then verifies it against the peer credentials (SO_PEERCRED) of the socket, which come from the kernel. A wrong value just makes authentication fail.- in runc, this is called to check if a user is root or not. In case of a spoofed uid runc will go the rootful (vs rootless) cgroup manager and will fail (rootless basically allows to ignore an unavailable cgroup).
So, definitely not an issue.
haircommander
approved these changes
Nov 4, 2026
Maks1mS
pushed a commit
to stplr-dev/stplr
that referenced
this pull request
Nov 19, 2026
…(#524) This PR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [github.com/opencontainers/cgroups](https://github.com/opencontainers/cgroups) | require | patch | `v0.1.0` → `v0.1.1` | [](https://securityscorecards.dev/viewer/?uri=github.com/opencontainers/cgroups) | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information. --- ### Release Notes <details> <summary>opencontainers/cgroups (github.com/opencontainers/cgroups)</summary> ### [`v0.1.1`](https://github.com/opencontainers/cgroups/releases/tag/v0.1.1) [Compare Source](opencontainers/cgroups@v0.1.0...v0.1.1) This release concludes the removal of cilium/ebpf dependency started in v0.1.0 (it is only used by tests now), tightens the CI and release workflows (zizmor, actionlint, immutable tags), and adds a few fixes and enhancements to fs and systemd cgroup drivers. #### What's Changed - ci: use latest golangci-lint by [@​kolyshkin](https://github.com/kolyshkin) in [#​77](opencontainers/cgroups#77) - systemd: support zswap unified resources by [@​MKrupauskas](https://github.com/MKrupauskas) in [#​76](opencontainers/cgroups#76) - build(deps): bump github.com/cilium/ebpf from 0.17.3 to 0.22.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​80](opencontainers/cgroups#80) - build(deps): bump github.com/sirupsen/logrus to v1.10.2 by [@​kolyshkin](https://github.com/kolyshkin) in [#​81](opencontainers/cgroups#81) - systemd: use sync.WaitGroup.Go in TestParallelConnection by [@​kolyshkin](https://github.com/kolyshkin) in [#​82](opencontainers/cgroups#82) - systemd: fix jitter in dbus connection retry backoff by [@​hakman](https://github.com/hakman) in [#​85](opencontainers/cgroups#85) - fs: initialize subsystems lazily by [@​kolyshkin](https://github.com/kolyshkin) in [#​90](opencontainers/cgroups#90) - ci: add zizmor and actionlint, harden workflows by [@​kolyshkin](https://github.com/kolyshkin) in [#​83](opencontainers/cgroups#83) - fs: fix hugetlb tests by [@​kolyshkin](https://github.com/kolyshkin) in [#​87](opencontainers/cgroups#87) - fs2: support OwnerUID by [@​kolyshkin](https://github.com/kolyshkin) in [#​84](opencontainers/cgroups#84) - systemd: DetectUID: use $ROOTLESSKIT_PARENT_EUID if set by [@​kolyshkin](https://github.com/kolyshkin) in [#​88](opencontainers/cgroups#88) - Relax PR merge rules, enforce them via CI by [@​kolyshkin](https://github.com/kolyshkin) in [#​91](opencontainers/cgroups#91) - ci: re-pin kjanat/actionlint to the current v1.17 by [@​kolyshkin](https://github.com/kolyshkin) in [#​95](opencontainers/cgroups#95) - dependabot: fix ignore rule for review-policy.yml by [@​kolyshkin](https://github.com/kolyshkin) in [#​97](opencontainers/cgroups#97) - build(deps): bump zizmorcore/zizmor-action from 0.8.0 to 0.8.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​93](opencontainers/cgroups#93) - systemd: fix CPU quota overflow and unified cpu.max round-up by [@​kolyshkin](https://github.com/kolyshkin) in [#​79](opencontainers/cgroups#79) - devices: drop cilium/ebpf/asm dependency by [@​mfrw](https://github.com/mfrw) in [#​94](opencontainers/cgroups#94) - Skip cgroup tests when no cgroups are mounted by [@​kolyshkin](https://github.com/kolyshkin) in [#​99](opencontainers/cgroups#99) - systemd/v2: set MemorySwapMax=0 when disabling swap by [@​kolyshkin](https://github.com/kolyshkin) in [#​78](opencontainers/cgroups#78) #### New Contributors - [@​MKrupauskas](https://github.com/MKrupauskas) made their first contribution in [#​76](opencontainers/cgroups#76) - [@​hakman](https://github.com/hakman) made their first contribution in [#​85](opencontainers/cgroups#85) - [@​mfrw](https://github.com/mfrw) made their first contribution in [#​94](opencontainers/cgroups#94) **Full Changelog**: <opencontainers/cgroups@v0.1.0...v0.1.1> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`) - Only on Sunday and Saturday (`* * * * 0,6`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yNDEuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjI0MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://altlinux.space/stapler/stplr/pulls/524
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 running in a user namespace,
DetectUIDusesbusctl --user statusto get the OwnerUID. This fails when/procis mounted withhidepid=2, as busctl can't read/proc/<pid>of the bus peer. In such case runc (which usesDetectUIDto decide whether to use rootless cgroup manager) assumes the UID is 0, and so it fails to start a container under RootlessKit with systemd cgroup driver:RootlessKit sets
$ROOTLESSKIT_PARENT_EUID(documented since RootlessKit v0.8.0) for its child process, so use it if set.Tested manually on CentOS Stream 10 VM (
rootlesskit runc --systemd-cgroup runas a regular user, with/procremounted withhidepid=2): fails without this change, works with it.Fixes opencontainers/runc#3124.