Skip to content

rbind,ro mount is read-only but not recursively #3320

@saku3

Description

@saku3

Part of runc compatibilities or bug

Description

When specifying rbind,ro as mount options, the mount itself should be read-only, but it is not expected to be applied recursively as read-only.

However, in youki, it becomes read-only recursively.

see also

https://github.com/opencontainers/runc/blob/main/tests/integration/mounts_recursive.bats#L34C18-L34C65

Steps to Reproduce

We create the mounts as a prerequisite setup.

TMP_DIR=$(mktemp -d)
TESTVOLUME="${TMP_DIR}/mounts_recursive"
sudo mount -t tmpfs none "${TESTVOLUME}"
mkdir -p ${TESTVOLUME}
sudo mount -t tmpfs none "${TESTVOLUME}"
echo "foo" > "${TESTVOLUME}/foo"
sudo mkdir -p "${TESTVOLUME}/subvol"
sudo mount -t tmpfs none "${TESTVOLUME}/subvol"
echo "bar" > "${TESTVOLUME}/subvol/bar"

setup config.json

configure mounts that use the pre-created mount as the source.

    {
      "destination": "/mnt",
      "source": "/tmp/tmp.E1PRXLfMTc/mounts_recursive",
      "options": [
        "rbind",
        "ro"
      ]
    }

run youki

youki run -b tutorial/ container

In a different terminal.

This behaves as expected.

$ youki exec a touch /mnt/foo
touch: /mnt/foo: Read-only file system

This is not expected to be read-only.

$ youki exec a touch /mnt/subvol/bar
touch: /mnt/subvol/bar: Read-only file system

Additional Context

There were some mount-related fixes in v0.5.7, but this behavior existed even before that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions