Repository navigation
libct: simplify setReadonly, fix losing rootfs flags - #5588
Merged
Merged
Conversation
setReadonly remounts / with MS_BIND|MS_REMOUNT|MS_RDONLY. A bind remount sets the per-mount flags to exactly the ones given, so when not in a user namespace it silently clears nosuid, nodev, noexec and nosymfollow which may be set on the rootfs mount. This does not happen in a user namespace, where these flags are locked, so the remount fails, and the fallback keeps them. The fix is to always use the existing flags, not only on fallback. In other words, the fallback is no longer needed. While at it - use statfsToMountFlags to convert, since ST_* and MS_* values may differ (e.g. ST_NOSYMFOLLOW != MS_NOSYMFOLLOW); - do not take other flags (e.g *ATIME*) as the kernel preserves those on remount. Add an integration test. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
requested review from
AkihiroSuda,
cyphar,
lifubang and
rata
and removed request for
lifubang
October 28, 2026 02:00
Contributor
Author
|
@opencontainers/runc-maintainers PTAL; this one is easy to review and fixes a real bug (for a change). I'd like to port it to 1.5 branch as well. |
Contributor
Author
|
@opencontainers/runc-maintainers this needs a second LGTM |
Contributor
Author
|
NB: backporting this to 1.5 requires #5590! |
Contributor
Author
|
This is a real bug fix; PTAL @opencontainers/runc-maintainers 🙏🏻 |
AkihiroSuda
approved these changes
Nov 1, 2026
AkihiroSuda
enabled auto-merge
November 1, 2026 07:10
Merged
via the queue into
opencontainers:main
with commit Nov 1, 2026
ff9a0c1
96 of 97 checks passed
This was referenced Nov 2, 2026
Maks1mS
pushed a commit
to stplr-dev/stplr
that referenced
this pull request
Nov 14, 2026
This PR contains the following updates: | Package | Type | Update | Change | OpenSSF | |---|---|---|---|---| | [github.com/opencontainers/runc](https://github.com/opencontainers/runc) | require | patch | `v1.5.2` → `v1.5.3` | [](https://securityscorecards.dev/viewer/?uri=github.com/opencontainers/runc) | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information. --- ### Release Notes <details> <summary>opencontainers/runc (github.com/opencontainers/runc)</summary> ### [`v1.5.3`](https://github.com/opencontainers/runc/releases/tag/v1.5.3): runc v1.5.3 -- "Let me hear you make decisions without your television." [Compare Source](opencontainers/runc@v1.5.2...v1.5.3) This is the third patch release in the 1.5.z release series of runc. It includes a fix for a high-severity vulnerability (CVE-2026-119101) affecting users who checkpoint and restore containers, as well as a few other fixes. Users are encouraged to update. ##### Security This release includes a fix for the following high-severity security issue: - [CVE-2026-119101][] allowed a malicious image, using crafted symlinks in its rootfs, to confuse the way runc names external mounts for CRIU, and so make `runc restore` bind-mount an arbitrary host directory into the restored container, read-write. Only users who both checkpoint and later restore containers running untrusted images are affected (checkpoint/restore requires root, so rootless runc is not affected). The same issue was found in crun ([CVE-2026-115520][]); CRIU itself is fixed in [CVE-2026-119614][]. In addition, `runc restore` no longer makes read-only bind mounts writable, even temporarily, while preparing the container mounts. [CVE-2026-119101]: GHSA-g2c3-j8g3-7gpw [CVE-2026-115520]: GHSA-2mxx-58qc-p466 [CVE-2026-119614]: GHSA-7ww7-53q2-wrwx ##### Fixed - Running a container which does not have its own mount namespace no longer changes the propagation of host's `/` and of the parent mount of the container rootfs (they were made private or slave). ([#​5537](opencontainers/runc#5537), [#​5581](opencontainers/runc#5581)) - When making the container rootfs read-only (`root.readonly`), runc no longer clears the `nosuid`, `nodev`, `noexec` and `nosymfollow` flags of the rootfs mount (this only happened when not using a user namespace). ([#​5588](opencontainers/runc#5588), [#​5601](opencontainers/runc#5601)) - The `defaults` mount option is no longer passed to the kernel as filesystem-specific mount data, which made mounting filesystems that do not accept it (such as `tmpfs`) fail. ([#​5500](opencontainers/runc#5500), [#​5520](opencontainers/runc#5520), [#​5602](opencontainers/runc#5602)) ##### Changed - Updated github.com/moby/sys/capability to v0.5.0. ([#​5598](opencontainers/runc#5598), [#​5600](opencontainers/runc#5600)) - Various CI improvements. ([#​5481](opencontainers/runc#5481), [#​5482](opencontainers/runc#5482), [#​5488](opencontainers/runc#5488), [#​5574](opencontainers/runc#5574), [#​5586](opencontainers/runc#5586), [#​5590](opencontainers/runc#5590), [#​5609](opencontainers/runc#5609), [#​5615](opencontainers/runc#5615)) ##### Static Linking Notices The `runc` binaries distributed with this release are *statically linked* with the following [GNU LGPL-2.1][lgpl-2.1] licensed libraries, with `runc` acting as a "work that uses the Library": [lgpl-2.1]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html - [libseccomp](https://github.com/seccomp/libseccomp) Similarly, the `runc` binaries distributed with this release are also *statically linked* with the following [MPLv2][mpl-2.0] licensed libraries, with `runc` acting as a "Larger Work": - [libpathrs](https://github.com/cyphar/libpathrs) [mpl-2.0]: https://www.mozilla.org/en-US/MPL/2.0/ The versions of these libraries were not modified from their upstream versions, but in order to comply with their corresponding licenses, we have attached the complete source code for those libraries which (when combined with the attached runc source code) may be used to exercise your rights under their respective licenses. However, we strongly suggest that you make use of your distribution's packages or download them from the authoritative upstream sources, especially since these libraries are related to the security of your containers. *** Thanks to the following contributors who made this release possible: - Kir Kolyshkin <kolyshkin@gmail.com> - Li Fu Bang <lifubang@acmcoder.com> - Lucas Sotomayor <sotomayorlucas@pm.me> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> </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:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMjMuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjIyMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://altlinux.space/stapler/stplr/pulls/522
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.
setReadonlyremounts/withMS_BIND|MS_REMOUNT|MS_RDONLY. A bind remount sets the per-mount flags to exactly the ones given, so when not in a user namespace it silently clears nosuid, nodev, noexec and nosymfollow which may be set on the rootfs mount.This does not happen in a user namespace, where these flags are locked, so the remount fails, and the fallback keeps them.
The fix is to always use the existing flags, not only on fallback. In other words, the fallback is no longer needed.
While at it
Add an integration test.