-
Notifications
You must be signed in to change notification settings - Fork 2.3k
rootfs mount propagation cannot be restored to rslave after being made private in prepareRootfs #5192
Copy link
Copy link
Open
Description
Description
While testing mount propagation with runc, I noticed that rootfs propagation behaves incorrectly when the intended propagation is rslave.
During container setup, prepareRootfs() first changes the rootfs mount propagation to MS_PRIVATE | MS_REC, and after pivot_root, it attempts to restore the user-specified propagation.
Relevant code:
https://github.com/opencontainers/runc/blob/main/libcontainer/rootfs_linux.go#L1052
This works correctly when the intended propagation is rshared, but does not work for rslave.
Steps to reproduce the issue
- create a container with rootfsPropagation=rslave
1.1 nerdctl run -d --mount type=bind,src=/mnt,dst=/app,bind-propagation=rslave --entrypoint sleep600
1.2 verify container spec is rootfsPropagation=rslave
2. exec into container check if rootfs mount propagation is rslave
3. we expect to see the mount propagation is rslave which is rprivate
Describe the results you received and expected
we expect to see the mount propagation is rslave, which should be same if mount propagation is rshared
What version of runc are you using?
affect version from 1.3.1 to 1.5.1-rc
Host OS information
No response
Host kernel information
No response
Reactions are currently unavailable