Open Epsilon314 opened 1 week ago
@Epsilon314 thanks for calling this out. Do you have example mounts so that we can include those cases in our tests while addressing this?
@elezar We encounter this issue when creating a docker in docker container:
/run/containerd
and /proc/cpuinfo
/proc/cpuinfo
are mounted before /run/containerd
, runc can see that /run/containerd
has submountpoint /run/containerd/xxx/rootfs/proc/cpuinfo
and runc will rbind
mount all submountpoints. In this case we failed to create the DIND container, since that extra submount will cause mounting proc
for DIND container to fail, restricted by the mnt_already_visible
check in kernel.Add a unit test case PR to explain the desired result.
@elezar We encounter this issue when creating a docker in docker container:
- Mount to container path
/run/containerd
and/proc/cpuinfo
- Create another DIND container in the first container. If
/proc/cpuinfo
are mounted before/run/containerd
, runc can see that/run/containerd
has submountpoint/run/containerd/xxx/rootfs/proc/cpuinfo
and runc willrbind
mount all submountpoints. In this case we failed to create the DIND container, since that extra submount will cause mountingproc
for DIND container to fail, restricted by themnt_already_visible
check in kernel.Add a unit test case PR to explain the desired result.
Okay, so was this a problem that was only reproducible in nested containers ? Because otherwise, in a normal non-nested case it should be guaranteed that equally long container paths (in terms of directory components in the path) cannot have mount ordering dependencies on each other, only longer paths can have on shorter ones, right ?
@klihub i think so
@Epsilon314 the PR looks good to me. Thanks.
One question is how to distribute this change. For clients such as the NVIDIA Container Toolkit that was mentioned, pulling in a new version of the CDI packages should not be a problem. Do we need to do anything specific for other clients where we may be consuming an older CDI package version? @klihub do you have thoughts on that?
@Epsilon314 the PR looks good to me. Thanks.
One question is how to distribute this change. For clients such as the NVIDIA Container Toolkit that was mentioned, pulling in a new version of the CDI packages should not be a problem. Do we need to do anything specific for other clients where we may be consuming an older CDI package version? @klihub do you have thoughts on that?
I think that if this only bites folks who run a runtime-in-a-runtime, usually DIND, then this probably has a direct effect on a marginally small set of people. So I wouldn't worry about it unless more bug reports about this start flowing in. IOW, I'd make this part of our 1.0 release, then update containerd 2.0, 1.7, and cri-o main and the latest two minor release series for a starter.
We got an unexpected change of the order of mounts after introducing cdi (indirectly through updating Nvidia container toolkit), which in specific cases lead to failed dind container creation. The change of mounts order is related to the way sortMounts works, as referred below: https://github.com/cncf-tags/container-device-interface/blob/main/pkg/cdi/container-edits.go#L358