You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Go 1.24] version >=v2.2 fails to create containers from images having /etc symlinked to an absolute path #13382
The openUserFile function in pkg/oci/spec_opts.go fails to resolve absolute symlinks on intermediate directory components when looking up /etc/passwd or /etc/group in a container's rootfs.
A previous fix (#12732, #12683, commit 85b5418) addressed the case where the target file itself (e.g., /etc/passwd) is an absolute symlink (common on NixOS, where /etc/passwd -> /nix/store/abcd/passwd). However, that fix only called ReadLink on the final path and did not walk intermediate directory components. This means rootfs layouts where an intermediate folder is a symlink — such as /etc -> /system/etc (common on Android emulator images) — are still broken. The openUserFile call fails with a "path escapes from parent" error or simply cannot find the file.
Steps to reproduce the issue
Create a container image with a rootfs where /etc is an absolute symlink to /system/etc:
Any operation that triggers user/group lookup (e.g., WithUser, WithUserID, WithUsername, WithAdditionalGIDs) will attempt to open etc/passwd via openUserFile.
Describe the results you received and expected
Received:openUserFile fails to open etc/passwd because it only checks whether etc/passwd itself is a symlink. Since etc/passwd is not a symlink (only etc is), the ReadLink call returns an error and the function falls through, returning the original "path escapes from parent" error.
Expected:openUserFile should resolve symlinks at every component of the path. When walking etc/passwd, it should detect that etc is a symlink to /system/etc, re-anchor it to system/etc relative to the rootfs, and then open system/etc/passwd successfully.
What version of containerd are you using?
2.2.x
Any other relevant information
No response
Show configuration if it is related to CRI plugin.
No response
Reacted by Nico Tonnhofer, nipr-jdoenges, Morgan Helton, maevii and jw-maynard
Activity
jasonjoo2010 commentedon Jun 23, 2026
Hi @fuweid
Saw you worked on previous relevant change for this bug, could you take a look for the following fix as well?
Thanks
jasonjoo2010 commentedon Aug 19, 2026
Hi @fuweid
Is there any merging window that we can expect? I saw the MR has been approved by 1 reviewer but still needs 1 more.
Thanks
fuweid commentedon Sep 3, 2026
Hi @jasonjoo2010 the change has been backported to 2.2 and 2.3. Please checkout the new releases (probably today). Thanks
jasonjoo2010 commentedon Sep 3, 2026
Awesome, that's great news! We will test it once it's released, thank you for walking through it, @fuweid !