Each namespace has an owning user namespace and now there is not way to discover these relationships. Understending namespaces relationships allows to answer the question: what capability does process X have to perform operations on a resource governed by namespace Y? After a long discussion, Eric W. Biederman proposed to use ioctl-s for this purpose. The NS_GET_USERNS ioctl returns a file descriptor to an owning user namespace. It returns EPERM if a target namespace is outside of a current user namespace. v2: rename parent to relative v3: Add a missing mntput when returning -EAGAIN --EWB
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -0,0 +1,11 @@ | ||
| 1 | +#ifndef __LINUX_NSFS_H | |
| 2 | +#define __LINUX_NSFS_H | |
| 3 | + | |
| 4 | +#include <linux/ioctl.h> | |
| 5 | + | |
| 6 | +#define NSIO 0xb7 | |
| 7 | + | |
| 8 | +/* Returns a file descriptor that refers to an owning user namespace */ | |
| 9 | +#define NS_GET_USERNS _IO(NSIO, 0x1) | |
| 10 | + | |
| 11 | +#endif /* __LINUX_NSFS_H */ | |