Skip to content

Use raw unix.Mount for rootfs self-bind-mount#13240

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl919318335
Open

Use raw unix.Mount for rootfs self-bind-mount#13240
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl919318335

Conversation

@copybara-service
Copy link
Copy Markdown

Use raw unix.Mount for rootfs self-bind-mount

specutils.SafeMount intentionally fails if the target path contains
symlinks to prevent TOCTOU attacks on attacker-controlled paths.
However, spec.Root.Path is host-controlled (provisioned by the container
manager) and frequently contains legitimate host-level symlinks
(e.g., /var/run -> /run).

Since the rootfs path is trusted and not susceptible to payload
manipulation, using unix.Mount() directly prevents false-positive
mount failures while remaining secure.

This is what runc does as well in libcontainer/rootfs_linux.go:prepareRoot().

Fixes #13238

specutils.SafeMount intentionally fails if the target path contains
symlinks to prevent TOCTOU attacks on attacker-controlled paths.
However, spec.Root.Path is host-controlled (provisioned by the container
manager) and frequently contains legitimate host-level symlinks
(e.g., /var/run -> /run).

Since the rootfs path is trusted and not susceptible to payload
manipulation, using unix.Mount() directly prevents false-positive
mount failures while remaining secure.

This is what runc does as well in libcontainer/rootfs_linux.go:prepareRoot().

Fixes #13238

PiperOrigin-RevId: 919318335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release-20260520.0: runsc gofer fails rootfs self-bind when bundle path uses /var/run symlink to /run #13463

1 participant