userns: Trivial filesystem conversions
Subsystems (18)
cover userns: Trivial filesystem conversions
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(-)
PATCH 1/25 userns: Convert fat to use kuid/kgid where appropriate
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/fat/fat.h +2 -2
@@ -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 */
fs/fat/file.c +3 -3
@@ -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 ;
fs/fat/inode.c +12 -6
@@ -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))
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 2/25 userns: Convert gadgetfs to use kuid and kgid where appropriate
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- drivers/usb/gadget/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/usb/gadget/inode.c +2 -2
@@ -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;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid where appropriate
Quoted 6 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Cc Felipe Balbi <[email protected]>Acked-by Serge Hallyn <[email protected]>
Re: [PATCH 02/25] userns: Convert gadgetfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanQuoted 6 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Cc Felipe Balbi <[email protected]>Acked-by Serge Hallyn <[email protected]>
Quoted 35 lines
--- drivers/usb/gadget/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)drivers/usb/gadget/inode.c +2
-2@@ -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;init/Kconfig +0
-1@@ -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 = nSignature · 1 line
1.7.5.4
Signature · 1 line
balbi
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
PATCH 3/25 userns: Convert usb functionfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- drivers/usb/gadget/f_fs.c | 23 ++++++++++++++++------- init/Kconfig | 1 - 2 files changed, 16 insertions(+), 8 deletions(-)
drivers/usb/gadget/f_fs.c +16 -7
@@ -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 , };
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
Quoted 6 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Cc Felipe Balbi <[email protected]>Acked-by Serge Hallyn <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 1348141326-23355-3-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]
Felipe Balbi
Acked-byRe: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
Quoted 6 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Cc Felipe Balbi <[email protected]>Acked-by Serge Hallyn <[email protected]>
Quoted 69 lines
--- drivers/usb/gadget/f_fs.c | 23 ++++++++++++++++------- init/Kconfig | 1 - 2 files changed, 16 insertions(+), 8 deletions(-)drivers/usb/gadget/f_fs.c +16
-7@@ -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 , };init/Kconfig +0
-1@@ -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 = nSignature · 1 line
1.7.5.4
Signature · 1 line
balbi
_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
Re: [PATCH 03/25] userns: Convert usb functionfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanQuoted 6 lines · Eric W. Biederman
From: "Eric W. Biederman" <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Cc Felipe Balbi <[email protected]>Acked-by Serge Hallyn <[email protected]>Signed-off-by Eric W. Biederman <[email protected]>
Quoted 69 lines
--- drivers/usb/gadget/f_fs.c | 23 ++++++++++++++++------- init/Kconfig | 1 - 2 files changed, 16 insertions(+), 8 deletions(-)drivers/usb/gadget/f_fs.c +16
-7@@ -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 , };init/Kconfig +0
-1@@ -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 = nSignature · 1 line
1.7.5.4
Signature · 1 line
balbi
PATCH 4/25 userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- drivers/base/devtmpfs.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/base/devtmpfs.c +2 -2
@@ -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 ;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 04/25] userns: Convert devtmpfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Greg Kroah-Hartman <[email protected]>Acked-by Serge Hallyn <[email protected]>
PATCH 5/25 userns: Convert hugetlbfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
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.
--- fs/hugetlbfs/inode.c | 16 +++++++++++----- init/Kconfig | 1 - 2 files changed, 11 insertions(+), 6 deletions(-)
fs/hugetlbfs/inode.c +11 -5
@@ -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,
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 6/25 userns: Convert xenfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- drivers/xen/xenfs/super.c | 3 ++- init/Kconfig | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/xen/xenfs/super.c +2 -1
@@ -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 ; }
init/Kconfig +0 -2
@@ -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
Signature · 1 line
1.7.5.4
PATCH 7/25 userns: Convert adfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/adfs/adfs.h +2 -2
@@ -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 */
fs/adfs/inode.c +2 -2
@@ -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)
fs/adfs/super.c +13 -8
@@ -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 ;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 8/25 userns: Convert befs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/befs/befs.h | 4 ++-- fs/befs/linuxvfs.c | 27 +++++++++++++++++++-------- init/Kconfig | 1 - 3 files changed, 21 insertions(+), 11 deletions(-)
fs/befs/befs.h +2 -2
@@ -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;
fs/befs/linuxvfs.c +19 -8
@@ -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:
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 9/25 userns: Convert cramfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/cramfs/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/cramfs/inode.c +2 -2
@@ -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 )) {
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 10/25 userns: Convert ecryptfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/ecryptfs/main.c | 5 +++-- fs/ecryptfs/messaging.c | 5 ++--- init/Kconfig | 1 - 3 files changed, 5 insertions(+), 6 deletions(-)
fs/ecryptfs/main.c +3 -2
@@ -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; }
fs/ecryptfs/messaging.c +2 -3
@@ -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; }
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 11/25 userns: Convert efs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/efs/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/efs/inode.c +2 -2
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 12/25 userns: Convert exofs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/exofs/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)
fs/exofs/inode.c +4 -4
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 12/25] userns: Convert exofs to use kuid/kgid where appropriate
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <[email protected]>
Cc Boaz Harrosh <[email protected]>Cc Benny Halevy <[email protected]>Acked-by Serge Hallyn <[email protected]>
Quoted 44 lines
Signed-off-by Eric W. Biederman <[email protected]>--- fs/exofs/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)fs/exofs/inode.c +4
-4@@ -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);init/Kconfig +0
-1@@ -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
A message that is not in the archive (sent off-list or not yet received): 1348141326-23355-12-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]
Boaz Harrosh
Acked-byRe: [PATCH 12/25] userns: Convert exofs to use kuid/kgid where appropriate
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Boaz Harrosh <[email protected]>Cc Benny Halevy <bhalevy-4/[email protected]>Acked-by Serge Hallyn <[email protected]>
Quoted 44 lines
--- fs/exofs/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)fs/exofs/inode.c +4
-4@@ -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);init/Kconfig +0
-1@@ -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
PATCH 13/25 userns: Convert hfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/hfs/hfs_fs.h +2 -2
@@ -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;
fs/hfs/inode.c +2 -2
@@ -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)) ||
fs/hfs/super.c +13 -3
@@ -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)) {
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 14/25 userns: Convert hfsplus to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/hfsplus/catalog.c +2 -2
@@ -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);
fs/hfsplus/hfsplus_fs.h +2 -2
@@ -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;
fs/hfsplus/inode.c +4 -4
@@ -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) {
fs/hfsplus/options.c +12 -3
@@ -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 )
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 15/25 userns: Convert isofs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/isofs/inode.c +11 -6
@@ -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:
fs/isofs/isofs.h +2 -2
@@ -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 */ };
fs/isofs/rock.c +2 -2
@@ -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' ): {
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): 1348141326-23355-1-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]
PATCH 16/25 userns: Convert logfs to use kuid/kgid where appropriate
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/logfs/inode.c | 4 ++-- fs/logfs/readwrite.c | 8 ++++---- init/Kconfig | 1 - 3 files changed, 6 insertions(+), 7 deletions(-)
fs/logfs/inode.c +2 -2
@@ -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 ;
fs/logfs/readwrite.c +4 -4
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 17/25 userns: Convert minix to use kuid/kgid where appropriate
In reply to a message not in the archiveFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/minix/inode.c | 16 ++++++++-------- init/Kconfig | 1 - 2 files changed, 8 insertions(+), 9 deletions(-)
fs/minix/inode.c +8 -8
@@ -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;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 21/25 userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
In reply to a message not in the archiveFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/qnx4/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/qnx4/inode.c +2 -2
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 23/25 userns: Convert the sysv filesystem to use kuid/kgid where appropriate
In reply to a message not in the archiveFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/sysv/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)
fs/sysv/inode.c +4 -4
@@ -202,8 +202,8 @@ struct inode *sysv_iget(struct super_block *sb, unsigned int ino) }/* SystemV FS: kludge permissions if ino==SYSV_ROOT_INO ?? */ inode->i_mode =fs16_to_cpu (sbi, raw_inode->i_mode); - inode->i_uid = (uid_t )fs16_to_cpu (sbi, raw_inode->i_uid); - inode->i_gid = (gid_t )fs16_to_cpu (sbi, raw_inode->i_gid); +i_uid_write (inode, (uid_t )fs16_to_cpu (sbi, raw_inode->i_uid)); +i_gid_write (inode, (gid_t )fs16_to_cpu (sbi, raw_inode->i_gid));set_nlink (inode,fs16_to_cpu (sbi, raw_inode->i_nlink)); inode->i_size =fs32_to_cpu (sbi, raw_inode->i_size); inode->i_atime.tv_sec =fs32_to_cpu (sbi, raw_inode->i_atime);
@@ -256,8 +256,8 @@ static int __sysv_write_inode(struct inode *inode, int wait) } raw_inode->i_mode =cpu_to_fs16 (sbi, inode->i_mode); - raw_inode->i_uid =cpu_to_fs16 (sbi,fs_high2lowuid (inode->i_uid)); - raw_inode->i_gid =cpu_to_fs16 (sbi,fs_high2lowgid (inode->i_gid)); + raw_inode->i_uid =cpu_to_fs16 (sbi,fs_high2lowuid (i_uid_read (inode))); + raw_inode->i_gid =cpu_to_fs16 (sbi,fs_high2lowgid (i_gid_read (inode))); raw_inode->i_nlink =cpu_to_fs16 (sbi, inode->i_nlink); raw_inode->i_size =cpu_to_fs32 (sbi, inode->i_size); raw_inode->i_atime =cpu_to_fs32 (sbi, inode->i_atime.tv_sec);
init/Kconfig +0 -1
@@ -952,7 +952,6 @@ config UIDGID_CONVERTED depends on OCFS2_FS = n depends on REISERFS_FS = n depends on SQUASHFS = n - depends on SYSV_FS = n depends on UBIFS_FS = n depends on UDF_FS = n depends on UFS_FS = n
Signature · 1 line
1.7.5.4
PATCH 24/25 userns: Convert freevxfs to use kuid/kgid where appropriate
In reply to a message not in the archiveFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/freevxfs/vxfs_inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/freevxfs/vxfs_inode.c +2 -2
@@ -224,8 +224,8 @@ vxfs_iinit(struct inode *ip, struct vxfs_inode_info *vip) { ip->i_mode =vxfs_transmod (vip); - ip->i_uid = (uid_t )vip->vii_uid; - ip->i_gid = (gid_t )vip->vii_gid; +i_uid_write (ip, (uid_t )vip->vii_uid); +i_gid_write (ip, (gid_t )vip->vii_gid);set_nlink (ip, vip->vii_nlink); ip->i_size = vip->vii_size;
init/Kconfig +0 -1
@@ -955,7 +955,6 @@ config UIDGID_CONVERTED depends on UBIFS_FS = n depends on UDF_FS = n depends on UFS_FS = n - depends on VXFS_FS = n depends on XFS_FS = n depends on !UML || HOSTFS = n
Signature · 1 line
1.7.5.4
PATCH 16/25 userns: Convert logfs to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <[email protected]>
--- fs/logfs/inode.c | 4 ++-- fs/logfs/readwrite.c | 8 ++++---- init/Kconfig | 1 - 3 files changed, 6 insertions(+), 7 deletions(-)
fs/logfs/inode.c +2 -2
@@ -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 ;
fs/logfs/readwrite.c +4 -4
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 17/25 userns: Convert minix to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <[email protected]>
--- fs/minix/inode.c | 16 ++++++++-------- init/Kconfig | 1 - 2 files changed, 8 insertions(+), 9 deletions(-)
fs/minix/inode.c +8 -8
@@ -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;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): 1348141326-23355-17-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]
Re: [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
Quoted 14 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Acked-by Serge Hallyn <[email protected]>--- fs/minix/inode.c | 16 ++++++++-------- init/Kconfig | 1 - 2 files changed, 8 insertions(+), 9 deletions(-)fs/minix/inode.c +0
-0
fs/minix/inode.c static struct inode *V1_minix_iget(struct inode *inode) · line 464
Quoted 7 lines
fs/minix/inode.c +2
-2@@ -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);
i_uid_write(inode, (uid_t)raw_inode->i_uid); i_gid_write(inode, (gid_t)raw_inode->i_gid);
is more better?
Quoted 49 lines
fs/minix/inode.c +6
-6set_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;init/Kconfig +0
-1@@ -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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
Quoted 27 lines · Zhao Hongjiang
Quoted 14 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Acked-by Serge Hallyn <[email protected]>--- fs/minix/inode.c | 16 ++++++++-------- init/Kconfig | 1 - 2 files changed, 8 insertions(+), 9 deletions(-)fs/minix/inode.c +0
-0fs/minix/inode.c static struct inode *V1_minix_iget(struct inode *inode) · line 464
Quoted 7 lines
fs/minix/inode.c +2
-2@@ -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);i_uid_write(inode, (uid_t)raw_inode->i_uid); i_gid_write(inode, (gid_t)raw_inode->i_gid);
Quoted 1 line
is more better?
An extra cast to uid_t or gid_t is redundant. i_uid_write takes a uid_t paramenter and i_gid_write takes a gid_t paramenter so we already have the casts implicitly.
Eric
Quoted 49 lines
Quoted 49 lines
fs/minix/inode.c +6
-6set_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;init/Kconfig +0
-1@@ -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
A message that is not in the archive (sent off-list or not yet received): 87obkupgcr.fsf-aS9lmoZGLiVWk0Htik3J/[email protected]
Re: [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
Quoted 29 lines · Eric W. Biederman
Quoted 27 lines · Zhao Hongjiang
Quoted 14 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Acked-by Serge Hallyn <[email protected]>--- fs/minix/inode.c | 16 ++++++++-------- init/Kconfig | 1 - 2 files changed, 8 insertions(+), 9 deletions(-)fs/minix/inode.c +0
-0fs/minix/inode.c static struct inode *V1_minix_iget(struct inode *inode) · line 464
Quoted 7 lines
fs/minix/inode.c +2
-2@@ -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);i_uid_write(inode, (uid_t)raw_inode->i_uid); i_gid_write(inode, (gid_t)raw_inode->i_gid);
Quoted 7 lines
Quoted 1 line
is more better?
An extra cast to
uid_torgid_tis redundant.i_uid_writetakes auid_tparamenter andi_gid_writetakes agid_tparamenter so we already have the casts implicitly.Eric
I see,this is mean that we should remove uid_t and gid_t casts in other patches which is in i_uid_write and i_gid_write?
Quoted 57 lines
Quoted 43 lines
Quoted 43 lines
fs/minix/inode.c +6
-6set_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;init/Kconfig +0
-0@@ -946,7 +946,6 @@ config UIDGID_CONVERTEDQuoted 8 lines
init/Kconfig config UIDGID_CONVERTED · line 951
Quoted 8 lines
init/Kconfig +0
-1depends 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_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 17/25] userns: Convert minix to use kuid/kgid where appropriate
Quoted 6 lines · Zhao Hongjiang
Quoted 6 lines
Quoted 5 lines
i_uid_write(inode, (uid_t)raw_inode->i_uid); i_gid_write(inode, (gid_t)raw_inode->i_gid);is more better?
Quoted 8 lines
Quoted 5 lines
An extra cast to
uid_torgid_tis redundant.i_uid_writetakes auid_tparamenter andi_gid_writetakes agid_tparamenter so we already have the casts implicitly.Eric
I see,this is mean that we should remove
uid_tandgid_tcasts in other patches which is ini_uid_writeandi_gid_write?
Do you know of any such cases.
I certainly don't remember extraneous casts be a usual pattern in the kernel.
Eric
PATCH 18/25 userns: Convert nillfs2 to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/nilfs2/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)
fs/nilfs2/inode.c +4 -4
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 18/25] userns: Convert nillfs2 to use kuid/kgid where appropriate
Quoted 9 lines · Eric W. Biederman
From: "Eric W. Biederman" <[email protected]>
Cc KONISHI Ryusuke <[email protected]>Acked-by Serge Hallyn <[email protected]>Signed-off-by Eric W. Biederman <[email protected]>--- fs/nilfs2/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)
Looks good to me, thanks.
Ryusuke Konishi
A message that is not in the archive (sent off-list or not yet received): 1348141326-23355-18-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]
Ryusuke Konishi
Acked-byRe: [PATCH 18/25] userns: Convert nillfs2 to use kuid/kgid where appropriate
Quoted 9 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc KONISHI Ryusuke <[email protected]>Acked-by Serge Hallyn <[email protected]>--- fs/nilfs2/inode.c | 8 ++++---- init/Kconfig | 1 - 2 files changed, 4 insertions(+), 5 deletions(-)
Looks good to me, thanks.
Ryusuke Konishi
PATCH 19/25 userns: Convert ntfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- 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(-)
fs/ntfs/inode.c +4 -3
@@ -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 {
fs/ntfs/super.c +32 -7
@@ -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. */
fs/ntfs/volume.h +3 -2
@@ -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. */
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
PATCH 20/25 userns: Convert omfs to use kuid and kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/omfs/inode.c | 8 ++++++-- fs/omfs/omfs.h | 4 ++-- init/Kconfig | 1 - 3 files changed, 8 insertions(+), 5 deletions(-)
fs/omfs/inode.c +6 -2
@@ -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))
fs/omfs/omfs.h +2 -2
@@ -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; };
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Bob Copeland
maintainerRe: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Bob Copeland <me-aXfl/[email protected]>Acked-by Serge Hallyn <[email protected]>
Thanks, looks good to me.
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
Quoted 8 lines · Bob Copeland
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Bob Copeland <me-aXfl/[email protected]>Acked-by Serge Hallyn <[email protected]>Thanks, looks good to me.
Then I will take that as an Acked-by. ;)
Eric
Re: [PATCH 20/25] userns: Convert omfs to use kuid and kgid where appropriate
Quoted 5 lines · Eric W. Biederman
Quoted 3 lines · Bob Copeland
Quoted 2 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Cc Bob Copeland <me-aXfl/[email protected]>Acked-by Serge Hallyn <[email protected]>Thanks, looks good to me.
Then I will take that as an Acked-by. ;)
Sure, or here's one you can copy :)
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
PATCH 21/25 userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <[email protected]>
--- fs/qnx4/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/qnx4/inode.c +2 -2
@@ -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);
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
Re: [PATCH 21/25] userns: Convert the qnx4 filesystem to use kuid/kgid where appropriate
Quoted 5 lines · Eric W. Biederman
From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Anders Larsen <al-V9/YLgxv/[email protected]>Acked-by Serge Hallyn <[email protected]>
Quoted 34 lines
--- fs/qnx4/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)fs/qnx4/inode.c +2
-2@@ -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);init/Kconfig +0
-1@@ -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 = nSignature · 1 line
1.7.5.4
PATCH 22/25 userns: Convert the qnx6 filesystem to use kuid/kgid where appropriate
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- fs/qnx6/inode.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
fs/qnx6/inode.c +2 -2
@@ -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 ;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
OGAWA Hirofumi
maintainerRe: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
In reply to Eric W. Biedermanfs/fat/fat.h line 30
Quoted 8 lines · Eric W. Biederman
struct
fat_mount_options{fs/fat/fat.h +2
-2-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?
Quoted 77 lines
fs/fat/file.c +3
-3@@ -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 ;fs/fat/inode.c +12
-6@@ -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))init/Kconfig +0
-1@@ -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
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Re: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
Quoted 13 lines · OGAWA Hirofumi
fs/fat/fat.h line 30
Quoted 8 lines · Eric W. Biederman
struct
fat_mount_options{fs/fat/fat.h +2
-2-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
Quoted 77 lines
Quoted 77 lines
fs/fat/file.c +3
-3@@ -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 ;fs/fat/inode.c +12
-6@@ -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))init/Kconfig +0
-1@@ -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
Re: [PATCH 01/25] userns: Convert fat to use kuid/kgid where appropriate
Quoted 20 lines · [email protected] (Eric W. Biederman) writes:
Quoted 2 lines
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_optionsthere is:static int parse_options(struct
super_block*sb, char *options, intis_vfat,
int silent, int *debug, structfat_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();
Quoted 1 line
So there should be no problems with initialization.
I see.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
PATCH 25/25 userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
In reply to Eric W. BiedermanFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
--- drivers/infiniband/hw/qib/qib_fs.c | 4 ++-- init/Kconfig | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/qib/qib_fs.c +2 -2
@@ -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;
init/Kconfig +0 -1
@@ -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
Signature · 1 line
1.7.5.4
RE: [PATCH 25/25] userns: Convert ipathfs to use GLOBAL_ROOT_UID and GLOBAL_ROOT_GID
Quoted 8 lines
Subject: [PATCH 25/25] userns: Convert ipathfs to use
GLOBAL_ROOT_UIDandGLOBAL_ROOT_GIDFrom: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/[email protected]>
Cc Mike Marciniszyn <[email protected]>Acked-by Serge Hallyn <[email protected]>
Thanks for the patch!