Skip to content

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

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test/cl919318335
May 22, 2026
Merged

Use raw unix.Mount for rootfs self-bind-mount#13240
copybara-service[bot] merged 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: 919484028
@copybara-service copybara-service Bot merged commit a7d0e52 into master May 22, 2026
0 of 2 checks passed
@copybara-service copybara-service Bot deleted the test/cl919318335 branch May 22, 2026 06:56
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