[LSF/MM/BPF TOPIC] Namespace-aware upcalls from kernel filesystems
Shyam Prasad N <[email protected]>
| Newsgroups | org.kernel.vger.keyrings,org.kernel.vger.linux-cifs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-nfs |
|---|---|
| Message-ID | <CANT5p=rDxeYKXoCJoWRwGGXv4tPCM2OuX+US_G3hm_tL3UyqtA@mail.gmail.com> |
Kernel filesystems sometimes need to upcall to userspace to get some work done, which cannot be achieved in kernel code (or rather it is better to be done in userspace). Some examples are DNS resolutions, user authentication, ID mapping etc. Filesystems like SMB and NFS clients use the kernel keys subsystem for some of these, which has an upcall facility that can exec a binary in userspace. However, this upcall mechanism is not namespace aware and upcalls to the host namespaces (namespaces of the init process). This can be an inconvenience or a blocker for container services, which run most code from containers and do not like to host any binaries in the host namespace. They now need to host an upcall handler in the host namespace, which can switch to the appropriate namespaces based on the parameters sent before getting the work done. I tried to prototype a namespace aware upcall mechanism for kernel keys here: https://www.spinics.net/lists/keyrings/msg17581.html But it has not been successful so far. I'm seeking reviews on this approach from security point of view. Another option that I could think of is to host a device file in devfs. The mount could register with keys subsystem by keeping an FD open from inside a container. The keys subsystem could then upcall on the "right" FD based on some parameter supplied to it. Looking forward to hearing if there is a better approach to solving this problem. -- Regards, Shyam