Skip to content

/sys mounted as read-write despite requesting read-only (regression in 1.29) #2178

Closed

Description

@dmytrobe

Hi, thank you for crun!

Comparing crun 1.28 and 1.29 with the same OCI bundle, I'm seeing /sys
mounted read-write on 1.29 even though the spec's /sys mount
(type: sysfs) requests "ro". 1.28 honours the ro request as expected.

It reproduces when the container has a user namespace but no network
namespace, and the spec also mounts /sys/fs/cgroup.

I put together a minimal, self-contained reproducer — no build step, just
downloads the official release binaries and compares them:
https://gist.github.com/dmytrobe/5e2427616397a92b1a7a164b844f25d4

Demonstration

$ ./repro.sh
crun 1.28       /sys = ro,nosuid,nodev,noexec,relatime   OK
crun 1.29       /sys = rw,nosuid,nodev,noexec,relatime   BUG: config.json asked for "ro"

config.json asks for /sys read-only; 1.29 mounts it writable.

Trigger

Three conditions, all required:

  1. a user namespace,
  2. no network namespace — such a userns cannot create a fresh sysfs, so
    mount("sysfs", ...) fails with EPERM and crun falls back to bind-mounting
    the host /sys, and
  3. a /sys/fs/cgroup mount in the spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions