Skip to content

libct: simplify setReadonly, fix losing rootfs flags - #5588

Merged
AkihiroSuda merged 1 commit into
opencontainers:mainfrom
kolyshkin:ro-rootfs-keep-flags
Nov 1, 2026
Merged

AkihiroSuda merged 1 commit into
opencontainers:mainfrom
kolyshkin:ro-rootfs-keep-flags

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

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.

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 kolyshkin added this to the 1.6.0-rc.2 milestone Oct 28, 2026
@kolyshkin kolyshkin added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Oct 28, 2026
@kolyshkin
kolyshkin requested review from AkihiroSuda, cyphar, lifubang and rata and removed request for lifubang October 28, 2026 02:00
@kolyshkin

Copy link
Copy Markdown
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.

@rata rata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kolyshkin kolyshkin changed the title libct: simplify setReadonly, keep rootfs flags libct: simplify setReadonly, fix losing rootfs flags Oct 28, 2026
@kolyshkin kolyshkin modified the milestones: 1.6.0-rc.2, 1.5.3 Oct 29, 2026
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@opencontainers/runc-maintainers this needs a second LGTM

@kolyshkin

Copy link
Copy Markdown
Contributor Author

NB: backporting this to 1.5 requires #5590!

@kolyshkin

Copy link
Copy Markdown
Contributor Author

This is a real bug fix; PTAL @opencontainers/runc-maintainers 🙏🏻

@AkihiroSuda
AkihiroSuda enabled auto-merge November 1, 2026 07:10
@AkihiroSuda
AkihiroSuda added this pull request to the merge queue Nov 1, 2026
Merged via the queue into opencontainers:main with commit ff9a0c1 Nov 1, 2026
96 of 97 checks passed
@kolyshkin kolyshkin added backport/1.5-done A PR in main branch which has been backported to release-1.5 and removed backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 labels Nov 3, 2026
@kolyshkin kolyshkin modified the milestones: 1.5.3, 1.6.0-rc.2 Nov 3, 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` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/opencontainers/runc/badge)](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). ([#&#8203;5537](opencontainers/runc#5537), [#&#8203;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). ([#&#8203;5588](opencontainers/runc#5588), [#&#8203;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. ([#&#8203;5500](opencontainers/runc#5500), [#&#8203;5520](opencontainers/runc#5520), [#&#8203;5602](opencontainers/runc#5602))

##### Changed

- Updated github.com/moby/sys/capability to v0.5.0. ([#&#8203;5598](opencontainers/runc#5598), [#&#8203;5600](opencontainers/runc#5600))
- Various CI improvements. ([#&#8203;5481](opencontainers/runc#5481), [#&#8203;5482](opencontainers/runc#5482), [#&#8203;5488](opencontainers/runc#5488), [#&#8203;5574](opencontainers/runc#5574), [#&#8203;5586](opencontainers/runc#5586), [#&#8203;5590](opencontainers/runc#5590), [#&#8203;5609](opencontainers/runc#5609),
  [#&#8203;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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.5-done A PR in main branch which has been backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants