diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 14:11:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 14:11:09 -0400 |
commit | 437589a74b6a590d175f86cf9f7b2efcee7765e7 (patch) | |
tree | 37bf8635b1356d80ef002b00e84f3faf3d555a63 /fs/ubifs | |
parent | 68d47a137c3bef754923bccf73fb639c9b0bbd5e (diff) | |
parent | 72235465864d84cedb2d9f26f8e1de824ee20339 (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/ubifs')
-rw-r--r-- | fs/ubifs/budget.c | 4 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 4 | ||||
-rw-r--r-- | fs/ubifs/journal.c | 4 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 4 | ||||
-rw-r--r-- | fs/ubifs/super.c | 4 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index bc4f94b28706..969489e478bc 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
@@ -272,8 +272,8 @@ long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs) | |||
272 | */ | 272 | */ |
273 | static int can_use_rp(struct ubifs_info *c) | 273 | static int can_use_rp(struct ubifs_info *c) |
274 | { | 274 | { |
275 | if (current_fsuid() == c->rp_uid || capable(CAP_SYS_RESOURCE) || | 275 | if (uid_eq(current_fsuid(), c->rp_uid) || capable(CAP_SYS_RESOURCE) || |
276 | (c->rp_gid != 0 && in_group_p(c->rp_gid))) | 276 | (!gid_eq(c->rp_gid, GLOBAL_ROOT_GID) && in_group_p(c->rp_gid))) |
277 | return 1; | 277 | return 1; |
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index bb3167257aab..340d1afc1302 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -243,8 +243,8 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) | |||
243 | printk(KERN_ERR "\tsize %llu\n", | 243 | printk(KERN_ERR "\tsize %llu\n", |
244 | (unsigned long long)i_size_read(inode)); | 244 | (unsigned long long)i_size_read(inode)); |
245 | printk(KERN_ERR "\tnlink %u\n", inode->i_nlink); | 245 | printk(KERN_ERR "\tnlink %u\n", inode->i_nlink); |
246 | printk(KERN_ERR "\tuid %u\n", (unsigned int)inode->i_uid); | 246 | printk(KERN_ERR "\tuid %u\n", (unsigned int)i_uid_read(inode)); |
247 | printk(KERN_ERR "\tgid %u\n", (unsigned int)inode->i_gid); | 247 | printk(KERN_ERR "\tgid %u\n", (unsigned int)i_gid_read(inode)); |
248 | printk(KERN_ERR "\tatime %u.%u\n", | 248 | printk(KERN_ERR "\tatime %u.%u\n", |
249 | (unsigned int)inode->i_atime.tv_sec, | 249 | (unsigned int)inode->i_atime.tv_sec, |
250 | (unsigned int)inode->i_atime.tv_nsec); | 250 | (unsigned int)inode->i_atime.tv_nsec); |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 12c0f154ca83..afaad07f3b29 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -469,8 +469,8 @@ static void pack_inode(struct ubifs_info *c, struct ubifs_ino_node *ino, | |||
469 | ino->ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | 469 | ino->ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); |
470 | ino->mtime_sec = cpu_to_le64(inode->i_mtime.tv_sec); | 470 | ino->mtime_sec = cpu_to_le64(inode->i_mtime.tv_sec); |
471 | ino->mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); | 471 | ino->mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); |
472 | ino->uid = cpu_to_le32(inode->i_uid); | 472 | ino->uid = cpu_to_le32(i_uid_read(inode)); |
473 | ino->gid = cpu_to_le32(inode->i_gid); | 473 | ino->gid = cpu_to_le32(i_gid_read(inode)); |
474 | ino->mode = cpu_to_le32(inode->i_mode); | 474 | ino->mode = cpu_to_le32(inode->i_mode); |
475 | ino->flags = cpu_to_le32(ui->flags); | 475 | ino->flags = cpu_to_le32(ui->flags); |
476 | ino->size = cpu_to_le64(ui->ui_size); | 476 | ino->size = cpu_to_le64(ui->ui_size); |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 15e2fc5aa60b..52c21f4190f6 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -611,8 +611,8 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
611 | c->fanout = le32_to_cpu(sup->fanout); | 611 | c->fanout = le32_to_cpu(sup->fanout); |
612 | c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); | 612 | c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); |
613 | c->rp_size = le64_to_cpu(sup->rp_size); | 613 | c->rp_size = le64_to_cpu(sup->rp_size); |
614 | c->rp_uid = le32_to_cpu(sup->rp_uid); | 614 | c->rp_uid = make_kuid(&init_user_ns, le32_to_cpu(sup->rp_uid)); |
615 | c->rp_gid = le32_to_cpu(sup->rp_gid); | 615 | c->rp_gid = make_kgid(&init_user_ns, le32_to_cpu(sup->rp_gid)); |
616 | sup_flags = le32_to_cpu(sup->flags); | 616 | sup_flags = le32_to_cpu(sup->flags); |
617 | if (!c->mount_opts.override_compr) | 617 | if (!c->mount_opts.override_compr) |
618 | c->default_compr = le16_to_cpu(sup->default_compr); | 618 | c->default_compr = le16_to_cpu(sup->default_compr); |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 71a197f0f93d..681f3a942444 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -130,8 +130,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum) | |||
130 | 130 | ||
131 | inode->i_flags |= (S_NOCMTIME | S_NOATIME); | 131 | inode->i_flags |= (S_NOCMTIME | S_NOATIME); |
132 | set_nlink(inode, le32_to_cpu(ino->nlink)); | 132 | set_nlink(inode, le32_to_cpu(ino->nlink)); |
133 | inode->i_uid = le32_to_cpu(ino->uid); | 133 | i_uid_write(inode, le32_to_cpu(ino->uid)); |
134 | inode->i_gid = le32_to_cpu(ino->gid); | 134 | i_gid_write(inode, le32_to_cpu(ino->gid)); |
135 | inode->i_atime.tv_sec = (int64_t)le64_to_cpu(ino->atime_sec); | 135 | inode->i_atime.tv_sec = (int64_t)le64_to_cpu(ino->atime_sec); |
136 | inode->i_atime.tv_nsec = le32_to_cpu(ino->atime_nsec); | 136 | inode->i_atime.tv_nsec = le32_to_cpu(ino->atime_nsec); |
137 | inode->i_mtime.tv_sec = (int64_t)le64_to_cpu(ino->mtime_sec); | 137 | inode->i_mtime.tv_sec = (int64_t)le64_to_cpu(ino->mtime_sec); |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 1e5a08623d11..64f2367c2f4c 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -1426,8 +1426,8 @@ struct ubifs_info { | |||
1426 | 1426 | ||
1427 | long long rp_size; | 1427 | long long rp_size; |
1428 | long long report_rp_size; | 1428 | long long report_rp_size; |
1429 | uid_t rp_uid; | 1429 | kuid_t rp_uid; |
1430 | gid_t rp_gid; | 1430 | kgid_t rp_gid; |
1431 | 1431 | ||
1432 | /* The below fields are used only during mounting and re-mounting */ | 1432 | /* The below fields are used only during mounting and re-mounting */ |
1433 | unsigned int empty:1; | 1433 | unsigned int empty:1; |