linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [REVIEW][PATCH 00/25] userns: Trivial filesystem conversions
@ 2012-09-20 11:40 Eric W. Biederman
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
  0 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:40 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, Serge E. Hallyn


This continues my conversion of uid_t and gidt into kuid_t and kgid_t.
This time my target was all of the file systems that had an extremely
trivial conversion.

These patches are against:
git.kernel.org:/pub/scm/linux/kernel/git/ebiederm/user-namespace.git for-next

Which is against 3.6-rc1.

Once the review is complete I will push these patches to my for-next
branch, hopefully in time for 3.7.

Eric

Eric W. Biederman (25):
      userns: Convert fat to use kuid/kgid where appropriate
      userns: Convert gadgetfs to use kuid and kgid where appropriate
      userns: Convert usb functionfs to use kuid/kgid where appropriate
      userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
      userns: Convert hugetlbfs to use kuid/kgid where appropriate
      userns: Convert xenfs to use kuid and kgid where appropriate
      userns: Convert adfs to use kuid and kgid where appropriate
      userns: Convert befs to use kuid/kgid where appropriate
      userns: Convert cramfs to use kuid/kgid where appropriate
      userns: Convert ecryptfs to use kuid/kgid where appropriate
      userns: Convert efs to use kuid/kgid where appropriate
      userns: Convert exofs to use kuid/kgid where appropriate
      userns: Convert hfs to use kuid and kgid where appropriate
      userns: Convert hfsplus to use kuid and kgid where appropriate
      userns: Convert isofs to use kuid/kgid where appropriate
      userns: Convert logfs to use kuid/kgid where appropriate
      userns: Convert minix to use kuid/kgid where appropriate
      userns: Convert nillfs2 to use kuid/kgid where appropriate
      userns: Convert ntfs to use kuid and kgid where appropriate
      userns: Convert omfs to use kuid and kgid where appropriate
      userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
      userns: Convert the qnx6 filesystem to use kuid/kgid where appropriate
      userns: Convert the sysv filesystem to use kuid/kgid where appropriate
      userns: Convert freevxfs to use kuid/kgid where appropriate
      userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID

 drivers/base/devtmpfs.c            |    4 +-
 drivers/infiniband/hw/qib/qib_fs.c |    4 +-
 drivers/usb/gadget/f_fs.c          |   23 ++++++++++++++------
 drivers/usb/gadget/inode.c         |    4 +-
 drivers/xen/xenfs/super.c          |    3 +-
 fs/adfs/adfs.h                     |    4 +-
 fs/adfs/inode.c                    |    4 +-
 fs/adfs/super.c                    |   21 ++++++++++++-------
 fs/befs/befs.h                     |    4 +-
 fs/befs/linuxvfs.c                 |   27 +++++++++++++++++-------
 fs/cramfs/inode.c                  |    4 +-
 fs/ecryptfs/main.c                 |    5 ++-
 fs/ecryptfs/messaging.c            |    5 +--
 fs/efs/inode.c                     |    4 +-
 fs/exofs/inode.c                   |    8 +++---
 fs/fat/fat.h                       |    4 +-
 fs/fat/file.c                      |    6 ++--
 fs/fat/inode.c                     |   18 +++++++++++-----
 fs/freevxfs/vxfs_inode.c           |    4 +-
 fs/hfs/hfs_fs.h                    |    4 +-
 fs/hfs/inode.c                     |    4 +-
 fs/hfs/super.c                     |   16 ++++++++++++--
 fs/hfsplus/catalog.c               |    4 +-
 fs/hfsplus/hfsplus_fs.h            |    4 +-
 fs/hfsplus/inode.c                 |    8 +++---
 fs/hfsplus/options.c               |   15 +++++++++++--
 fs/hugetlbfs/inode.c               |   16 ++++++++++----
 fs/isofs/inode.c                   |   17 ++++++++++-----
 fs/isofs/isofs.h                   |    4 +-
 fs/isofs/rock.c                    |    4 +-
 fs/logfs/inode.c                   |    4 +-
 fs/logfs/readwrite.c               |    8 +++---
 fs/minix/inode.c                   |   16 +++++++-------
 fs/nilfs2/inode.c                  |    8 +++---
 fs/ntfs/inode.c                    |    7 +++--
 fs/ntfs/super.c                    |   39 +++++++++++++++++++++++++++++------
 fs/ntfs/volume.h                   |    5 ++-
 fs/omfs/inode.c                    |    8 +++++-
 fs/omfs/omfs.h                     |    4 +-
 fs/qnx4/inode.c                    |    4 +-
 fs/qnx6/inode.c                    |    4 +-
 fs/sysv/inode.c                    |    8 +++---
 init/Kconfig                       |   26 ------------------------
 43 files changed, 230 insertions(+), 163 deletions(-)

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
  2012-09-20 11:40 [REVIEW][PATCH 00/25] userns: Trivial filesystem conversions Eric W. Biederman
@ 2012-09-20 11:41 ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
                     ` (22 more replies)
  0 siblings, 23 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	OGAWA Hirofumi

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/fat/fat.h   |    4 ++--
 fs/fat/file.c  |    6 +++---
 fs/fat/inode.c |   18 ++++++++++++------
 init/Kconfig   |    1 -
 4 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 2deeeb8..7d8e0dc 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -23,8 +23,8 @@
 #define FAT_ERRORS_RO		3      /* remount r/o on error */
 
 struct fat_mount_options {
-	uid_t fs_uid;
-	gid_t fs_gid;
+	kuid_t fs_uid;
+	kgid_t fs_gid;
 	unsigned short fs_fmask;
 	unsigned short fs_dmask;
 	unsigned short codepage;  /* Codepage for shortname conversions */
diff --git a/fs/fat/file.c b/fs/fat/file.c
index e007b8b..a62e0ec 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -352,7 +352,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
 {
 	umode_t allow_utime = sbi->options.allow_utime;
 
-	if (current_fsuid() != inode->i_uid) {
+	if (!uid_eq(current_fsuid(), inode->i_uid)) {
 		if (in_group_p(inode->i_gid))
 			allow_utime >>= 3;
 		if (allow_utime & MAY_WRITE)
@@ -407,9 +407,9 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
 	}
 
 	if (((attr->ia_valid & ATTR_UID) &&
-	     (attr->ia_uid != sbi->options.fs_uid)) ||
+	     (!uid_eq(attr->ia_uid, sbi->options.fs_uid))) ||
 	    ((attr->ia_valid & ATTR_GID) &&
-	     (attr->ia_gid != sbi->options.fs_gid)) ||
+	     (!gid_eq(attr->ia_gid, sbi->options.fs_gid))) ||
 	    ((attr->ia_valid & ATTR_MODE) &&
 	     (attr->ia_mode & ~FAT_VALID_MODE)))
 		error = -EPERM;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 05e897f..47d9eb0 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -791,10 +791,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root)
 	struct fat_mount_options *opts = &sbi->options;
 	int isvfat = opts->isvfat;
 
-	if (opts->fs_uid != 0)
-		seq_printf(m, ",uid=%u", opts->fs_uid);
-	if (opts->fs_gid != 0)
-		seq_printf(m, ",gid=%u", opts->fs_gid);
+	if (!uid_eq(opts->fs_uid, GLOBAL_ROOT_UID))
+		seq_printf(m, ",uid=%u",
+				from_kuid_munged(&init_user_ns, opts->fs_uid));
+	if (!gid_eq(opts->fs_gid, GLOBAL_ROOT_GID))
+		seq_printf(m, ",gid=%u",
+				from_kgid_munged(&init_user_ns, opts->fs_gid));
 	seq_printf(m, ",fmask=%04o", opts->fs_fmask);
 	seq_printf(m, ",dmask=%04o", opts->fs_dmask);
 	if (opts->allow_utime)
@@ -1037,12 +1039,16 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
 		case Opt_uid:
 			if (match_int(&args[0], &option))
 				return 0;
-			opts->fs_uid = option;
+			opts->fs_uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(opts->fs_uid))
+				return 0;
 			break;
 		case Opt_gid:
 			if (match_int(&args[0], &option))
 				return 0;
-			opts->fs_gid = option;
+			opts->fs_gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(opts->fs_gid))
+				return 0;
 			break;
 		case Opt_umask:
 			if (match_octal(&args[0], &option))
diff --git a/init/Kconfig b/init/Kconfig
index 296d48b..60bdff2 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -952,7 +952,6 @@ config UIDGID_CONVERTED
 	depends on ECRYPT_FS = n
 	depends on EFS_FS = n
 	depends on EXOFS_FS = n
-	depends on FAT_FS = n
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
 	depends on HFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:58     ` Greg Kroah-Hartman
  2012-09-21  9:33     ` Felipe Balbi
  2012-09-20 11:41   ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
                     ` (21 subsequent siblings)
  22 siblings, 2 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Greg Kroah-Hartman, Felipe Balbi

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 drivers/usb/gadget/inode.c |    4 ++--
 init/Kconfig               |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index e58b164..7bd36c8 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1988,8 +1988,8 @@ gadgetfs_make_inode (struct super_block *sb,
 	if (inode) {
 		inode->i_ino = get_next_ino();
 		inode->i_mode = mode;
-		inode->i_uid = default_uid;
-		inode->i_gid = default_gid;
+		inode->i_uid = make_kuid(&init_user_ns, default_uid);
+		inode->i_gid = make_kgid(&init_user_ns, default_gid);
 		inode->i_atime = inode->i_mtime = inode->i_ctime
 				= CURRENT_TIME;
 		inode->i_private = data;
diff --git a/init/Kconfig b/init/Kconfig
index 60bdff2..633bde2 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -932,7 +932,6 @@ config UIDGID_CONVERTED
 	depends on NET_9P = n
 
 	# Filesystems
-	depends on USB_GADGETFS = n
 	depends on USB_FUNCTIONFS = n
 	depends on DEVTMPFS = n
 	depends on XENFS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:58     ` Greg Kroah-Hartman
  2012-09-21  9:32     ` Felipe Balbi
  2012-09-20 11:41   ` [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
                     ` (20 subsequent siblings)
  22 siblings, 2 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Greg Kroah-Hartman, Felipe Balbi

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 drivers/usb/gadget/f_fs.c |   23 ++++++++++++++++-------
 init/Kconfig              |    1 -
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 8adc79d..f9ee4e0 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -220,8 +220,8 @@ struct ffs_data {
 	/* File permissions, written once when fs is mounted */
 	struct ffs_file_perms {
 		umode_t				mode;
-		uid_t				uid;
-		gid_t				gid;
+		kuid_t				uid;
+		kgid_t				gid;
 	}				file_perms;
 
 	/*
@@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
 			break;
 
 		case 3:
-			if (!memcmp(opts, "uid", 3))
-				data->perms.uid = value;
+			if (!memcmp(opts, "uid", 3)) {
+				data->perms.uid = make_kuid(current_user_ns(), value);
+				if (!uid_valid(data->perms.uid)) {
+					pr_err("%s: unmapped value: %lu\n", opts, value);
+					return -EINVAL;
+				}
+			}
 			else if (!memcmp(opts, "gid", 3))
-				data->perms.gid = value;
+				data->perms.gid = make_kgid(current_user_ns(), value);
+				if (!gid_valid(data->perms.gid)) {
+					pr_err("%s: unmapped value: %lu\n", opts, value);
+					return -EINVAL;
+				}
 			else
 				goto invalid;
 			break;
@@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags,
 	struct ffs_sb_fill_data data = {
 		.perms = {
 			.mode = S_IFREG | 0600,
-			.uid = 0,
-			.gid = 0
+			.uid = GLOBAL_ROOT_UID,
+			.gid = GLOBAL_ROOT_GID,
 		},
 		.root_mode = S_IFDIR | 0500,
 	};
diff --git a/init/Kconfig b/init/Kconfig
index 633bde2..e7e0cc1 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -932,7 +932,6 @@ config UIDGID_CONVERTED
 	depends on NET_9P = n
 
 	# Filesystems
-	depends on USB_FUNCTIONFS = n
 	depends on DEVTMPFS = n
 	depends on XENFS = n
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:58     ` Greg Kroah-Hartman
  2012-09-20 11:41   ` [PATCH 05/25] userns: Convert hugetlbfs to use kuid/kgid where appropriate Eric W. Biederman
                     ` (19 subsequent siblings)
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Greg Kroah-Hartman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 drivers/base/devtmpfs.c |    4 ++--
 init/Kconfig            |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index deb4a45..147d1a4 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -309,8 +309,8 @@ static int handle_remove(const char *nodename, struct device *dev)
 			 * before unlinking this node, reset permissions
 			 * of possible references like hardlinks
 			 */
-			newattrs.ia_uid = 0;
-			newattrs.ia_gid = 0;
+			newattrs.ia_uid = GLOBAL_ROOT_UID;
+			newattrs.ia_gid = GLOBAL_ROOT_GID;
 			newattrs.ia_mode = stat.mode & ~0777;
 			newattrs.ia_valid =
 				ATTR_UID|ATTR_GID|ATTR_MODE;
diff --git a/init/Kconfig b/init/Kconfig
index e7e0cc1..96007af 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -932,7 +932,6 @@ config UIDGID_CONVERTED
 	depends on NET_9P = n
 
 	# Filesystems
-	depends on DEVTMPFS = n
 	depends on XENFS = n
 
 	depends on 9P_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 05/25] userns: Convert hugetlbfs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (2 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 06/25] userns: Convert xenfs to use kuid and kgid " Eric W. Biederman
                     ` (18 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	William Irwin

From: "Eric W. Biederman" <ebiederm@xmission.com>

Note sysctl_hugetlb_shm_group can only be written in the root user
in the initial user namespace, so we can assume sysctl_hugetlb_shm_group
is in the initial user namespace.

Cc: William Irwin <wli@holomorphy.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/hugetlbfs/inode.c |   16 +++++++++++-----
 init/Kconfig         |    1 -
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 8349a89..6e572c4 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -42,8 +42,8 @@ static const struct inode_operations hugetlbfs_dir_inode_operations;
 static const struct inode_operations hugetlbfs_inode_operations;
 
 struct hugetlbfs_config {
-	uid_t   uid;
-	gid_t   gid;
+	kuid_t   uid;
+	kgid_t   gid;
 	umode_t mode;
 	long	nr_blocks;
 	long	nr_inodes;
@@ -785,13 +785,17 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
 		case Opt_uid:
 			if (match_int(&args[0], &option))
  				goto bad_val;
-			pconfig->uid = option;
+			pconfig->uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(pconfig->uid))
+				goto bad_val;
 			break;
 
 		case Opt_gid:
 			if (match_int(&args[0], &option))
  				goto bad_val;
-			pconfig->gid = option;
+			pconfig->gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(pconfig->gid))
+				goto bad_val;
 			break;
 
 		case Opt_mode:
@@ -924,7 +928,9 @@ static struct vfsmount *hugetlbfs_vfsmount;
 
 static int can_do_hugetlb_shm(void)
 {
-	return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
+	kgid_t shm_group;
+	shm_group = make_kgid(&init_user_ns, sysctl_hugetlb_shm_group);
+	return capable(CAP_IPC_LOCK) || in_group_p(shm_group);
 }
 
 struct file *hugetlb_file_setup(const char *name, unsigned long addr,
diff --git a/init/Kconfig b/init/Kconfig
index 96007af..7ee6e19 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -954,7 +954,6 @@ config UIDGID_CONVERTED
 	depends on HFS_FS = n
 	depends on HFSPLUS_FS = n
 	depends on HPFS_FS = n
-	depends on HUGETLBFS = n
 	depends on ISO9660_FS = n
 	depends on JFFS2_FS = n
 	depends on JFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 06/25] userns: Convert xenfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (3 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 05/25] userns: Convert hugetlbfs to use kuid/kgid where appropriate Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 07/25] userns: Convert adfs " Eric W. Biederman
                     ` (17 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Ian Campbell, Konrad Rzeszutek Wilk

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 drivers/xen/xenfs/super.c |    3 ++-
 init/Kconfig              |    2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index a84b53c..459b9ac 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -30,7 +30,8 @@ static struct inode *xenfs_make_inode(struct super_block *sb, int mode)
 
 	if (ret) {
 		ret->i_mode = mode;
-		ret->i_uid = ret->i_gid = 0;
+		ret->i_uid = GLOBAL_ROOT_UID;
+		ret->i_gid = GLOBAL_ROOT_GID;
 		ret->i_blocks = 0;
 		ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
 	}
diff --git a/init/Kconfig b/init/Kconfig
index 7ee6e19..485c60a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -932,8 +932,6 @@ config UIDGID_CONVERTED
 	depends on NET_9P = n
 
 	# Filesystems
-	depends on XENFS = n
-
 	depends on 9P_FS = n
 	depends on ADFS_FS = n
 	depends on AFFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 07/25] userns: Convert adfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (4 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 06/25] userns: Convert xenfs to use kuid and kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 08/25] userns: Convert befs to use kuid/kgid " Eric W. Biederman
                     ` (16 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/adfs/adfs.h  |    4 ++--
 fs/adfs/inode.c |    4 ++--
 fs/adfs/super.c |   21 +++++++++++++--------
 init/Kconfig    |    1 -
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h
index 718ac1f..585adaf 100644
--- a/fs/adfs/adfs.h
+++ b/fs/adfs/adfs.h
@@ -46,8 +46,8 @@ struct adfs_sb_info {
 	struct adfs_discmap *s_map;	/* bh list containing map		 */
 	struct adfs_dir_ops *s_dir;	/* directory operations			 */
 
-	uid_t		s_uid;		/* owner uid				 */
-	gid_t		s_gid;		/* owner gid				 */
+	kuid_t		s_uid;		/* owner uid				 */
+	kgid_t		s_gid;		/* owner gid				 */
 	umode_t		s_owner_mask;	/* ADFS owner perm -> unix perm		 */
 	umode_t		s_other_mask;	/* ADFS other perm -> unix perm		 */
 	int		s_ftsuffix;	/* ,xyz hex filetype suffix option */
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 1dab6a1..e9bad50 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -304,8 +304,8 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
 	 * we can't change the UID or GID of any file -
 	 * we have a global UID/GID in the superblock
 	 */
-	if ((ia_valid & ATTR_UID && attr->ia_uid != ADFS_SB(sb)->s_uid) ||
-	    (ia_valid & ATTR_GID && attr->ia_gid != ADFS_SB(sb)->s_gid))
+	if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, ADFS_SB(sb)->s_uid)) ||
+	    (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, ADFS_SB(sb)->s_gid)))
 		error = -EPERM;
 
 	if (error)
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index bdaec92..22a0d7e 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -15,6 +15,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/statfs.h>
+#include <linux/user_namespace.h>
 #include "adfs.h"
 #include "dir_f.h"
 #include "dir_fplus.h"
@@ -130,10 +131,10 @@ static int adfs_show_options(struct seq_file *seq, struct dentry *root)
 {
 	struct adfs_sb_info *asb = ADFS_SB(root->d_sb);
 
-	if (asb->s_uid != 0)
-		seq_printf(seq, ",uid=%u", asb->s_uid);
-	if (asb->s_gid != 0)
-		seq_printf(seq, ",gid=%u", asb->s_gid);
+	if (!uid_eq(asb->s_uid, GLOBAL_ROOT_UID))
+		seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, asb->s_uid));
+	if (!gid_eq(asb->s_gid, GLOBAL_ROOT_GID))
+		seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, asb->s_gid));
 	if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK)
 		seq_printf(seq, ",ownmask=%o", asb->s_owner_mask);
 	if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK)
@@ -175,12 +176,16 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_uid:
 			if (match_int(args, &option))
 				return -EINVAL;
-			asb->s_uid = option;
+			asb->s_uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(asb->s_uid))
+				return -EINVAL;
 			break;
 		case Opt_gid:
 			if (match_int(args, &option))
 				return -EINVAL;
-			asb->s_gid = option;
+			asb->s_gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(asb->s_gid))
+				return -EINVAL;
 			break;
 		case Opt_ownmask:
 			if (match_octal(args, &option))
@@ -369,8 +374,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_fs_info = asb;
 
 	/* set default options */
-	asb->s_uid = 0;
-	asb->s_gid = 0;
+	asb->s_uid = GLOBAL_ROOT_UID;
+	asb->s_gid = GLOBAL_ROOT_GID;
 	asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK;
 	asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK;
 	asb->s_ftsuffix = 0;
diff --git a/init/Kconfig b/init/Kconfig
index 485c60a..20ddf0d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -933,7 +933,6 @@ config UIDGID_CONVERTED
 
 	# Filesystems
 	depends on 9P_FS = n
-	depends on ADFS_FS = n
 	depends on AFFS_FS = n
 	depends on AFS_FS = n
 	depends on AUTOFS4_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 08/25] userns: Convert befs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (5 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 07/25] userns: Convert adfs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 09/25] userns: Convert cramfs " Eric W. Biederman
                     ` (15 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/befs/befs.h     |    4 ++--
 fs/befs/linuxvfs.c |   27 +++++++++++++++++++--------
 init/Kconfig       |    1 -
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index d9a40ab..b266428 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -20,8 +20,8 @@ typedef u64 befs_blocknr_t;
  */
 
 typedef struct befs_mount_options {
-	gid_t gid;
-	uid_t uid;
+	kgid_t gid;
+	kuid_t uid;
 	int use_gid;
 	int use_uid;
 	int debug;
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index cf7f3c6..7f73a69 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -15,6 +15,7 @@
 #include <linux/vfs.h>
 #include <linux/parser.h>
 #include <linux/namei.h>
+#include <linux/sched.h>
 
 #include "befs.h"
 #include "btree.h"
@@ -352,9 +353,11 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
 	 */   
 
 	inode->i_uid = befs_sb->mount_opts.use_uid ?
-	    befs_sb->mount_opts.uid : (uid_t) fs32_to_cpu(sb, raw_inode->uid);
+		befs_sb->mount_opts.uid :
+		make_kuid(&init_user_ns, fs32_to_cpu(sb, raw_inode->uid));
 	inode->i_gid = befs_sb->mount_opts.use_gid ?
-	    befs_sb->mount_opts.gid : (gid_t) fs32_to_cpu(sb, raw_inode->gid);
+		befs_sb->mount_opts.gid :
+		make_kgid(&init_user_ns, fs32_to_cpu(sb, raw_inode->gid));
 
 	set_nlink(inode, 1);
 
@@ -674,10 +677,12 @@ parse_options(char *options, befs_mount_options * opts)
 	char *p;
 	substring_t args[MAX_OPT_ARGS];
 	int option;
+	kuid_t uid;
+	kgid_t gid;
 
 	/* Initialize options */
-	opts->uid = 0;
-	opts->gid = 0;
+	opts->uid = GLOBAL_ROOT_UID;
+	opts->gid = GLOBAL_ROOT_GID;
 	opts->use_uid = 0;
 	opts->use_gid = 0;
 	opts->iocharset = NULL;
@@ -696,23 +701,29 @@ parse_options(char *options, befs_mount_options * opts)
 		case Opt_uid:
 			if (match_int(&args[0], &option))
 				return 0;
-			if (option < 0) {
+			uid = INVALID_UID;
+			if (option >= 0)
+				uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(uid)) {
 				printk(KERN_ERR "BeFS: Invalid uid %d, "
 						"using default\n", option);
 				break;
 			}
-			opts->uid = option;
+			opts->uid = uid;
 			opts->use_uid = 1;
 			break;
 		case Opt_gid:
 			if (match_int(&args[0], &option))
 				return 0;
-			if (option < 0) {
+			gid = INVALID_GID;
+			if (option >= 0)
+				gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(gid)) {
 				printk(KERN_ERR "BeFS: Invalid gid %d, "
 						"using default\n", option);
 				break;
 			}
-			opts->gid = option;
+			opts->gid = gid;
 			opts->use_gid = 1;
 			break;
 		case Opt_charset:
diff --git a/init/Kconfig b/init/Kconfig
index 20ddf0d..d9bb344 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -936,7 +936,6 @@ config UIDGID_CONVERTED
 	depends on AFFS_FS = n
 	depends on AFS_FS = n
 	depends on AUTOFS4_FS = n
-	depends on BEFS_FS = n
 	depends on BFS_FS = n
 	depends on BTRFS_FS = n
 	depends on CEPH_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 09/25] userns: Convert cramfs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (6 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 08/25] userns: Convert befs to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 10/25] userns: Convert ecryptfs " Eric W. Biederman
                     ` (14 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/cramfs/inode.c |    4 ++--
 init/Kconfig      |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 28cca01..c6c3f91 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -90,8 +90,8 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
 	}
 
 	inode->i_mode = cramfs_inode->mode;
-	inode->i_uid = cramfs_inode->uid;
-	inode->i_gid = cramfs_inode->gid;
+	i_uid_write(inode, cramfs_inode->uid);
+	i_gid_write(inode, cramfs_inode->gid);
 
 	/* if the lower 2 bits are zero, the inode contains data */
 	if (!(inode->i_ino & 3)) {
diff --git a/init/Kconfig b/init/Kconfig
index d9bb344..5f846b5 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -941,7 +941,6 @@ config UIDGID_CONVERTED
 	depends on CEPH_FS = n
 	depends on CIFS = n
 	depends on CODA_FS = n
-	depends on CRAMFS = n
 	depends on ECRYPT_FS = n
 	depends on EFS_FS = n
 	depends on EXOFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 10/25] userns: Convert ecryptfs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (7 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 09/25] userns: Convert cramfs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 11/25] userns: Convert efs " Eric W. Biederman
                     ` (13 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Tyler Hicks, Dustin Kirkland

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/ecryptfs/main.c      |    5 +++--
 fs/ecryptfs/messaging.c |    5 ++---
 init/Kconfig            |    1 -
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 2768138..1d6ce91 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -544,11 +544,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
 		goto out_free;
 	}
 
-	if (check_ruid && path.dentry->d_inode->i_uid != current_uid()) {
+	if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) {
 		rc = -EPERM;
 		printk(KERN_ERR "Mount of device (uid: %d) not owned by "
 		       "requested user (uid: %d)\n",
-		       path.dentry->d_inode->i_uid, current_uid());
+			i_uid_read(path.dentry->d_inode),
+			from_kuid(&init_user_ns, current_uid()));
 		goto out_free;
 	}
 
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index b29bb8b..5fa2471 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -33,7 +33,7 @@ static struct hlist_head *ecryptfs_daemon_hash;
 struct mutex ecryptfs_daemon_hash_mux;
 static int ecryptfs_hash_bits;
 #define ecryptfs_current_euid_hash(uid) \
-		hash_long((unsigned long)current_euid(), ecryptfs_hash_bits)
+	hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits)
 
 static u32 ecryptfs_msg_counter;
 static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
@@ -121,8 +121,7 @@ int ecryptfs_find_daemon_by_euid(struct ecryptfs_daemon **daemon)
 	hlist_for_each_entry(*daemon, elem,
 			    &ecryptfs_daemon_hash[ecryptfs_current_euid_hash()],
 			    euid_chain) {
-		if ((*daemon)->file->f_cred->euid == current_euid() &&
-		    (*daemon)->file->f_cred->user_ns == current_user_ns()) {
+		if (uid_eq((*daemon)->file->f_cred->euid, current_euid())) {
 			rc = 0;
 			goto out;
 		}
diff --git a/init/Kconfig b/init/Kconfig
index 5f846b5..6120bae 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -941,7 +941,6 @@ config UIDGID_CONVERTED
 	depends on CEPH_FS = n
 	depends on CIFS = n
 	depends on CODA_FS = n
-	depends on ECRYPT_FS = n
 	depends on EFS_FS = n
 	depends on EXOFS_FS = n
 	depends on FUSE_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 11/25] userns: Convert efs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (8 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 10/25] userns: Convert ecryptfs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 12/25] userns: Convert exofs " Eric W. Biederman
                     ` (12 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/efs/inode.c |    4 ++--
 init/Kconfig   |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index bc84f36..f3913eb 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -97,8 +97,8 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
     
 	inode->i_mode  = be16_to_cpu(efs_inode->di_mode);
 	set_nlink(inode, be16_to_cpu(efs_inode->di_nlink));
-	inode->i_uid   = (uid_t)be16_to_cpu(efs_inode->di_uid);
-	inode->i_gid   = (gid_t)be16_to_cpu(efs_inode->di_gid);
+	i_uid_write(inode, (uid_t)be16_to_cpu(efs_inode->di_uid));
+	i_gid_write(inode, (gid_t)be16_to_cpu(efs_inode->di_gid));
 	inode->i_size  = be32_to_cpu(efs_inode->di_size);
 	inode->i_atime.tv_sec = be32_to_cpu(efs_inode->di_atime);
 	inode->i_mtime.tv_sec = be32_to_cpu(efs_inode->di_mtime);
diff --git a/init/Kconfig b/init/Kconfig
index 6120bae..51084b0 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -941,7 +941,6 @@ config UIDGID_CONVERTED
 	depends on CEPH_FS = n
 	depends on CIFS = n
 	depends on CODA_FS = n
-	depends on EFS_FS = n
 	depends on EXOFS_FS = n
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 12/25] userns: Convert exofs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (9 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 11/25] userns: Convert efs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 12:20     ` Boaz Harrosh
  2012-09-20 11:41   ` [PATCH 13/25] userns: Convert hfs to use kuid and kgid " Eric W. Biederman
                     ` (11 subsequent siblings)
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Boaz Harrosh, Benny Halevy

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Benny Halevy <bhalevy@tonian.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/exofs/inode.c |    8 ++++----
 init/Kconfig     |    1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 5badb0c..190c3d6 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1163,8 +1163,8 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
 
 	/* copy stuff from on-disk struct to in-memory struct */
 	inode->i_mode = le16_to_cpu(fcb.i_mode);
-	inode->i_uid = le32_to_cpu(fcb.i_uid);
-	inode->i_gid = le32_to_cpu(fcb.i_gid);
+	i_uid_write(inode, le32_to_cpu(fcb.i_uid));
+	i_gid_write(inode, le32_to_cpu(fcb.i_gid));
 	set_nlink(inode, le16_to_cpu(fcb.i_links_count));
 	inode->i_ctime.tv_sec = (signed)le32_to_cpu(fcb.i_ctime);
 	inode->i_atime.tv_sec = (signed)le32_to_cpu(fcb.i_atime);
@@ -1376,8 +1376,8 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
 	fcb = &args->fcb;
 
 	fcb->i_mode = cpu_to_le16(inode->i_mode);
-	fcb->i_uid = cpu_to_le32(inode->i_uid);
-	fcb->i_gid = cpu_to_le32(inode->i_gid);
+	fcb->i_uid = cpu_to_le32(i_uid_read(inode));
+	fcb->i_gid = cpu_to_le32(i_gid_read(inode));
 	fcb->i_links_count = cpu_to_le16(inode->i_nlink);
 	fcb->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
 	fcb->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
diff --git a/init/Kconfig b/init/Kconfig
index 51084b0..39e55d6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -941,7 +941,6 @@ config UIDGID_CONVERTED
 	depends on CEPH_FS = n
 	depends on CIFS = n
 	depends on CODA_FS = n
-	depends on EXOFS_FS = n
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
 	depends on HFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 13/25] userns: Convert hfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (10 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 12/25] userns: Convert exofs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 14/25] userns: Convert hfsplus " Eric W. Biederman
                     ` (10 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/hfs/hfs_fs.h |    4 ++--
 fs/hfs/inode.c  |    4 ++--
 fs/hfs/super.c  |   16 +++++++++++++---
 init/Kconfig    |    1 -
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 8275175..693df9f 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -134,8 +134,8 @@ struct hfs_sb_info {
 						   permissions on all files */
 	umode_t s_dir_umask;			/* The umask applied to the
 						   permissions on all dirs */
-	uid_t s_uid;				/* The uid of all files */
-	gid_t s_gid;				/* The gid of all files */
+	kuid_t s_uid;				/* The uid of all files */
+	kgid_t s_gid;				/* The gid of all files */
 
 	int session, part;
 	struct nls_table *nls_io, *nls_disk;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index ee1bc55..5d5c22d 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -594,9 +594,9 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
 
 	/* no uig/gid changes and limit which mode bits can be set */
 	if (((attr->ia_valid & ATTR_UID) &&
-	     (attr->ia_uid != hsb->s_uid)) ||
+	     (!uid_eq(attr->ia_uid, hsb->s_uid))) ||
 	    ((attr->ia_valid & ATTR_GID) &&
-	     (attr->ia_gid != hsb->s_gid)) ||
+	     (!gid_eq(attr->ia_gid, hsb->s_gid))) ||
 	    ((attr->ia_valid & ATTR_MODE) &&
 	     ((S_ISDIR(inode->i_mode) &&
 	       (attr->ia_mode != inode->i_mode)) ||
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 4eb873e..0b63d13 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -138,7 +138,9 @@ static int hfs_show_options(struct seq_file *seq, struct dentry *root)
 		seq_printf(seq, ",creator=%.4s", (char *)&sbi->s_creator);
 	if (sbi->s_type != cpu_to_be32(0x3f3f3f3f))
 		seq_printf(seq, ",type=%.4s", (char *)&sbi->s_type);
-	seq_printf(seq, ",uid=%u,gid=%u", sbi->s_uid, sbi->s_gid);
+	seq_printf(seq, ",uid=%u,gid=%u",
+			from_kuid_munged(&init_user_ns, sbi->s_uid),
+			from_kgid_munged(&init_user_ns, sbi->s_gid));
 	if (sbi->s_file_umask != 0133)
 		seq_printf(seq, ",file_umask=%o", sbi->s_file_umask);
 	if (sbi->s_dir_umask != 0022)
@@ -254,14 +256,22 @@ static int parse_options(char *options, struct hfs_sb_info *hsb)
 				printk(KERN_ERR "hfs: uid requires an argument\n");
 				return 0;
 			}
-			hsb->s_uid = (uid_t)tmp;
+			hsb->s_uid = make_kuid(current_user_ns(), (uid_t)tmp);
+			if (!uid_valid(hsb->s_uid)) {
+				printk(KERN_ERR "hfs: invalid uid %d\n", tmp);
+				return 0;
+			}
 			break;
 		case opt_gid:
 			if (match_int(&args[0], &tmp)) {
 				printk(KERN_ERR "hfs: gid requires an argument\n");
 				return 0;
 			}
-			hsb->s_gid = (gid_t)tmp;
+			hsb->s_gid = make_kgid(current_user_ns(), (gid_t)tmp);
+			if (!gid_valid(hsb->s_gid)) {
+				printk(KERN_ERR "hfs: invalid gid %d\n", tmp);
+				return 0;
+			}
 			break;
 		case opt_umask:
 			if (match_octal(&args[0], &tmp)) {
diff --git a/init/Kconfig b/init/Kconfig
index 39e55d6..6038d64 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -943,7 +943,6 @@ config UIDGID_CONVERTED
 	depends on CODA_FS = n
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
-	depends on HFS_FS = n
 	depends on HFSPLUS_FS = n
 	depends on HPFS_FS = n
 	depends on ISO9660_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 14/25] userns: Convert hfsplus to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (11 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 13/25] userns: Convert hfs to use kuid and kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 15/25] userns: Convert isofs to use kuid/kgid " Eric W. Biederman
                     ` (9 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/hfsplus/catalog.c    |    4 ++--
 fs/hfsplus/hfsplus_fs.h |    4 ++--
 fs/hfsplus/inode.c      |    8 ++++----
 fs/hfsplus/options.c    |   15 ++++++++++++---
 init/Kconfig            |    1 -
 5 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index ec2a9c2..798d9c4 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -80,8 +80,8 @@ void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms)
 
 	perms->userflags = HFSPLUS_I(inode)->userflags;
 	perms->mode = cpu_to_be16(inode->i_mode);
-	perms->owner = cpu_to_be32(inode->i_uid);
-	perms->group = cpu_to_be32(inode->i_gid);
+	perms->owner = cpu_to_be32(i_uid_read(inode));
+	perms->group = cpu_to_be32(i_gid_read(inode));
 
 	if (S_ISREG(inode->i_mode))
 		perms->dev = cpu_to_be32(inode->i_nlink);
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 558dbb4..c571de2 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -149,8 +149,8 @@ struct hfsplus_sb_info {
 	u32 type;
 
 	umode_t umask;
-	uid_t uid;
-	gid_t gid;
+	kuid_t uid;
+	kgid_t gid;
 
 	int part, session;
 	unsigned long flags;
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 3d8b4a6..2172aa5 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -233,12 +233,12 @@ static void hfsplus_get_perms(struct inode *inode,
 
 	mode = be16_to_cpu(perms->mode);
 
-	inode->i_uid = be32_to_cpu(perms->owner);
-	if (!inode->i_uid && !mode)
+	i_uid_write(inode, be32_to_cpu(perms->owner));
+	if (!i_uid_read(inode) && !mode)
 		inode->i_uid = sbi->uid;
 
-	inode->i_gid = be32_to_cpu(perms->group);
-	if (!inode->i_gid && !mode)
+	i_gid_write(inode, be32_to_cpu(perms->group));
+	if (!i_gid_read(inode) && !mode)
 		inode->i_gid = sbi->gid;
 
 	if (dir) {
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
index 06fa561..ed257c6 100644
--- a/fs/hfsplus/options.c
+++ b/fs/hfsplus/options.c
@@ -135,14 +135,22 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
 				printk(KERN_ERR "hfs: uid requires an argument\n");
 				return 0;
 			}
-			sbi->uid = (uid_t)tmp;
+			sbi->uid = make_kuid(current_user_ns(), (uid_t)tmp);
+			if (!uid_valid(sbi->uid)) {
+				printk(KERN_ERR "hfs: invalid uid specified\n");
+				return 0;
+			}
 			break;
 		case opt_gid:
 			if (match_int(&args[0], &tmp)) {
 				printk(KERN_ERR "hfs: gid requires an argument\n");
 				return 0;
 			}
-			sbi->gid = (gid_t)tmp;
+			sbi->gid = make_kgid(current_user_ns(), (gid_t)tmp);
+			if (!gid_valid(sbi->gid)) {
+				printk(KERN_ERR "hfs: invalid gid specified\n");
+				return 0;
+			}
 			break;
 		case opt_part:
 			if (match_int(&args[0], &sbi->part)) {
@@ -215,7 +223,8 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
 	if (sbi->type != HFSPLUS_DEF_CR_TYPE)
 		seq_printf(seq, ",type=%.4s", (char *)&sbi->type);
 	seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask,
-		sbi->uid, sbi->gid);
+			from_kuid_munged(&init_user_ns, sbi->uid),
+			from_kgid_munged(&init_user_ns, sbi->gid));
 	if (sbi->part >= 0)
 		seq_printf(seq, ",part=%u", sbi->part);
 	if (sbi->session >= 0)
diff --git a/init/Kconfig b/init/Kconfig
index 6038d64..9cf8cb1 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -943,7 +943,6 @@ config UIDGID_CONVERTED
 	depends on CODA_FS = n
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
-	depends on HFSPLUS_FS = n
 	depends on HPFS_FS = n
 	depends on ISO9660_FS = n
 	depends on JFFS2_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 15/25] userns: Convert isofs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (12 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 14/25] userns: Convert hfsplus " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 16/25] userns: Convert logfs " Eric W. Biederman
                     ` (8 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/isofs/inode.c |   17 +++++++++++------
 fs/isofs/isofs.h |    4 ++--
 fs/isofs/rock.c  |    4 ++--
 init/Kconfig     |    1 -
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 29037c3..a7d8e6c 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -21,6 +21,7 @@
 #include <linux/cdrom.h>
 #include <linux/parser.h>
 #include <linux/mpage.h>
+#include <linux/user_namespace.h>
 
 #include "isofs.h"
 #include "zisofs.h"
@@ -171,8 +172,8 @@ struct iso9660_options{
 	unsigned int blocksize;
 	umode_t fmode;
 	umode_t dmode;
-	gid_t gid;
-	uid_t uid;
+	kgid_t gid;
+	kuid_t uid;
 	char *iocharset;
 	/* LVE */
 	s32 session;
@@ -383,8 +384,8 @@ static int parse_options(char *options, struct iso9660_options *popt)
 	popt->fmode = popt->dmode = ISOFS_INVALID_MODE;
 	popt->uid_set = 0;
 	popt->gid_set = 0;
-	popt->gid = 0;
-	popt->uid = 0;
+	popt->gid = GLOBAL_ROOT_GID;
+	popt->uid = GLOBAL_ROOT_UID;
 	popt->iocharset = NULL;
 	popt->utf8 = 0;
 	popt->overriderockperm = 0;
@@ -460,13 +461,17 @@ static int parse_options(char *options, struct iso9660_options *popt)
 		case Opt_uid:
 			if (match_int(&args[0], &option))
 				return 0;
-			popt->uid = option;
+			popt->uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(popt->uid))
+				return 0;
 			popt->uid_set = 1;
 			break;
 		case Opt_gid:
 			if (match_int(&args[0], &option))
 				return 0;
-			popt->gid = option;
+			popt->gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(popt->gid))
+				return 0;
 			popt->gid_set = 1;
 			break;
 		case Opt_mode:
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 3620ad1..9916723 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -52,8 +52,8 @@ struct isofs_sb_info {
 
 	umode_t s_fmode;
 	umode_t s_dmode;
-	gid_t s_gid;
-	uid_t s_uid;
+	kgid_t s_gid;
+	kuid_t s_uid;
 	struct nls_table *s_nls_iocharset; /* Native language support table */
 };
 
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 70e79d0..c0bf424 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -364,8 +364,8 @@ repeat:
 		case SIG('P', 'X'):
 			inode->i_mode = isonum_733(rr->u.PX.mode);
 			set_nlink(inode, isonum_733(rr->u.PX.n_links));
-			inode->i_uid = isonum_733(rr->u.PX.uid);
-			inode->i_gid = isonum_733(rr->u.PX.gid);
+			i_uid_write(inode, isonum_733(rr->u.PX.uid));
+			i_gid_write(inode, isonum_733(rr->u.PX.gid));
 			break;
 		case SIG('P', 'N'):
 			{
diff --git a/init/Kconfig b/init/Kconfig
index 9cf8cb1..88f6571 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -944,7 +944,6 @@ config UIDGID_CONVERTED
 	depends on FUSE_FS = n
 	depends on GFS2_FS = n
 	depends on HPFS_FS = n
-	depends on ISO9660_FS = n
 	depends on JFFS2_FS = n
 	depends on JFS_FS = n
 	depends on LOGFS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 16/25] userns: Convert logfs to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (13 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 15/25] userns: Convert isofs to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 17/25] userns: Convert minix " Eric W. Biederman
                     ` (7 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Joern Engel, Prasad Joshi

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/logfs/inode.c     |    4 ++--
 fs/logfs/readwrite.c |    8 ++++----
 init/Kconfig         |    1 -
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index a422f42..43f61c2 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -192,8 +192,8 @@ static void logfs_init_inode(struct super_block *sb, struct inode *inode)
 	li->li_height	= 0;
 	li->li_used_bytes = 0;
 	li->li_block	= NULL;
-	inode->i_uid	= 0;
-	inode->i_gid	= 0;
+	i_uid_write(inode, 0);
+	i_gid_write(inode, 0);
 	inode->i_size	= 0;
 	inode->i_blocks	= 0;
 	inode->i_ctime	= CURRENT_TIME;
diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index f1cb512..a8d492d 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -119,8 +119,8 @@ static void logfs_disk_to_inode(struct logfs_disk_inode *di, struct inode*inode)
 	inode->i_mode	= be16_to_cpu(di->di_mode);
 	li->li_height	= di->di_height;
 	li->li_flags	= be32_to_cpu(di->di_flags);
-	inode->i_uid	= be32_to_cpu(di->di_uid);
-	inode->i_gid	= be32_to_cpu(di->di_gid);
+	i_uid_write(inode, be32_to_cpu(di->di_uid));
+	i_gid_write(inode, be32_to_cpu(di->di_gid));
 	inode->i_size	= be64_to_cpu(di->di_size);
 	logfs_set_blocks(inode, be64_to_cpu(di->di_used_bytes));
 	inode->i_atime	= be64_to_timespec(di->di_atime);
@@ -156,8 +156,8 @@ static void logfs_inode_to_disk(struct inode *inode, struct logfs_disk_inode*di)
 	di->di_height	= li->li_height;
 	di->di_pad	= 0;
 	di->di_flags	= cpu_to_be32(li->li_flags);
-	di->di_uid	= cpu_to_be32(inode->i_uid);
-	di->di_gid	= cpu_to_be32(inode->i_gid);
+	di->di_uid	= cpu_to_be32(i_uid_read(inode));
+	di->di_gid	= cpu_to_be32(i_gid_read(inode));
 	di->di_size	= cpu_to_be64(i_size_read(inode));
 	di->di_used_bytes = cpu_to_be64(li->li_used_bytes);
 	di->di_atime	= timespec_to_be64(inode->i_atime);
diff --git a/init/Kconfig b/init/Kconfig
index 88f6571..80edba8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -946,7 +946,6 @@ config UIDGID_CONVERTED
 	depends on HPFS_FS = n
 	depends on JFFS2_FS = n
 	depends on JFS_FS = n
-	depends on LOGFS = n
 	depends on MINIX_FS = n
 	depends on NCP_FS = n
 	depends on NFSD = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (14 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 16/25] userns: Convert logfs " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 11:41   ` [PATCH 18/25] userns: Convert nillfs2 " Eric W. Biederman
                     ` (6 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman

From: "Eric W. Biederman" <ebiederm@xmission.com>

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/minix/inode.c |   16 ++++++++--------
 init/Kconfig     |    1 -
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 2a503ad..d0e42c6 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -460,8 +460,8 @@ static struct inode *V1_minix_iget(struct inode *inode)
 		return ERR_PTR(-EIO);
 	}
 	inode->i_mode = raw_inode->i_mode;
-	inode->i_uid = (uid_t)raw_inode->i_uid;
-	inode->i_gid = (gid_t)raw_inode->i_gid;
+	i_uid_write(inode, raw_inode->i_uid);
+	i_gid_write(inode, raw_inode->i_gid);
 	set_nlink(inode, raw_inode->i_nlinks);
 	inode->i_size = raw_inode->i_size;
 	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = raw_inode->i_time;
@@ -493,8 +493,8 @@ static struct inode *V2_minix_iget(struct inode *inode)
 		return ERR_PTR(-EIO);
 	}
 	inode->i_mode = raw_inode->i_mode;
-	inode->i_uid = (uid_t)raw_inode->i_uid;
-	inode->i_gid = (gid_t)raw_inode->i_gid;
+	i_uid_write(inode, raw_inode->i_uid);
+	i_gid_write(inode, raw_inode->i_gid);
 	set_nlink(inode, raw_inode->i_nlinks);
 	inode->i_size = raw_inode->i_size;
 	inode->i_mtime.tv_sec = raw_inode->i_mtime;
@@ -545,8 +545,8 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
 	if (!raw_inode)
 		return NULL;
 	raw_inode->i_mode = inode->i_mode;
-	raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
-	raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
+	raw_inode->i_uid = fs_high2lowuid(i_uid_read(inode));
+	raw_inode->i_gid = fs_high2lowgid(i_gid_read(inode));
 	raw_inode->i_nlinks = inode->i_nlink;
 	raw_inode->i_size = inode->i_size;
 	raw_inode->i_time = inode->i_mtime.tv_sec;
@@ -572,8 +572,8 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
 	if (!raw_inode)
 		return NULL;
 	raw_inode->i_mode = inode->i_mode;
-	raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
-	raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
+	raw_inode->i_uid = fs_high2lowuid(i_uid_read(inode));
+	raw_inode->i_gid = fs_high2lowgid(i_gid_read(inode));
 	raw_inode->i_nlinks = inode->i_nlink;
 	raw_inode->i_size = inode->i_size;
 	raw_inode->i_mtime = inode->i_mtime.tv_sec;
diff --git a/init/Kconfig b/init/Kconfig
index 80edba8..c69e085 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -946,7 +946,6 @@ config UIDGID_CONVERTED
 	depends on HPFS_FS = n
 	depends on JFFS2_FS = n
 	depends on JFS_FS = n
-	depends on MINIX_FS = n
 	depends on NCP_FS = n
 	depends on NFSD = n
 	depends on NFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 18/25] userns: Convert nillfs2 to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (15 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 17/25] userns: Convert minix " Eric W. Biederman
@ 2012-09-20 11:41   ` Eric W. Biederman
  2012-09-20 14:34     ` Ryusuke Konishi
  2012-09-20 11:42   ` [PATCH 19/25] userns: Convert ntfs to use kuid and kgid " Eric W. Biederman
                     ` (5 subsequent siblings)
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:41 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	KONISHI Ryusuke

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/nilfs2/inode.c |    8 ++++----
 init/Kconfig      |    1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 6e2c3db..4d31d2c 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -401,8 +401,8 @@ int nilfs_read_inode_common(struct inode *inode,
 	int err;
 
 	inode->i_mode = le16_to_cpu(raw_inode->i_mode);
-	inode->i_uid = (uid_t)le32_to_cpu(raw_inode->i_uid);
-	inode->i_gid = (gid_t)le32_to_cpu(raw_inode->i_gid);
+	i_uid_write(inode, le32_to_cpu(raw_inode->i_uid));
+	i_gid_write(inode, le32_to_cpu(raw_inode->i_gid));
 	set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
 	inode->i_size = le64_to_cpu(raw_inode->i_size);
 	inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
@@ -590,8 +590,8 @@ void nilfs_write_inode_common(struct inode *inode,
 	struct nilfs_inode_info *ii = NILFS_I(inode);
 
 	raw_inode->i_mode = cpu_to_le16(inode->i_mode);
-	raw_inode->i_uid = cpu_to_le32(inode->i_uid);
-	raw_inode->i_gid = cpu_to_le32(inode->i_gid);
+	raw_inode->i_uid = cpu_to_le32(i_uid_read(inode));
+	raw_inode->i_gid = cpu_to_le32(i_gid_read(inode));
 	raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
 	raw_inode->i_size = cpu_to_le64(inode->i_size);
 	raw_inode->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
diff --git a/init/Kconfig b/init/Kconfig
index c69e085..90c9e06 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -949,7 +949,6 @@ config UIDGID_CONVERTED
 	depends on NCP_FS = n
 	depends on NFSD = n
 	depends on NFS_FS = n
-	depends on NILFS2_FS = n
 	depends on NTFS_FS = n
 	depends on OCFS2_FS = n
 	depends on OMFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 19/25] userns: Convert ntfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (16 preceding siblings ...)
  2012-09-20 11:41   ` [PATCH 18/25] userns: Convert nillfs2 " Eric W. Biederman
@ 2012-09-20 11:42   ` Eric W. Biederman
  2012-09-20 11:42   ` [PATCH 20/25] userns: Convert omfs " Eric W. Biederman
                     ` (4 subsequent siblings)
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Anton Altaparmakov

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Anton Altaparmakov <anton@tuxera.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/ntfs/inode.c  |    7 ++++---
 fs/ntfs/super.c  |   39 ++++++++++++++++++++++++++++++++-------
 fs/ntfs/volume.h |    5 +++--
 init/Kconfig     |    1 -
 4 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index c6dbd3d..1d27331 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2124,7 +2124,8 @@ int ntfs_read_inode_mount(struct inode *vi)
 			 * ntfs_read_inode() will have set up the default ones.
 			 */
 			/* Set uid and gid to root. */
-			vi->i_uid = vi->i_gid = 0;
+			vi->i_uid = GLOBAL_ROOT_UID;
+			vi->i_gid = GLOBAL_ROOT_GID;
 			/* Regular file. No access for anyone. */
 			vi->i_mode = S_IFREG;
 			/* No VFS initiated operations allowed for $MFT. */
@@ -2312,8 +2313,8 @@ int ntfs_show_options(struct seq_file *sf, struct dentry *root)
 	ntfs_volume *vol = NTFS_SB(root->d_sb);
 	int i;
 
-	seq_printf(sf, ",uid=%i", vol->uid);
-	seq_printf(sf, ",gid=%i", vol->gid);
+	seq_printf(sf, ",uid=%i", from_kuid_munged(&init_user_ns, vol->uid));
+	seq_printf(sf, ",gid=%i", from_kgid_munged(&init_user_ns, vol->gid));
 	if (vol->fmask == vol->dmask)
 		seq_printf(sf, ",umask=0%o", vol->fmask);
 	else {
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 2bc149d..da01c16 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -102,8 +102,8 @@ static bool parse_options(ntfs_volume *vol, char *opt)
 	char *p, *v, *ov;
 	static char *utf8 = "utf8";
 	int errors = 0, sloppy = 0;
-	uid_t uid = (uid_t)-1;
-	gid_t gid = (gid_t)-1;
+	kuid_t uid = INVALID_UID;
+	kgid_t gid = INVALID_GID;
 	umode_t fmask = (umode_t)-1, dmask = (umode_t)-1;
 	int mft_zone_multiplier = -1, on_errors = -1;
 	int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1;
@@ -128,6 +128,30 @@ static bool parse_options(ntfs_volume *vol, char *opt)
 		if (*v)							\
 			goto needs_val;					\
 	}
+#define NTFS_GETOPT_UID(option, variable)				\
+	if (!strcmp(p, option)) {					\
+		uid_t uid_value;					\
+		if (!v || !*v)						\
+			goto needs_arg;					\
+		uid_value = simple_strtoul(ov = v, &v, 0);		\
+		if (*v)							\
+			goto needs_val;					\
+		variable = make_kuid(current_user_ns(), uid_value);	\
+		if (!uid_valid(variable))				\
+			goto needs_val;					\
+	}
+#define NTFS_GETOPT_GID(option, variable)				\
+	if (!strcmp(p, option)) {					\
+		gid_t gid_value;					\
+		if (!v || !*v)						\
+			goto needs_arg;					\
+		gid_value = simple_strtoul(ov = v, &v, 0);		\
+		if (*v)							\
+			goto needs_val;					\
+		variable = make_kgid(current_user_ns(), gid_value);	\
+		if (!gid_valid(variable))				\
+			goto needs_val;					\
+	}
 #define NTFS_GETOPT_OCTAL(option, variable)				\
 	if (!strcmp(p, option)) {					\
 		if (!v || !*v)						\
@@ -165,8 +189,8 @@ static bool parse_options(ntfs_volume *vol, char *opt)
 	while ((p = strsep(&opt, ","))) {
 		if ((v = strchr(p, '=')))
 			*v++ = 0;
-		NTFS_GETOPT("uid", uid)
-		else NTFS_GETOPT("gid", gid)
+		NTFS_GETOPT_UID("uid", uid)
+		else NTFS_GETOPT_GID("gid", gid)
 		else NTFS_GETOPT_OCTAL("umask", fmask = dmask)
 		else NTFS_GETOPT_OCTAL("fmask", fmask)
 		else NTFS_GETOPT_OCTAL("dmask", dmask)
@@ -283,9 +307,9 @@ no_mount_options:
 		vol->on_errors = on_errors;
 	if (!vol->on_errors || vol->on_errors == ON_ERRORS_RECOVER)
 		vol->on_errors |= ON_ERRORS_CONTINUE;
-	if (uid != (uid_t)-1)
+	if (uid_valid(uid))
 		vol->uid = uid;
-	if (gid != (gid_t)-1)
+	if (gid_valid(gid))
 		vol->gid = gid;
 	if (fmask != (umode_t)-1)
 		vol->fmask = fmask;
@@ -1023,7 +1047,8 @@ static bool load_and_init_mft_mirror(ntfs_volume *vol)
 	 * ntfs_read_inode() will have set up the default ones.
 	 */
 	/* Set uid and gid to root. */
-	tmp_ino->i_uid = tmp_ino->i_gid = 0;
+	tmp_ino->i_uid = GLOBAL_ROOT_UID;
+	tmp_ino->i_gid = GLOBAL_ROOT_GID;
 	/* Regular file.  No access for anyone. */
 	tmp_ino->i_mode = S_IFREG;
 	/* No VFS initiated operations allowed for $MFTMirr. */
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h
index 15e3ba8..4f579b0 100644
--- a/fs/ntfs/volume.h
+++ b/fs/ntfs/volume.h
@@ -25,6 +25,7 @@
 #define _LINUX_NTFS_VOLUME_H
 
 #include <linux/rwsem.h>
+#include <linux/uidgid.h>
 
 #include "types.h"
 #include "layout.h"
@@ -46,8 +47,8 @@ typedef struct {
 					   sized blocks on the device. */
 	/* Configuration provided by user at mount time. */
 	unsigned long flags;		/* Miscellaneous flags, see below. */
-	uid_t uid;			/* uid that files will be mounted as. */
-	gid_t gid;			/* gid that files will be mounted as. */
+	kuid_t uid;			/* uid that files will be mounted as. */
+	kgid_t gid;			/* gid that files will be mounted as. */
 	umode_t fmask;			/* The mask for file permissions. */
 	umode_t dmask;			/* The mask for directory
 					   permissions. */
diff --git a/init/Kconfig b/init/Kconfig
index 90c9e06..0f65a02 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -949,7 +949,6 @@ config UIDGID_CONVERTED
 	depends on NCP_FS = n
 	depends on NFSD = n
 	depends on NFS_FS = n
-	depends on NTFS_FS = n
 	depends on OCFS2_FS = n
 	depends on OMFS_FS = n
 	depends on QNX4FS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (17 preceding siblings ...)
  2012-09-20 11:42   ` [PATCH 19/25] userns: Convert ntfs to use kuid and kgid " Eric W. Biederman
@ 2012-09-20 11:42   ` Eric W. Biederman
  2012-09-20 12:50     ` Bob Copeland
  2012-09-20 11:42   ` [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid " Eric W. Biederman
                     ` (3 subsequent siblings)
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Bob Copeland

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Bob Copeland <me@bobcopeland.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/omfs/inode.c |    8 ++++++--
 fs/omfs/omfs.h  |    4 ++--
 init/Kconfig    |    1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index e6213b3..25d715c 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -391,12 +391,16 @@ static int parse_options(char *options, struct omfs_sb_info *sbi)
 		case Opt_uid:
 			if (match_int(&args[0], &option))
 				return 0;
-			sbi->s_uid = option;
+			sbi->s_uid = make_kuid(current_user_ns(), option);
+			if (!uid_valid(sbi->s_uid))
+				return 0;
 			break;
 		case Opt_gid:
 			if (match_int(&args[0], &option))
 				return 0;
-			sbi->s_gid = option;
+			sbi->s_gid = make_kgid(current_user_ns(), option);
+			if (!gid_valid(sbi->s_gid))
+				return 0;
 			break;
 		case Opt_umask:
 			if (match_octal(&args[0], &option))
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h
index 8941f12..f0f8bc7 100644
--- a/fs/omfs/omfs.h
+++ b/fs/omfs/omfs.h
@@ -19,8 +19,8 @@ struct omfs_sb_info {
 	unsigned long **s_imap;
 	int s_imap_size;
 	struct mutex s_bitmap_lock;
-	int s_uid;
-	int s_gid;
+	kuid_t s_uid;
+	kgid_t s_gid;
 	int s_dmask;
 	int s_fmask;
 };
diff --git a/init/Kconfig b/init/Kconfig
index 0f65a02..390e629 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -950,7 +950,6 @@ config UIDGID_CONVERTED
 	depends on NFSD = n
 	depends on NFS_FS = n
 	depends on OCFS2_FS = n
-	depends on OMFS_FS = n
 	depends on QNX4FS_FS = n
 	depends on QNX6FS_FS = n
 	depends on REISERFS_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (18 preceding siblings ...)
  2012-09-20 11:42   ` [PATCH 20/25] userns: Convert omfs " Eric W. Biederman
@ 2012-09-20 11:42   ` Eric W. Biederman
  2012-09-20 12:34     ` Anders Larsen
  2012-09-20 11:42   ` [PATCH 22/25] userns: Convert the qnx6 " Eric W. Biederman
                     ` (2 subsequent siblings)
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Anders Larsen

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Anders Larsen <al@alarsen.net>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/qnx4/inode.c |    4 ++--
 init/Kconfig    |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 552e994..5c3c7b0 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -312,8 +312,8 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
 	    (ino % QNX4_INODES_PER_BLOCK);
 
 	inode->i_mode    = le16_to_cpu(raw_inode->di_mode);
-	inode->i_uid     = (uid_t)le16_to_cpu(raw_inode->di_uid);
-	inode->i_gid     = (gid_t)le16_to_cpu(raw_inode->di_gid);
+	i_uid_write(inode, (uid_t)le16_to_cpu(raw_inode->di_uid));
+	i_gid_write(inode, (gid_t)le16_to_cpu(raw_inode->di_gid));
 	set_nlink(inode, le16_to_cpu(raw_inode->di_nlink));
 	inode->i_size    = le32_to_cpu(raw_inode->di_size);
 	inode->i_mtime.tv_sec   = le32_to_cpu(raw_inode->di_mtime);
diff --git a/init/Kconfig b/init/Kconfig
index 390e629..b9d6be5 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -950,7 +950,6 @@ config UIDGID_CONVERTED
 	depends on NFSD = n
 	depends on NFS_FS = n
 	depends on OCFS2_FS = n
-	depends on QNX4FS_FS = n
 	depends on QNX6FS_FS = n
 	depends on REISERFS_FS = n
 	depends on SQUASHFS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 22/25] userns: Convert the qnx6 filesystem to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (19 preceding siblings ...)
  2012-09-20 11:42   ` [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 11:42   ` Eric W. Biederman
  2012-09-20 11:42   ` [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
  2012-09-20 11:55   ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate OGAWA Hirofumi
  22 siblings, 0 replies; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Kai Bankett

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Kai Bankett <chaosman@ontika.net>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 fs/qnx6/inode.c |    4 ++--
 init/Kconfig    |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 2049c81..f4eef0b 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -574,8 +574,8 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
 	raw_inode = ((struct qnx6_inode_entry *)page_address(page)) + offs;
 
 	inode->i_mode    = fs16_to_cpu(sbi, raw_inode->di_mode);
-	inode->i_uid     = (uid_t)fs32_to_cpu(sbi, raw_inode->di_uid);
-	inode->i_gid     = (gid_t)fs32_to_cpu(sbi, raw_inode->di_gid);
+	i_uid_write(inode, (uid_t)fs32_to_cpu(sbi, raw_inode->di_uid));
+	i_gid_write(inode, (gid_t)fs32_to_cpu(sbi, raw_inode->di_gid));
 	inode->i_size    = fs64_to_cpu(sbi, raw_inode->di_size);
 	inode->i_mtime.tv_sec   = fs32_to_cpu(sbi, raw_inode->di_mtime);
 	inode->i_mtime.tv_nsec = 0;
diff --git a/init/Kconfig b/init/Kconfig
index b9d6be5..1ff9f41 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -950,7 +950,6 @@ config UIDGID_CONVERTED
 	depends on NFSD = n
 	depends on NFS_FS = n
 	depends on OCFS2_FS = n
-	depends on QNX6FS_FS = n
 	depends on REISERFS_FS = n
 	depends on SQUASHFS = n
 	depends on SYSV_FS = n
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (20 preceding siblings ...)
  2012-09-20 11:42   ` [PATCH 22/25] userns: Convert the qnx6 " Eric W. Biederman
@ 2012-09-20 11:42   ` Eric W. Biederman
  2012-09-20 16:47     ` Marciniszyn, Mike
  2012-09-20 11:55   ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate OGAWA Hirofumi
  22 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 11:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, Eric W. Biederman,
	Mike Marciniszyn

From: "Eric W. Biederman" <ebiederm@xmission.com>

Cc: Mike Marciniszyn <infinipath@intel.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 drivers/infiniband/hw/qib/qib_fs.c |    4 ++--
 init/Kconfig                       |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index cff8a6c..65a2a23 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -61,8 +61,8 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
 
 	inode->i_ino = get_next_ino();
 	inode->i_mode = mode;
-	inode->i_uid = 0;
-	inode->i_gid = 0;
+	inode->i_uid = GLOBAL_ROOT_UID;
+	inode->i_gid = GLOBAL_ROOT_GID;
 	inode->i_blocks = 0;
 	inode->i_atime = CURRENT_TIME;
 	inode->i_mtime = inode->i_atime;
diff --git a/init/Kconfig b/init/Kconfig
index 355b1af..f0371a6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -960,7 +960,6 @@ config UIDGID_CONVERTED
 	depends on !UML || HOSTFS = n
 
 	# The rare drivers that won't build
-	depends on INFINIBAND_QIB = n
 	depends on BLK_DEV_LOOP = n
 	depends on ANDROID_BINDER_IPC = n
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
  2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
                     ` (21 preceding siblings ...)
  2012-09-20 11:42   ` [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
@ 2012-09-20 11:55   ` OGAWA Hirofumi
  2012-09-20 12:04     ` Eric W. Biederman
  22 siblings, 1 reply; 39+ messages in thread
From: OGAWA Hirofumi @ 2012-09-20 11:55 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

"Eric W. Biederman" <ebiederm@xmission.com> writes:

>  struct fat_mount_options {
> -	uid_t fs_uid;
> -	gid_t fs_gid;
> +	kuid_t fs_uid;
> +	kgid_t fs_gid;
>  	unsigned short fs_fmask;
>  	unsigned short fs_dmask;
>  	unsigned short codepage;  /* Codepage for shortname conversions */

I'm not reading this thread, so I may be wrong though. Doesn't this need
to initialize opts->fs_uid/fs_gid by GLOBAL_ROOT_UID/GID?

> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index e007b8b..a62e0ec 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -352,7 +352,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
>  {
>  	umode_t allow_utime = sbi->options.allow_utime;
>  
> -	if (current_fsuid() != inode->i_uid) {
> +	if (!uid_eq(current_fsuid(), inode->i_uid)) {
>  		if (in_group_p(inode->i_gid))
>  			allow_utime >>= 3;
>  		if (allow_utime & MAY_WRITE)
> @@ -407,9 +407,9 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
>  	}
>  
>  	if (((attr->ia_valid & ATTR_UID) &&
> -	     (attr->ia_uid != sbi->options.fs_uid)) ||
> +	     (!uid_eq(attr->ia_uid, sbi->options.fs_uid))) ||
>  	    ((attr->ia_valid & ATTR_GID) &&
> -	     (attr->ia_gid != sbi->options.fs_gid)) ||
> +	     (!gid_eq(attr->ia_gid, sbi->options.fs_gid))) ||
>  	    ((attr->ia_valid & ATTR_MODE) &&
>  	     (attr->ia_mode & ~FAT_VALID_MODE)))
>  		error = -EPERM;
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 05e897f..47d9eb0 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -791,10 +791,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root)
>  	struct fat_mount_options *opts = &sbi->options;
>  	int isvfat = opts->isvfat;
>  
> -	if (opts->fs_uid != 0)
> -		seq_printf(m, ",uid=%u", opts->fs_uid);
> -	if (opts->fs_gid != 0)
> -		seq_printf(m, ",gid=%u", opts->fs_gid);
> +	if (!uid_eq(opts->fs_uid, GLOBAL_ROOT_UID))
> +		seq_printf(m, ",uid=%u",
> +				from_kuid_munged(&init_user_ns, opts->fs_uid));
> +	if (!gid_eq(opts->fs_gid, GLOBAL_ROOT_GID))
> +		seq_printf(m, ",gid=%u",
> +				from_kgid_munged(&init_user_ns, opts->fs_gid));
>  	seq_printf(m, ",fmask=%04o", opts->fs_fmask);
>  	seq_printf(m, ",dmask=%04o", opts->fs_dmask);
>  	if (opts->allow_utime)
> @@ -1037,12 +1039,16 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
>  		case Opt_uid:
>  			if (match_int(&args[0], &option))
>  				return 0;
> -			opts->fs_uid = option;
> +			opts->fs_uid = make_kuid(current_user_ns(), option);
> +			if (!uid_valid(opts->fs_uid))
> +				return 0;
>  			break;
>  		case Opt_gid:
>  			if (match_int(&args[0], &option))
>  				return 0;
> -			opts->fs_gid = option;
> +			opts->fs_gid = make_kgid(current_user_ns(), option);
> +			if (!gid_valid(opts->fs_gid))
> +				return 0;
>  			break;
>  		case Opt_umask:
>  			if (match_octal(&args[0], &option))
> diff --git a/init/Kconfig b/init/Kconfig
> index 296d48b..60bdff2 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -952,7 +952,6 @@ config UIDGID_CONVERTED
>  	depends on ECRYPT_FS = n
>  	depends on EFS_FS = n
>  	depends on EXOFS_FS = n
> -	depends on FAT_FS = n
>  	depends on FUSE_FS = n
>  	depends on GFS2_FS = n
>  	depends on HFS_FS = n

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid where appropriate
  2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
@ 2012-09-20 11:58     ` Greg Kroah-Hartman
  2012-09-21  9:33     ` Felipe Balbi
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2012-09-20 11:58 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Felipe Balbi

On Thu, Sep 20, 2012 at 04:41:43AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Felipe Balbi <balbi@ti.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
  2012-09-20 11:41   ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 11:58     ` Greg Kroah-Hartman
  2012-09-21  9:32     ` Felipe Balbi
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2012-09-20 11:58 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Felipe Balbi

On Thu, Sep 20, 2012 at 04:41:44AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Felipe Balbi <balbi@ti.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
  2012-09-20 11:41   ` [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
@ 2012-09-20 11:58     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2012-09-20 11:58 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

On Thu, Sep 20, 2012 at 04:41:45AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
  2012-09-20 11:55   ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate OGAWA Hirofumi
@ 2012-09-20 12:04     ` Eric W. Biederman
  2012-09-20 12:28       ` OGAWA Hirofumi
  0 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 12:04 UTC (permalink / raw)
  To: OGAWA Hirofumi
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> "Eric W. Biederman" <ebiederm@xmission.com> writes:
>
>>  struct fat_mount_options {
>> -	uid_t fs_uid;
>> -	gid_t fs_gid;
>> +	kuid_t fs_uid;
>> +	kgid_t fs_gid;
>>  	unsigned short fs_fmask;
>>  	unsigned short fs_dmask;
>>  	unsigned short codepage;  /* Codepage for shortname conversions */
>
> I'm not reading this thread, so I may be wrong though. Doesn't this need
> to initialize opts->fs_uid/fs_gid by GLOBAL_ROOT_UID/GID?

Good question.

At the start of parse_options there is:

static int parse_options(struct super_block *sb, char *options, int is_vfat,
			 int silent, int *debug, struct fat_mount_options *opts)
{
	char *p;
	substring_t args[MAX_OPT_ARGS];
	int option;
	char *iocharset;

	opts->isvfat = is_vfat;

	opts->fs_uid = current_uid();
	opts->fs_gid = current_gid();

So there should be no problems with initialization.

Eric

>> diff --git a/fs/fat/file.c b/fs/fat/file.c
>> index e007b8b..a62e0ec 100644
>> --- a/fs/fat/file.c
>> +++ b/fs/fat/file.c
>> @@ -352,7 +352,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
>>  {
>>  	umode_t allow_utime = sbi->options.allow_utime;
>>  
>> -	if (current_fsuid() != inode->i_uid) {
>> +	if (!uid_eq(current_fsuid(), inode->i_uid)) {
>>  		if (in_group_p(inode->i_gid))
>>  			allow_utime >>= 3;
>>  		if (allow_utime & MAY_WRITE)
>> @@ -407,9 +407,9 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
>>  	}
>>  
>>  	if (((attr->ia_valid & ATTR_UID) &&
>> -	     (attr->ia_uid != sbi->options.fs_uid)) ||
>> +	     (!uid_eq(attr->ia_uid, sbi->options.fs_uid))) ||
>>  	    ((attr->ia_valid & ATTR_GID) &&
>> -	     (attr->ia_gid != sbi->options.fs_gid)) ||
>> +	     (!gid_eq(attr->ia_gid, sbi->options.fs_gid))) ||
>>  	    ((attr->ia_valid & ATTR_MODE) &&
>>  	     (attr->ia_mode & ~FAT_VALID_MODE)))
>>  		error = -EPERM;
>> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
>> index 05e897f..47d9eb0 100644
>> --- a/fs/fat/inode.c
>> +++ b/fs/fat/inode.c
>> @@ -791,10 +791,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root)
>>  	struct fat_mount_options *opts = &sbi->options;
>>  	int isvfat = opts->isvfat;
>>  
>> -	if (opts->fs_uid != 0)
>> -		seq_printf(m, ",uid=%u", opts->fs_uid);
>> -	if (opts->fs_gid != 0)
>> -		seq_printf(m, ",gid=%u", opts->fs_gid);
>> +	if (!uid_eq(opts->fs_uid, GLOBAL_ROOT_UID))
>> +		seq_printf(m, ",uid=%u",
>> +				from_kuid_munged(&init_user_ns, opts->fs_uid));
>> +	if (!gid_eq(opts->fs_gid, GLOBAL_ROOT_GID))
>> +		seq_printf(m, ",gid=%u",
>> +				from_kgid_munged(&init_user_ns, opts->fs_gid));
>>  	seq_printf(m, ",fmask=%04o", opts->fs_fmask);
>>  	seq_printf(m, ",dmask=%04o", opts->fs_dmask);
>>  	if (opts->allow_utime)
>> @@ -1037,12 +1039,16 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
>>  		case Opt_uid:
>>  			if (match_int(&args[0], &option))
>>  				return 0;
>> -			opts->fs_uid = option;
>> +			opts->fs_uid = make_kuid(current_user_ns(), option);
>> +			if (!uid_valid(opts->fs_uid))
>> +				return 0;
>>  			break;
>>  		case Opt_gid:
>>  			if (match_int(&args[0], &option))
>>  				return 0;
>> -			opts->fs_gid = option;
>> +			opts->fs_gid = make_kgid(current_user_ns(), option);
>> +			if (!gid_valid(opts->fs_gid))
>> +				return 0;
>>  			break;
>>  		case Opt_umask:
>>  			if (match_octal(&args[0], &option))
>> diff --git a/init/Kconfig b/init/Kconfig
>> index 296d48b..60bdff2 100644
>> --- a/init/Kconfig
>> +++ b/init/Kconfig
>> @@ -952,7 +952,6 @@ config UIDGID_CONVERTED
>>  	depends on ECRYPT_FS = n
>>  	depends on EFS_FS = n
>>  	depends on EXOFS_FS = n
>> -	depends on FAT_FS = n
>>  	depends on FUSE_FS = n
>>  	depends on GFS2_FS = n
>>  	depends on HFS_FS = n

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 12/25] userns: Convert exofs to use kuid/kgid where appropriate
  2012-09-20 11:41   ` [PATCH 12/25] userns: Convert exofs " Eric W. Biederman
@ 2012-09-20 12:20     ` Boaz Harrosh
  0 siblings, 0 replies; 39+ messages in thread
From: Boaz Harrosh @ 2012-09-20 12:20 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Benny Halevy

On 09/20/2012 02:41 PM, Eric W. Biederman wrote:

> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Boaz Harrosh <bharrosh@panasas.com>
> Cc: Benny Halevy <bhalevy@tonian.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>


Acked-by: Boaz Harrosh <bharrosh@panasas.com>

> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
>  fs/exofs/inode.c |    8 ++++----
>  init/Kconfig     |    1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
> index 5badb0c..190c3d6 100644
> --- a/fs/exofs/inode.c
> +++ b/fs/exofs/inode.c
> @@ -1163,8 +1163,8 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
>  
>  	/* copy stuff from on-disk struct to in-memory struct */
>  	inode->i_mode = le16_to_cpu(fcb.i_mode);
> -	inode->i_uid = le32_to_cpu(fcb.i_uid);
> -	inode->i_gid = le32_to_cpu(fcb.i_gid);
> +	i_uid_write(inode, le32_to_cpu(fcb.i_uid));
> +	i_gid_write(inode, le32_to_cpu(fcb.i_gid));
>  	set_nlink(inode, le16_to_cpu(fcb.i_links_count));
>  	inode->i_ctime.tv_sec = (signed)le32_to_cpu(fcb.i_ctime);
>  	inode->i_atime.tv_sec = (signed)le32_to_cpu(fcb.i_atime);
> @@ -1376,8 +1376,8 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
>  	fcb = &args->fcb;
>  
>  	fcb->i_mode = cpu_to_le16(inode->i_mode);
> -	fcb->i_uid = cpu_to_le32(inode->i_uid);
> -	fcb->i_gid = cpu_to_le32(inode->i_gid);
> +	fcb->i_uid = cpu_to_le32(i_uid_read(inode));
> +	fcb->i_gid = cpu_to_le32(i_gid_read(inode));
>  	fcb->i_links_count = cpu_to_le16(inode->i_nlink);
>  	fcb->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
>  	fcb->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
> diff --git a/init/Kconfig b/init/Kconfig
> index 51084b0..39e55d6 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -941,7 +941,6 @@ config UIDGID_CONVERTED
>  	depends on CEPH_FS = n
>  	depends on CIFS = n
>  	depends on CODA_FS = n
> -	depends on EXOFS_FS = n
>  	depends on FUSE_FS = n
>  	depends on GFS2_FS = n
>  	depends on HFS_FS = n



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
  2012-09-20 12:04     ` Eric W. Biederman
@ 2012-09-20 12:28       ` OGAWA Hirofumi
  0 siblings, 0 replies; 39+ messages in thread
From: OGAWA Hirofumi @ 2012-09-20 12:28 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

ebiederm@xmission.com (Eric W. Biederman) writes:

>> I'm not reading this thread, so I may be wrong though. Doesn't this need
>> to initialize opts->fs_uid/fs_gid by GLOBAL_ROOT_UID/GID?
>
> Good question.
>
> At the start of parse_options there is:
>
> static int parse_options(struct super_block *sb, char *options, int is_vfat,
> 			 int silent, int *debug, struct fat_mount_options *opts)
> {
> 	char *p;
> 	substring_t args[MAX_OPT_ARGS];
> 	int option;
> 	char *iocharset;
>
> 	opts->isvfat = is_vfat;
>
> 	opts->fs_uid = current_uid();
> 	opts->fs_gid = current_gid();
>
> So there should be no problems with initialization.

I see.

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
  2012-09-20 11:42   ` [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid " Eric W. Biederman
@ 2012-09-20 12:34     ` Anders Larsen
  0 siblings, 0 replies; 39+ messages in thread
From: Anders Larsen @ 2012-09-20 12:34 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Eric W. Biederman

On 2012-09-20 13:42:02, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Anders Larsen <al@alarsen.net>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Anders Larsen <al@alarsen.net>

> ---
>  fs/qnx4/inode.c |    4 ++--
>  init/Kconfig    |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
> index 552e994..5c3c7b0 100644
> --- a/fs/qnx4/inode.c
> +++ b/fs/qnx4/inode.c
> @@ -312,8 +312,8 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
>  	    (ino % QNX4_INODES_PER_BLOCK);
>  
>  	inode->i_mode    = le16_to_cpu(raw_inode->di_mode);
> -	inode->i_uid     = (uid_t)le16_to_cpu(raw_inode->di_uid);
> -	inode->i_gid     = (gid_t)le16_to_cpu(raw_inode->di_gid);
> +	i_uid_write(inode, (uid_t)le16_to_cpu(raw_inode->di_uid));
> +	i_gid_write(inode, (gid_t)le16_to_cpu(raw_inode->di_gid));
>  	set_nlink(inode, le16_to_cpu(raw_inode->di_nlink));
>  	inode->i_size    = le32_to_cpu(raw_inode->di_size);
>  	inode->i_mtime.tv_sec   = le32_to_cpu(raw_inode->di_mtime);
> diff --git a/init/Kconfig b/init/Kconfig
> index 390e629..b9d6be5 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -950,7 +950,6 @@ config UIDGID_CONVERTED
>  	depends on NFSD = n
>  	depends on NFS_FS = n
>  	depends on OCFS2_FS = n
> -	depends on QNX4FS_FS = n
>  	depends on QNX6FS_FS = n
>  	depends on REISERFS_FS = n
>  	depends on SQUASHFS = n
> -- 
> 1.7.5.4


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
  2012-09-20 11:42   ` [PATCH 20/25] userns: Convert omfs " Eric W. Biederman
@ 2012-09-20 12:50     ` Bob Copeland
  2012-09-20 13:13       ` Eric W. Biederman
  0 siblings, 1 reply; 39+ messages in thread
From: Bob Copeland @ 2012-09-20 12:50 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

On Thu, Sep 20, 2012 at 04:42:01AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Bob Copeland <me@bobcopeland.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Thanks, looks good to me.

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
  2012-09-20 12:50     ` Bob Copeland
@ 2012-09-20 13:13       ` Eric W. Biederman
  2012-09-20 13:19         ` Bob Copeland
  0 siblings, 1 reply; 39+ messages in thread
From: Eric W. Biederman @ 2012-09-20 13:13 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

Bob Copeland <me@bobcopeland.com> writes:

> On Thu, Sep 20, 2012 at 04:42:01AM -0700, Eric W. Biederman wrote:
>> From: "Eric W. Biederman" <ebiederm@xmission.com>
>> 
>> Cc: Bob Copeland <me@bobcopeland.com>
>> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
>> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
>
> Thanks, looks good to me.

Then I will take that as an Acked-by. ;)

Eric


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
  2012-09-20 13:13       ` Eric W. Biederman
@ 2012-09-20 13:19         ` Bob Copeland
  0 siblings, 0 replies; 39+ messages in thread
From: Bob Copeland @ 2012-09-20 13:19 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

On Thu, Sep 20, 2012 at 06:13:52AM -0700, Eric W. Biederman wrote:
> Bob Copeland <me@bobcopeland.com> writes:
> 
> > On Thu, Sep 20, 2012 at 04:42:01AM -0700, Eric W. Biederman wrote:
> >> From: "Eric W. Biederman" <ebiederm@xmission.com>
> >> 
> >> Cc: Bob Copeland <me@bobcopeland.com>
> >> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> >> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> >
> > Thanks, looks good to me.
> 
> Then I will take that as an Acked-by. ;)

Sure, or here's one you can copy :)

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 18/25] userns: Convert nillfs2 to use kuid/kgid where appropriate
  2012-09-20 11:41   ` [PATCH 18/25] userns: Convert nillfs2 " Eric W. Biederman
@ 2012-09-20 14:34     ` Ryusuke Konishi
  0 siblings, 0 replies; 39+ messages in thread
From: Ryusuke Konishi @ 2012-09-20 14:34 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers

On Thu, 20 Sep 2012 04:41:59 -0700, "Eric W. Biederman" wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
>  fs/nilfs2/inode.c |    8 ++++----
>  init/Kconfig      |    1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)

Looks good to me, thanks.

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>


Ryusuke Konishi

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
  2012-09-20 11:42   ` [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
@ 2012-09-20 16:47     ` Marciniszyn, Mike
  0 siblings, 0 replies; 39+ messages in thread
From: Marciniszyn, Mike @ 2012-09-20 16:47 UTC (permalink / raw)
  To: Eric W. Biederman, linux-fsdevel
  Cc: linux-kernel, Serge Hallyn, Linux Containers, infinipath, linux-rdma

> Subject: [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and
> GLOBAL_ROOT_GID
> 
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Mike Marciniszyn <infinipath@intel.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Thanks for the patch!

Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
  2012-09-20 11:41   ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
  2012-09-20 11:58     ` Greg Kroah-Hartman
@ 2012-09-21  9:32     ` Felipe Balbi
  1 sibling, 0 replies; 39+ messages in thread
From: Felipe Balbi @ 2012-09-21  9:32 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Greg Kroah-Hartman, Felipe Balbi

[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]

On Thu, Sep 20, 2012 at 04:41:44AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Felipe Balbi <balbi@ti.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/gadget/f_fs.c |   23 ++++++++++++++++-------
>  init/Kconfig              |    1 -
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index 8adc79d..f9ee4e0 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -220,8 +220,8 @@ struct ffs_data {
>  	/* File permissions, written once when fs is mounted */
>  	struct ffs_file_perms {
>  		umode_t				mode;
> -		uid_t				uid;
> -		gid_t				gid;
> +		kuid_t				uid;
> +		kgid_t				gid;
>  	}				file_perms;
>  
>  	/*
> @@ -1143,10 +1143,19 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
>  			break;
>  
>  		case 3:
> -			if (!memcmp(opts, "uid", 3))
> -				data->perms.uid = value;
> +			if (!memcmp(opts, "uid", 3)) {
> +				data->perms.uid = make_kuid(current_user_ns(), value);
> +				if (!uid_valid(data->perms.uid)) {
> +					pr_err("%s: unmapped value: %lu\n", opts, value);
> +					return -EINVAL;
> +				}
> +			}
>  			else if (!memcmp(opts, "gid", 3))
> -				data->perms.gid = value;
> +				data->perms.gid = make_kgid(current_user_ns(), value);
> +				if (!gid_valid(data->perms.gid)) {
> +					pr_err("%s: unmapped value: %lu\n", opts, value);
> +					return -EINVAL;
> +				}
>  			else
>  				goto invalid;
>  			break;
> @@ -1175,8 +1184,8 @@ ffs_fs_mount(struct file_system_type *t, int flags,
>  	struct ffs_sb_fill_data data = {
>  		.perms = {
>  			.mode = S_IFREG | 0600,
> -			.uid = 0,
> -			.gid = 0
> +			.uid = GLOBAL_ROOT_UID,
> +			.gid = GLOBAL_ROOT_GID,
>  		},
>  		.root_mode = S_IFDIR | 0500,
>  	};
> diff --git a/init/Kconfig b/init/Kconfig
> index 633bde2..e7e0cc1 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -932,7 +932,6 @@ config UIDGID_CONVERTED
>  	depends on NET_9P = n
>  
>  	# Filesystems
> -	depends on USB_FUNCTIONFS = n
>  	depends on DEVTMPFS = n
>  	depends on XENFS = n
>  
> -- 
> 1.7.5.4
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid where appropriate
  2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
  2012-09-20 11:58     ` Greg Kroah-Hartman
@ 2012-09-21  9:33     ` Felipe Balbi
  1 sibling, 0 replies; 39+ messages in thread
From: Felipe Balbi @ 2012-09-21  9:33 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-fsdevel, linux-kernel, Serge Hallyn, Linux Containers,
	Greg Kroah-Hartman, Felipe Balbi

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

On Thu, Sep 20, 2012 at 04:41:43AM -0700, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Felipe Balbi <balbi@ti.com>
> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/gadget/inode.c |    4 ++--
>  init/Kconfig               |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
> index e58b164..7bd36c8 100644
> --- a/drivers/usb/gadget/inode.c
> +++ b/drivers/usb/gadget/inode.c
> @@ -1988,8 +1988,8 @@ gadgetfs_make_inode (struct super_block *sb,
>  	if (inode) {
>  		inode->i_ino = get_next_ino();
>  		inode->i_mode = mode;
> -		inode->i_uid = default_uid;
> -		inode->i_gid = default_gid;
> +		inode->i_uid = make_kuid(&init_user_ns, default_uid);
> +		inode->i_gid = make_kgid(&init_user_ns, default_gid);
>  		inode->i_atime = inode->i_mtime = inode->i_ctime
>  				= CURRENT_TIME;
>  		inode->i_private = data;
> diff --git a/init/Kconfig b/init/Kconfig
> index 60bdff2..633bde2 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -932,7 +932,6 @@ config UIDGID_CONVERTED
>  	depends on NET_9P = n
>  
>  	# Filesystems
> -	depends on USB_GADGETFS = n
>  	depends on USB_FUNCTIONFS = n
>  	depends on DEVTMPFS = n
>  	depends on XENFS = n
> -- 
> 1.7.5.4
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2012-09-21  9:38 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-20 11:40 [REVIEW][PATCH 00/25] userns: Trivial filesystem conversions Eric W. Biederman
2012-09-20 11:41 ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate Eric W. Biederman
2012-09-20 11:41   ` [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:58     ` Greg Kroah-Hartman
2012-09-21  9:33     ` Felipe Balbi
2012-09-20 11:41   ` [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid " Eric W. Biederman
2012-09-20 11:58     ` Greg Kroah-Hartman
2012-09-21  9:32     ` Felipe Balbi
2012-09-20 11:41   ` [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
2012-09-20 11:58     ` Greg Kroah-Hartman
2012-09-20 11:41   ` [PATCH 05/25] userns: Convert hugetlbfs to use kuid/kgid where appropriate Eric W. Biederman
2012-09-20 11:41   ` [PATCH 06/25] userns: Convert xenfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 07/25] userns: Convert adfs " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 08/25] userns: Convert befs to use kuid/kgid " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 09/25] userns: Convert cramfs " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 10/25] userns: Convert ecryptfs " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 11/25] userns: Convert efs " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 12/25] userns: Convert exofs " Eric W. Biederman
2012-09-20 12:20     ` Boaz Harrosh
2012-09-20 11:41   ` [PATCH 13/25] userns: Convert hfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 14/25] userns: Convert hfsplus " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 15/25] userns: Convert isofs to use kuid/kgid " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 16/25] userns: Convert logfs " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 17/25] userns: Convert minix " Eric W. Biederman
2012-09-20 11:41   ` [PATCH 18/25] userns: Convert nillfs2 " Eric W. Biederman
2012-09-20 14:34     ` Ryusuke Konishi
2012-09-20 11:42   ` [PATCH 19/25] userns: Convert ntfs to use kuid and kgid " Eric W. Biederman
2012-09-20 11:42   ` [PATCH 20/25] userns: Convert omfs " Eric W. Biederman
2012-09-20 12:50     ` Bob Copeland
2012-09-20 13:13       ` Eric W. Biederman
2012-09-20 13:19         ` Bob Copeland
2012-09-20 11:42   ` [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid " Eric W. Biederman
2012-09-20 12:34     ` Anders Larsen
2012-09-20 11:42   ` [PATCH 22/25] userns: Convert the qnx6 " Eric W. Biederman
2012-09-20 11:42   ` [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID Eric W. Biederman
2012-09-20 16:47     ` Marciniszyn, Mike
2012-09-20 11:55   ` [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate OGAWA Hirofumi
2012-09-20 12:04     ` Eric W. Biederman
2012-09-20 12:28       ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).