aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2013-12-13 14:49:53 -0500
committerPaul Moore <pmoore@redhat.com>2013-12-13 14:52:25 -0500
commit4d546f81717d253ab67643bf072c6d8821a9249c (patch)
tree2bfae32c5e42b7b57cab82efbe71f522db79af60 /security/selinux/ss/services.c
parent598cdbcf861825692fe7905e0fd662c7d06bae58 (diff)
selinux: revert 102aefdda4d8275ce7d7100bc16c88c74272b260
Revert "selinux: consider filesystem subtype in policies" This reverts commit 102aefdda4d8275ce7d7100bc16c88c74272b260. Explanation from Eric Paris: SELinux policy can specify if it should use a filesystem's xattrs or not. In current policy we have a specification that fuse should not use xattrs but fuse.glusterfs should use xattrs. This patch has a bug in which non-glusterfs filesystems would match the rule saying fuse.glusterfs should use xattrs. If both fuse and the particular filesystem in question are not written to handle xattr calls during the mount command, they will deadlock. I have fixed the bug to do proper matching, however I believe a revert is still the correct solution. The reason I believe that is because the code still does not work. The s_subtype is not set until after the SELinux hook which attempts to match on the ".gluster" portion of the rule. So we cannot match on the rule in question. The code is useless. Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 6db5546717eb..fc5a63a05a1c 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2344,50 +2344,16 @@ int security_fs_use(struct super_block *sb)
2344 struct ocontext *c; 2344 struct ocontext *c;
2345 struct superblock_security_struct *sbsec = sb->s_security; 2345 struct superblock_security_struct *sbsec = sb->s_security;
2346 const char *fstype = sb->s_type->name; 2346 const char *fstype = sb->s_type->name;
2347 const char *subtype = (sb->s_subtype && sb->s_subtype[0]) ? sb->s_subtype : NULL;
2348 struct ocontext *base = NULL;
2349 2347
2350 read_lock(&policy_rwlock); 2348 read_lock(&policy_rwlock);
2351 2349
2352 for (c = policydb.ocontexts[OCON_FSUSE]; c; c = c->next) { 2350 c = policydb.ocontexts[OCON_FSUSE];
2353 char *sub; 2351 while (c) {
2354 int baselen; 2352 if (strcmp(fstype, c->u.name) == 0)
2355
2356 baselen = strlen(fstype);
2357
2358 /* if base does not match, this is not the one */
2359 if (strncmp(fstype, c->u.name, baselen))
2360 continue;
2361
2362 /* if there is no subtype, this is the one! */
2363 if (!subtype)
2364 break;
2365
2366 /* skip past the base in this entry */
2367 sub = c->u.name + baselen;
2368
2369 /* entry is only a base. save it. keep looking for subtype */
2370 if (sub[0] == '\0') {
2371 base = c;
2372 continue;
2373 }
2374
2375 /* entry is not followed by a subtype, so it is not a match */
2376 if (sub[0] != '.')
2377 continue;
2378
2379 /* whew, we found a subtype of this fstype */
2380 sub++; /* move past '.' */
2381
2382 /* exact match of fstype AND subtype */
2383 if (!strcmp(subtype, sub))
2384 break; 2353 break;
2354 c = c->next;
2385 } 2355 }
2386 2356
2387 /* in case we had found an fstype match but no subtype match */
2388 if (!c)
2389 c = base;
2390
2391 if (c) { 2357 if (c) {
2392 sbsec->behavior = c->v.behavior; 2358 sbsec->behavior = c->v.behavior;
2393 if (!c->sid[0]) { 2359 if (!c->sid[0]) {