aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 14:11:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 14:11:09 -0400
commit437589a74b6a590d175f86cf9f7b2efcee7765e7 (patch)
tree37bf8635b1356d80ef002b00e84f3faf3d555a63 /fs/isofs
parent68d47a137c3bef754923bccf73fb639c9b0bbd5e (diff)
parent72235465864d84cedb2d9f26f8e1de824ee20339 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull user namespace changes from Eric Biederman: "This is a mostly modest set of changes to enable basic user namespace support. This allows the code to code to compile with user namespaces enabled and removes the assumption there is only the initial user namespace. Everything is converted except for the most complex of the filesystems: autofs4, 9p, afs, ceph, cifs, coda, fuse, gfs2, ncpfs, nfs, ocfs2 and xfs as those patches need a bit more review. The strategy is to push kuid_t and kgid_t values are far down into subsystems and filesystems as reasonable. Leaving the make_kuid and from_kuid operations to happen at the edge of userspace, as the values come off the disk, and as the values come in from the network. Letting compile type incompatible compile errors (present when user namespaces are enabled) guide me to find the issues. The most tricky areas have been the places where we had an implicit union of uid and gid values and were storing them in an unsigned int. Those places were converted into explicit unions. I made certain to handle those places with simple trivial patches. Out of that work I discovered we have generic interfaces for storing quota by projid. I had never heard of the project identifiers before. Adding full user namespace support for project identifiers accounts for most of the code size growth in my git tree. Ultimately there will be work to relax privlige checks from "capable(FOO)" to "ns_capable(user_ns, FOO)" where it is safe allowing root in a user names to do those things that today we only forbid to non-root users because it will confuse suid root applications. While I was pushing kuid_t and kgid_t changes deep into the audit code I made a few other cleanups. I capitalized on the fact we process netlink messages in the context of the message sender. I removed usage of NETLINK_CRED, and started directly using current->tty. Some of these patches have also made it into maintainer trees, with no problems from identical code from different trees showing up in linux-next. After reading through all of this code I feel like I might be able to win a game of kernel trivial pursuit." Fix up some fairly trivial conflicts in netfilter uid/git logging code. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (107 commits) userns: Convert the ufs filesystem to use kuid/kgid where appropriate userns: Convert the udf filesystem to use kuid/kgid where appropriate userns: Convert ubifs to use kuid/kgid userns: Convert squashfs to use kuid/kgid where appropriate userns: Convert reiserfs to use kuid and kgid where appropriate userns: Convert jfs to use kuid/kgid where appropriate userns: Convert jffs2 to use kuid and kgid where appropriate userns: Convert hpfs to use kuid and kgid where appropriate userns: Convert btrfs to use kuid/kgid where appropriate userns: Convert bfs to use kuid/kgid where appropriate userns: Convert affs to use kuid/kgid wherwe appropriate userns: On alpha modify linux_to_osf_stat to use convert from kuids and kgids userns: On ia64 deal with current_uid and current_gid being kuid and kgid userns: On ppc convert current_uid from a kuid before printing. userns: Convert s390 getting uid and gid system calls to use kuid and kgid userns: Convert s390 hypfs to use kuid and kgid where appropriate userns: Convert binder ipc to use kuids userns: Teach security_path_chown to take kuids and kgids userns: Add user namespace support to IMA userns: Convert EVM to deal with kuids and kgids in it's hmac computation ...
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/inode.c17
-rw-r--r--fs/isofs/isofs.h4
-rw-r--r--fs/isofs/rock.c4
3 files changed, 15 insertions, 10 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 29037c365ba4..a7d8e6cc5e0c 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -21,6 +21,7 @@
21#include <linux/cdrom.h> 21#include <linux/cdrom.h>
22#include <linux/parser.h> 22#include <linux/parser.h>
23#include <linux/mpage.h> 23#include <linux/mpage.h>
24#include <linux/user_namespace.h>
24 25
25#include "isofs.h" 26#include "isofs.h"
26#include "zisofs.h" 27#include "zisofs.h"
@@ -171,8 +172,8 @@ struct iso9660_options{
171 unsigned int blocksize; 172 unsigned int blocksize;
172 umode_t fmode; 173 umode_t fmode;
173 umode_t dmode; 174 umode_t dmode;
174 gid_t gid; 175 kgid_t gid;
175 uid_t uid; 176 kuid_t uid;
176 char *iocharset; 177 char *iocharset;
177 /* LVE */ 178 /* LVE */
178 s32 session; 179 s32 session;
@@ -383,8 +384,8 @@ static int parse_options(char *options, struct iso9660_options *popt)
383 popt->fmode = popt->dmode = ISOFS_INVALID_MODE; 384 popt->fmode = popt->dmode = ISOFS_INVALID_MODE;
384 popt->uid_set = 0; 385 popt->uid_set = 0;
385 popt->gid_set = 0; 386 popt->gid_set = 0;
386 popt->gid = 0; 387 popt->gid = GLOBAL_ROOT_GID;
387 popt->uid = 0; 388 popt->uid = GLOBAL_ROOT_UID;
388 popt->iocharset = NULL; 389 popt->iocharset = NULL;
389 popt->utf8 = 0; 390 popt->utf8 = 0;
390 popt->overriderockperm = 0; 391 popt->overriderockperm = 0;
@@ -460,13 +461,17 @@ static int parse_options(char *options, struct iso9660_options *popt)
460 case Opt_uid: 461 case Opt_uid:
461 if (match_int(&args[0], &option)) 462 if (match_int(&args[0], &option))
462 return 0; 463 return 0;
463 popt->uid = option; 464 popt->uid = make_kuid(current_user_ns(), option);
465 if (!uid_valid(popt->uid))
466 return 0;
464 popt->uid_set = 1; 467 popt->uid_set = 1;
465 break; 468 break;
466 case Opt_gid: 469 case Opt_gid:
467 if (match_int(&args[0], &option)) 470 if (match_int(&args[0], &option))
468 return 0; 471 return 0;
469 popt->gid = option; 472 popt->gid = make_kgid(current_user_ns(), option);
473 if (!gid_valid(popt->gid))
474 return 0;
470 popt->gid_set = 1; 475 popt->gid_set = 1;
471 break; 476 break;
472 case Opt_mode: 477 case Opt_mode:
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 3620ad1ea9bc..99167238518d 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -52,8 +52,8 @@ struct isofs_sb_info {
52 52
53 umode_t s_fmode; 53 umode_t s_fmode;
54 umode_t s_dmode; 54 umode_t s_dmode;
55 gid_t s_gid; 55 kgid_t s_gid;
56 uid_t s_uid; 56 kuid_t s_uid;
57 struct nls_table *s_nls_iocharset; /* Native language support table */ 57 struct nls_table *s_nls_iocharset; /* Native language support table */
58}; 58};
59 59
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 70e79d0c756a..c0bf42472e40 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -364,8 +364,8 @@ repeat:
364 case SIG('P', 'X'): 364 case SIG('P', 'X'):
365 inode->i_mode = isonum_733(rr->u.PX.mode); 365 inode->i_mode = isonum_733(rr->u.PX.mode);
366 set_nlink(inode, isonum_733(rr->u.PX.n_links)); 366 set_nlink(inode, isonum_733(rr->u.PX.n_links));
367 inode->i_uid = isonum_733(rr->u.PX.uid); 367 i_uid_write(inode, isonum_733(rr->u.PX.uid));
368 inode->i_gid = isonum_733(rr->u.PX.gid); 368 i_gid_write(inode, isonum_733(rr->u.PX.gid));
369 break; 369 break;
370 case SIG('P', 'N'): 370 case SIG('P', 'N'):
371 { 371 {