aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorKaiGai Kohei <kaigai@ak.jp.nec.com>2010-01-21 01:00:15 -0500
committerJames Morris <jmorris@namei.org>2010-01-24 16:31:38 -0500
commit7d52a155e38d5a165759dbbee656455861bf7801 (patch)
tree7b071cde283e98465744b5abb2c6140b9b6afcda /security/selinux
parent2f3e82d694d3d7a2db019db1bb63385fbc1066f3 (diff)
selinux: remove dead code in type_attribute_bounds_av()
This patch removes dead code in type_attribute_bounds_av(). Due to the historical reason, the type boundary feature is delivered from hierarchical types in libsepol, it has supported boundary features both of subject type (domain; in most cases) and target type. However, we don't have any actual use cases in bounded target types, and it tended to make conceptual confusion. So, this patch removes the dead code to apply boundary checks on the target types. I makes clear the TYPEBOUNDS restricts privileges of a certain domain bounded to any other domain. Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> -- security/selinux/ss/services.c | 43 +++------------------------------------ 1 files changed, 4 insertions(+), 39 deletions(-) Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/ss/services.c43
1 files changed, 4 insertions, 39 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 3b42b154d87c..4a2bf212057b 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -516,16 +516,14 @@ static void type_attribute_bounds_av(struct context *scontext,
516 u16 tclass, 516 u16 tclass,
517 struct av_decision *avd) 517 struct av_decision *avd)
518{ 518{
519 struct context lo_scontext;
520 struct context lo_tcontext;
521 struct av_decision lo_avd;
522 struct type_datum *source 519 struct type_datum *source
523 = policydb.type_val_to_struct[scontext->type - 1]; 520 = policydb.type_val_to_struct[scontext->type - 1];
524 struct type_datum *target
525 = policydb.type_val_to_struct[tcontext->type - 1];
526 u32 masked = 0;
527 521
528 if (source->bounds) { 522 if (source->bounds) {
523 struct context lo_scontext;
524 struct av_decision lo_avd;
525 u32 masked;
526
529 memset(&lo_avd, 0, sizeof(lo_avd)); 527 memset(&lo_avd, 0, sizeof(lo_avd));
530 528
531 memcpy(&lo_scontext, scontext, sizeof(lo_scontext)); 529 memcpy(&lo_scontext, scontext, sizeof(lo_scontext));
@@ -538,40 +536,7 @@ static void type_attribute_bounds_av(struct context *scontext,
538 if ((lo_avd.allowed & avd->allowed) == avd->allowed) 536 if ((lo_avd.allowed & avd->allowed) == avd->allowed)
539 return; /* no masked permission */ 537 return; /* no masked permission */
540 masked = ~lo_avd.allowed & avd->allowed; 538 masked = ~lo_avd.allowed & avd->allowed;
541 }
542
543 if (target->bounds) {
544 memset(&lo_avd, 0, sizeof(lo_avd));
545
546 memcpy(&lo_tcontext, tcontext, sizeof(lo_tcontext));
547 lo_tcontext.type = target->bounds;
548
549 context_struct_compute_av(scontext,
550 &lo_tcontext,
551 tclass,
552 &lo_avd);
553 if ((lo_avd.allowed & avd->allowed) == avd->allowed)
554 return; /* no masked permission */
555 masked = ~lo_avd.allowed & avd->allowed;
556 }
557
558 if (source->bounds && target->bounds) {
559 memset(&lo_avd, 0, sizeof(lo_avd));
560 /*
561 * lo_scontext and lo_tcontext are already
562 * set up.
563 */
564
565 context_struct_compute_av(&lo_scontext,
566 &lo_tcontext,
567 tclass,
568 &lo_avd);
569 if ((lo_avd.allowed & avd->allowed) == avd->allowed)
570 return; /* no masked permission */
571 masked = ~lo_avd.allowed & avd->allowed;
572 }
573 539
574 if (masked) {
575 /* mask violated permissions */ 540 /* mask violated permissions */
576 avd->allowed &= ~masked; 541 avd->allowed &= ~masked;
577 542