aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-10 23:44:54 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-18 04:01:36 -0400
commitaf84df93ffe3603fc6fc40a4338f9e740aad3b4e (patch)
tree872cd463edcf18c4caba8eb218e0581c2cd91c76 /fs/ext3
parent5f3a4a28ec140a90e6058d1d09f6b1f235d485e5 (diff)
userns: Convert extN to support kuids and kgids in posix acls
Convert ext2, ext3, and ext4 to fully support the posix acl changes, using e_uid e_gid instead e_id. Enabled building with posix acls enabled, all filesystems supporting user namespaces, now also support posix acls when user namespaces are enabled. Cc: Theodore Tso <tytso@mit.edu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/acl.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 2cf6a8044c80..dbb5ad59a7fc 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -48,16 +48,23 @@ ext3_acl_from_disk(const void *value, size_t size)
48 case ACL_OTHER: 48 case ACL_OTHER:
49 value = (char *)value + 49 value = (char *)value +
50 sizeof(ext3_acl_entry_short); 50 sizeof(ext3_acl_entry_short);
51 acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
52 break; 51 break;
53 52
54 case ACL_USER: 53 case ACL_USER:
54 value = (char *)value + sizeof(ext3_acl_entry);
55 if ((char *)value > end)
56 goto fail;
57 acl->a_entries[n].e_uid =
58 make_kuid(&init_user_ns,
59 le32_to_cpu(entry->e_id));
60 break;
55 case ACL_GROUP: 61 case ACL_GROUP:
56 value = (char *)value + sizeof(ext3_acl_entry); 62 value = (char *)value + sizeof(ext3_acl_entry);
57 if ((char *)value > end) 63 if ((char *)value > end)
58 goto fail; 64 goto fail;
59 acl->a_entries[n].e_id = 65 acl->a_entries[n].e_gid =
60 le32_to_cpu(entry->e_id); 66 make_kgid(&init_user_ns,
67 le32_to_cpu(entry->e_id));
61 break; 68 break;
62 69
63 default: 70 default:
@@ -91,14 +98,19 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size)
91 ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); 98 ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION);
92 e = (char *)ext_acl + sizeof(ext3_acl_header); 99 e = (char *)ext_acl + sizeof(ext3_acl_header);
93 for (n=0; n < acl->a_count; n++) { 100 for (n=0; n < acl->a_count; n++) {
101 const struct posix_acl_entry *acl_e = &acl->a_entries[n];
94 ext3_acl_entry *entry = (ext3_acl_entry *)e; 102 ext3_acl_entry *entry = (ext3_acl_entry *)e;
95 entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); 103 entry->e_tag = cpu_to_le16(acl_e->e_tag);
96 entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); 104 entry->e_perm = cpu_to_le16(acl_e->e_perm);
97 switch(acl->a_entries[n].e_tag) { 105 switch(acl_e->e_tag) {
98 case ACL_USER: 106 case ACL_USER:
107 entry->e_id = cpu_to_le32(
108 from_kuid(&init_user_ns, acl_e->e_uid));
109 e += sizeof(ext3_acl_entry);
110 break;
99 case ACL_GROUP: 111 case ACL_GROUP:
100 entry->e_id = 112 entry->e_id = cpu_to_le32(
101 cpu_to_le32(acl->a_entries[n].e_id); 113 from_kgid(&init_user_ns, acl_e->e_gid));
102 e += sizeof(ext3_acl_entry); 114 e += sizeof(ext3_acl_entry);
103 break; 115 break;
104 116