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
..

libcontainer

Building with musl

In order to build with musl you must first remove the libseccomp dependency as it will reference shared libraries (libseccomp) which cannot be built with musl.

Do this by using adding flags to Cargo. Use the --no-default-features flag followed by -F and whatever features you intend to build with such as v2 as defined in Cargo.toml under features section.

Next you will also need the +nightly flags when building with rustup and cargo.

# Add rustup +nightly musl to toolchain
rustup +nightly target add $(uname -m)-unknown-linux-musl

# Build rustup +nightly stdlib with musl
rustup +nightly toolchain install nightly-$(uname -m)-unknown-linux-musl

# Build musl standard library
cargo +nightly build -Zbuild-std --target $(uname -m)-unknown-linux-musl --no-default-features -F v2

cargo +nightly build --target $(uname -m)-unknown-linux-musl --no-default-features -F v2