]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/nsfs.c
mm: vmscan: move dirty pages out of the way until they're flushed
[karo-tx-linux.git] / fs / nsfs.c
index 8c9fb29c667327549737a6a9b6440d2564c7c710..1656843e87d2bef47b69d65b23c23946e8936f33 100644 (file)
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -7,6 +7,7 @@
 #include <linux/seq_file.h>
 #include <linux/user_namespace.h>
 #include <linux/nsfs.h>
+#include <linux/uaccess.h>
 
 static struct vfsmount *nsfs_mnt;
 
@@ -163,7 +164,10 @@ int open_related_ns(struct ns_common *ns,
 static long ns_ioctl(struct file *filp, unsigned int ioctl,
                        unsigned long arg)
 {
+       struct user_namespace *user_ns;
        struct ns_common *ns = get_proc_ns(file_inode(filp));
+       uid_t __user *argp;
+       uid_t uid;
 
        switch (ioctl) {
        case NS_GET_USERNS:
@@ -172,6 +176,15 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
                if (!ns->ops->get_parent)
                        return -EINVAL;
                return open_related_ns(ns, ns->ops->get_parent);
+       case NS_GET_NSTYPE:
+               return ns->ops->type;
+       case NS_GET_OWNER_UID:
+               if (ns->ops->type != CLONE_NEWUSER)
+                       return -EINVAL;
+               user_ns = container_of(ns, struct user_namespace, ns);
+               argp = (uid_t __user *) arg;
+               uid = from_kuid_munged(current_user_ns(), user_ns->owner);
+               return put_user(uid, argp);
        default:
                return -ENOTTY;
        }