opencontainers / opencontainers/runc
feature: PoC to mknod devices for user namespace containers
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 13.5k
- Forks
- 2.3k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 30
Description
The Usernamespace is GA in Kubernetes since 1.36. However, it does not support raw block devices.
If I understand correctly, the reason is that we can not call mknod in non initial user namespace that's why bind command is used instead.
However, there are some limitations:
- The device should already exist in the host with the same name.
- The device's characteristic is the same as host device. e.g. the owner uid and gid is from initial user namespace that's why we have nobody/nogroup in the device's description.
- The device should have permission for other users because host user and container user are not equal. Otherwise, we have Permission denied error. For this reason we can not pass device with 0660 permission.
There are some ways to solve these limitations:
- Allow to call mknod in the non initial user namespace. This is the restriction from Kernel.
- Add permission for other users to use the device. However, this is a security issue because all users will have the rights to use the device.
- Chown the parent device to map owner id to container's user namespace. However, we can not reuse the same device within several pods (they have diffirent user namespaces).
- Support idmap for devtmpfs. Now idmap is supported only for several filesystems.
- Call mknod in the initial user namespace and container's mount namespace to pass the device to the container.
For Poc the 5 option (call mknod instead of bind) was used because other solutions require Kernel changes.
Current PoC limitations are all about criu:
- The devices major/minor should be the same for checkpoint/restore.
- The user namespace info (host id, container id, length) should be the same for checkpoint/restore.
- Only simple mount scenarios are checked (e.g. not checked if user will mount container dev to some path).
I will be glad to hear some feedback :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the PoC's mknod approach for user-namespace containers and how it interacts with CRIU checkpoint/restore. Investigate the stated major/minor and user-namespace constraints, along with the untested mount scenarios. Done would require an agreed implementation scope and validation criteria, which the issue does not yet define.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, linux
- Domain
- infrastructure, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100