diff options
author | Kohei Kaigai <Kohei.Kaigai@eu.nec.com> | 2011-04-01 10:39:26 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2011-04-01 17:13:23 -0400 |
commit | f50a3ec961f90e38c0311411179d5dfee1412192 (patch) | |
tree | 600b7909964cd116af1252ecabb5b1415c01d7a0 /security/selinux/ss/services.c | |
parent | 6bde95ce33e1c2ac9b5cb3d814722105131090ec (diff) |
selinux: add type_transition with name extension support for selinuxfs
The attached patch allows /selinux/create takes optional 4th argument
to support TYPE_TRANSITION with name extension for userspace object
managers.
If 4th argument is not supplied, it shall perform as existing kernel.
In fact, the regression test of SE-PostgreSQL works well on the patched
kernel.
Thanks,
Signed-off-by: KaiGai Kohei <kohei.kaigai@eu.nec.com>
[manually verify fuzz was not an issue, and it wasn't: eparis]
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 03f7a4748ee8..39d732145abe 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -1360,14 +1360,14 @@ out: | |||
1360 | 1360 | ||
1361 | static void filename_compute_type(struct policydb *p, struct context *newcontext, | 1361 | static void filename_compute_type(struct policydb *p, struct context *newcontext, |
1362 | u32 scon, u32 tcon, u16 tclass, | 1362 | u32 scon, u32 tcon, u16 tclass, |
1363 | const struct qstr *qstr) | 1363 | const char *objname) |
1364 | { | 1364 | { |
1365 | struct filename_trans *ft; | 1365 | struct filename_trans *ft; |
1366 | for (ft = p->filename_trans; ft; ft = ft->next) { | 1366 | for (ft = p->filename_trans; ft; ft = ft->next) { |
1367 | if (ft->stype == scon && | 1367 | if (ft->stype == scon && |
1368 | ft->ttype == tcon && | 1368 | ft->ttype == tcon && |
1369 | ft->tclass == tclass && | 1369 | ft->tclass == tclass && |
1370 | !strcmp(ft->name, qstr->name)) { | 1370 | !strcmp(ft->name, objname)) { |
1371 | newcontext->type = ft->otype; | 1371 | newcontext->type = ft->otype; |
1372 | return; | 1372 | return; |
1373 | } | 1373 | } |
@@ -1378,7 +1378,7 @@ static int security_compute_sid(u32 ssid, | |||
1378 | u32 tsid, | 1378 | u32 tsid, |
1379 | u16 orig_tclass, | 1379 | u16 orig_tclass, |
1380 | u32 specified, | 1380 | u32 specified, |
1381 | const struct qstr *qstr, | 1381 | const char *objname, |
1382 | u32 *out_sid, | 1382 | u32 *out_sid, |
1383 | bool kern) | 1383 | bool kern) |
1384 | { | 1384 | { |
@@ -1479,9 +1479,9 @@ static int security_compute_sid(u32 ssid, | |||
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | /* if we have a qstr this is a file trans check so check those rules */ | 1481 | /* if we have a qstr this is a file trans check so check those rules */ |
1482 | if (qstr) | 1482 | if (objname) |
1483 | filename_compute_type(&policydb, &newcontext, scontext->type, | 1483 | filename_compute_type(&policydb, &newcontext, scontext->type, |
1484 | tcontext->type, tclass, qstr); | 1484 | tcontext->type, tclass, objname); |
1485 | 1485 | ||
1486 | /* Check for class-specific changes. */ | 1486 | /* Check for class-specific changes. */ |
1487 | if (specified & AVTAB_TRANSITION) { | 1487 | if (specified & AVTAB_TRANSITION) { |
@@ -1539,13 +1539,14 @@ int security_transition_sid(u32 ssid, u32 tsid, u16 tclass, | |||
1539 | const struct qstr *qstr, u32 *out_sid) | 1539 | const struct qstr *qstr, u32 *out_sid) |
1540 | { | 1540 | { |
1541 | return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, | 1541 | return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, |
1542 | qstr, out_sid, true); | 1542 | qstr ? qstr->name : NULL, out_sid, true); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | int security_transition_sid_user(u32 ssid, u32 tsid, u16 tclass, u32 *out_sid) | 1545 | int security_transition_sid_user(u32 ssid, u32 tsid, u16 tclass, |
1546 | const char *objname, u32 *out_sid) | ||
1546 | { | 1547 | { |
1547 | return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, | 1548 | return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, |
1548 | NULL, out_sid, false); | 1549 | objname, out_sid, false); |
1549 | } | 1550 | } |
1550 | 1551 | ||
1551 | /** | 1552 | /** |