Skip to content

kernel: enable idmapped mounts on overlayfs for sysbox#37

Open
kvinwang wants to merge 1 commit intomainfrom
fix/overlayfs-idmapped-mounts
Open

kernel: enable idmapped mounts on overlayfs for sysbox#37
kvinwang wants to merge 1 commit intomainfrom
fix/overlayfs-idmapped-mounts

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Mar 4, 2026

Summary

  • Add FS_ALLOW_IDMAP flag to overlayfs ovl_fs_type in the kernel, enabling mount_setattr(MOUNT_ATTR_IDMAP) on overlay mounts
  • This fixes sysbox container rootfs UID mapping: without this patch, sysbox's ID-mapped mount detection passes but the actual mount_setattr() call silently fails with EINVAL, causing image layer files to appear as nobody:nogroup inside containers

Root cause

Upstream Linux (including 6.9 and 6.17) has never set FS_ALLOW_IDMAP on overlayfs. A patch was submitted to LKML in Aug 2025 but has not been merged yet. Sysbox detects "Overlayfs on ID-mapped mounts supported: yes" (by testing a different operation — creating overlay with ID-mapped layers) but at runtime tries to ID-map the existing overlay mount, which requires FS_ALLOW_IDMAP.

Test plan

  • Verify mount_setattr(MOUNT_ATTR_IDMAP) succeeds on overlay mounts with the patched kernel
  • Verify sysbox containers show correct file ownership (not nobody:nogroup) for image layer files
  • Verify xrdp/web RDP works without manual certificate fixes after container restart

Upstream overlayfs is missing the FS_ALLOW_IDMAP flag on ovl_fs_type,
which causes mount_setattr(MOUNT_ATTR_IDMAP) to return -EINVAL on
overlay mounts. This prevents sysbox from applying transparent UID
shifting to the container rootfs, resulting in files from image layers
appearing as nobody:nogroup inside the container.

Add FS_ALLOW_IDMAP to the overlayfs file_system_type flags. This patch
has been submitted upstream (https://lkml.org/lkml/2025/8/15/1218) but
not yet merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant