Files
Emilio PerssonandClaude Opus 5.5 78cdc04103 fix(libcontainer): mount overlays whose lowerdir exceeds 255 bytes (#3763)
* fix(libcontainer): mount overlays whose lowerdir exceeds 255 bytes

The fd-based mount flow passes each mount option to
fsconfig(FSCONFIG_SET_STRING). The kernel copies the value with
strndup_user(value, 256) and returns EINVAL for anything longer than
255 bytes (fs/fsopen.c). Podman's image volumes (`--mount type=image`)
are read-only overlay mounts whose lowerdir names two layers under the
storage root; for rootless Podman that value is typically close to
300 bytes, so the container fails with "failed to prepare rootfs".

When an overlay lowerdir value is too long for one fsconfig string,
pass the layers one at a time as "lowerdir+" (and "datadir+" after a
"::" separator), which overlayfs accepts since Linux 6.8. Shorter
values are passed unchanged.

Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(libcontainer): keep find_parent_mount's doc comment on it

The new helper was added between find_parent_mount and its doc comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>

* fix(libcontainer): fall back to mount(2) when fsconfig() fails

Instead of splitting a long overlay lowerdir into "lowerdir+" layers
(Linux 6.8+), fall back to the legacy mount(2) for a mount whose
fsconfig() fails: it takes a lowerdir over fsconfig's 255-byte limit
and options that older kernels' fsconfig() rejects. A tmpcopyup mount
keeps the error, since the copy-up needs the detached mount.

Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Signed-off-by: Emilio Persson <93738720+ItzExotical@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 15:54:30 +09:00
..