aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/common.h
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-14 20:22:42 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:34:28 -0400
commit82e0f001a4c1112dcff9cafa9812a33889ad9b8a (patch)
tree55c7e99f8773129b602f837f0c79f8d542021195 /security/tomoyo/common.h
parent237ab459f12cb98eadd3fe7b85343e183a1076a4 (diff)
TOMOYO: Use common structure for list element.
Use common "struct list_head" + "bool" structure. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r--security/tomoyo/common.h112
1 files changed, 50 insertions, 62 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 539b9a28b739..0ab6e86f90aa 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -189,6 +189,20 @@ enum tomoyo_mac_category_index {
189/********** Structure definitions. **********/ 189/********** Structure definitions. **********/
190 190
191/* 191/*
192 * tomoyo_acl_head is a structure which is used for holding elements not in
193 * domain policy.
194 * It has following fields.
195 *
196 * (1) "list" which is linked to tomoyo_policy_list[] .
197 * (2) "is_deleted" is a bool which is true if marked as deleted, false
198 * otherwise.
199 */
200struct tomoyo_acl_head {
201 struct list_head list;
202 bool is_deleted;
203} __packed;
204
205/*
192 * tomoyo_request_info is a structure which is used for holding 206 * tomoyo_request_info is a structure which is used for holding
193 * 207 *
194 * (1) Domain information of current process. 208 * (1) Domain information of current process.
@@ -274,15 +288,13 @@ struct tomoyo_number_group {
274 288
275/* Structure for "path_group" directive. */ 289/* Structure for "path_group" directive. */
276struct tomoyo_path_group_member { 290struct tomoyo_path_group_member {
277 struct list_head list; 291 struct tomoyo_acl_head head;
278 bool is_deleted;
279 const struct tomoyo_path_info *member_name; 292 const struct tomoyo_path_info *member_name;
280}; 293};
281 294
282/* Structure for "number_group" directive. */ 295/* Structure for "number_group" directive. */
283struct tomoyo_number_group_member { 296struct tomoyo_number_group_member {
284 struct list_head list; 297 struct tomoyo_acl_head head;
285 bool is_deleted;
286 struct tomoyo_number_union number; 298 struct tomoyo_number_union number;
287}; 299};
288 300
@@ -523,15 +535,12 @@ struct tomoyo_io_buffer {
523 * "allow_read" entries. 535 * "allow_read" entries.
524 * It has following fields. 536 * It has following fields.
525 * 537 *
526 * (1) "list" which is linked to tomoyo_globally_readable_list . 538 * (1) "head" is "struct tomoyo_acl_head".
527 * (2) "filename" is a pathname which is allowed to open(O_RDONLY). 539 * (2) "filename" is a pathname which is allowed to open(O_RDONLY).
528 * (3) "is_deleted" is a bool which is true if marked as deleted, false
529 * otherwise.
530 */ 540 */
531struct tomoyo_globally_readable_file_entry { 541struct tomoyo_globally_readable_file_entry {
532 struct list_head list; 542 struct tomoyo_acl_head head;
533 const struct tomoyo_path_info *filename; 543 const struct tomoyo_path_info *filename;
534 bool is_deleted;
535}; 544};
536 545
537/* 546/*
@@ -539,16 +548,13 @@ struct tomoyo_globally_readable_file_entry {
539 * "tomoyo_pattern_list" entries. 548 * "tomoyo_pattern_list" entries.
540 * It has following fields. 549 * It has following fields.
541 * 550 *
542 * (1) "list" which is linked to tomoyo_pattern_list . 551 * (1) "head" is "struct tomoyo_acl_head".
543 * (2) "pattern" is a pathname pattern which is used for converting pathnames 552 * (2) "pattern" is a pathname pattern which is used for converting pathnames
544 * to pathname patterns during learning mode. 553 * to pathname patterns during learning mode.
545 * (3) "is_deleted" is a bool which is true if marked as deleted, false
546 * otherwise.
547 */ 554 */
548struct tomoyo_pattern_entry { 555struct tomoyo_pattern_entry {
549 struct list_head list; 556 struct tomoyo_acl_head head;
550 const struct tomoyo_path_info *pattern; 557 const struct tomoyo_path_info *pattern;
551 bool is_deleted;
552}; 558};
553 559
554/* 560/*
@@ -556,16 +562,13 @@ struct tomoyo_pattern_entry {
556 * "deny_rewrite" entries. 562 * "deny_rewrite" entries.
557 * It has following fields. 563 * It has following fields.
558 * 564 *
559 * (1) "list" which is linked to tomoyo_no_rewrite_list . 565 * (1) "head" is "struct tomoyo_acl_head".
560 * (2) "pattern" is a pathname which is by default not permitted to modify 566 * (2) "pattern" is a pathname which is by default not permitted to modify
561 * already existing content. 567 * already existing content.
562 * (3) "is_deleted" is a bool which is true if marked as deleted, false
563 * otherwise.
564 */ 568 */
565struct tomoyo_no_rewrite_entry { 569struct tomoyo_no_rewrite_entry {
566 struct list_head list; 570 struct tomoyo_acl_head head;
567 const struct tomoyo_path_info *pattern; 571 const struct tomoyo_path_info *pattern;
568 bool is_deleted;
569}; 572};
570 573
571/* 574/*
@@ -573,25 +576,22 @@ struct tomoyo_no_rewrite_entry {
573 * "initialize_domain" and "no_initialize_domain" entries. 576 * "initialize_domain" and "no_initialize_domain" entries.
574 * It has following fields. 577 * It has following fields.
575 * 578 *
576 * (1) "list" which is linked to tomoyo_domain_initializer_list . 579 * (1) "head" is "struct tomoyo_acl_head".
577 * (2) "domainname" which is "a domainname" or "the last component of a 580 * (2) "is_not" is a bool which is true if "no_initialize_domain", false
578 * domainname". This field is NULL if "from" clause is not specified.
579 * (3) "program" which is a program's pathname.
580 * (4) "is_deleted" is a bool which is true if marked as deleted, false
581 * otherwise. 581 * otherwise.
582 * (5) "is_not" is a bool which is true if "no_initialize_domain", false 582 * (3) "is_last_name" is a bool which is true if "domainname" is "the last
583 * otherwise.
584 * (6) "is_last_name" is a bool which is true if "domainname" is "the last
585 * component of a domainname", false otherwise. 583 * component of a domainname", false otherwise.
584 * (4) "domainname" which is "a domainname" or "the last component of a
585 * domainname". This field is NULL if "from" clause is not specified.
586 * (5) "program" which is a program's pathname.
586 */ 587 */
587struct tomoyo_domain_initializer_entry { 588struct tomoyo_domain_initializer_entry {
588 struct list_head list; 589 struct tomoyo_acl_head head;
589 const struct tomoyo_path_info *domainname; /* This may be NULL */
590 const struct tomoyo_path_info *program;
591 bool is_deleted;
592 bool is_not; /* True if this entry is "no_initialize_domain". */ 590 bool is_not; /* True if this entry is "no_initialize_domain". */
593 /* True if the domainname is tomoyo_get_last_name(). */ 591 /* True if the domainname is tomoyo_get_last_name(). */
594 bool is_last_name; 592 bool is_last_name;
593 const struct tomoyo_path_info *domainname; /* This may be NULL */
594 const struct tomoyo_path_info *program;
595}; 595};
596 596
597/* 597/*
@@ -599,26 +599,23 @@ struct tomoyo_domain_initializer_entry {
599 * "keep_domain" and "no_keep_domain" entries. 599 * "keep_domain" and "no_keep_domain" entries.
600 * It has following fields. 600 * It has following fields.
601 * 601 *
602 * (1) "list" which is linked to tomoyo_domain_keeper_list . 602 * (1) "head" is "struct tomoyo_acl_head".
603 * (2) "domainname" which is "a domainname" or "the last component of a 603 * (2) "is_not" is a bool which is true if "no_initialize_domain", false
604 * domainname".
605 * (3) "program" which is a program's pathname.
606 * This field is NULL if "from" clause is not specified.
607 * (4) "is_deleted" is a bool which is true if marked as deleted, false
608 * otherwise. 604 * otherwise.
609 * (5) "is_not" is a bool which is true if "no_initialize_domain", false 605 * (3) "is_last_name" is a bool which is true if "domainname" is "the last
610 * otherwise.
611 * (6) "is_last_name" is a bool which is true if "domainname" is "the last
612 * component of a domainname", false otherwise. 606 * component of a domainname", false otherwise.
607 * (4) "domainname" which is "a domainname" or "the last component of a
608 * domainname".
609 * (5) "program" which is a program's pathname.
610 * This field is NULL if "from" clause is not specified.
613 */ 611 */
614struct tomoyo_domain_keeper_entry { 612struct tomoyo_domain_keeper_entry {
615 struct list_head list; 613 struct tomoyo_acl_head head;
616 const struct tomoyo_path_info *domainname;
617 const struct tomoyo_path_info *program; /* This may be NULL */
618 bool is_deleted;
619 bool is_not; /* True if this entry is "no_keep_domain". */ 614 bool is_not; /* True if this entry is "no_keep_domain". */
620 /* True if the domainname is tomoyo_get_last_name(). */ 615 /* True if the domainname is tomoyo_get_last_name(). */
621 bool is_last_name; 616 bool is_last_name;
617 const struct tomoyo_path_info *domainname;
618 const struct tomoyo_path_info *program; /* This may be NULL */
622}; 619};
623 620
624/* 621/*
@@ -626,34 +623,28 @@ struct tomoyo_domain_keeper_entry {
626 * "aggregator" entries. 623 * "aggregator" entries.
627 * It has following fields. 624 * It has following fields.
628 * 625 *
629 * (1) "list" which is linked to tomoyo_aggregator_list . 626 * (1) "head" is "struct tomoyo_acl_head".
630 * (2) "original_name" which is originally requested name. 627 * (2) "original_name" which is originally requested name.
631 * (3) "aggregated_name" which is name to rewrite. 628 * (3) "aggregated_name" which is name to rewrite.
632 * (4) "is_deleted" is a bool which is true if marked as deleted, false
633 * otherwise.
634 */ 629 */
635struct tomoyo_aggregator_entry { 630struct tomoyo_aggregator_entry {
636 struct list_head list; 631 struct tomoyo_acl_head head;
637 const struct tomoyo_path_info *original_name; 632 const struct tomoyo_path_info *original_name;
638 const struct tomoyo_path_info *aggregated_name; 633 const struct tomoyo_path_info *aggregated_name;
639 bool is_deleted;
640}; 634};
641 635
642/* 636/*
643 * tomoyo_alias_entry is a structure which is used for holding "alias" entries. 637 * tomoyo_alias_entry is a structure which is used for holding "alias" entries.
644 * It has following fields. 638 * It has following fields.
645 * 639 *
646 * (1) "list" which is linked to tomoyo_alias_list . 640 * (1) "head" is "struct tomoyo_acl_head".
647 * (2) "original_name" which is a dereferenced pathname. 641 * (2) "original_name" which is a dereferenced pathname.
648 * (3) "aliased_name" which is a symlink's pathname. 642 * (3) "aliased_name" which is a symlink's pathname.
649 * (4) "is_deleted" is a bool which is true if marked as deleted, false
650 * otherwise.
651 */ 643 */
652struct tomoyo_alias_entry { 644struct tomoyo_alias_entry {
653 struct list_head list; 645 struct tomoyo_acl_head head;
654 const struct tomoyo_path_info *original_name; 646 const struct tomoyo_path_info *original_name;
655 const struct tomoyo_path_info *aliased_name; 647 const struct tomoyo_path_info *aliased_name;
656 bool is_deleted;
657}; 648};
658 649
659/* 650/*
@@ -662,19 +653,16 @@ struct tomoyo_alias_entry {
662 * /sys/kernel/security/tomoyo/ interface. 653 * /sys/kernel/security/tomoyo/ interface.
663 * It has following fields. 654 * It has following fields.
664 * 655 *
665 * (1) "list" which is linked to tomoyo_policy_manager_list . 656 * (1) "head" is "struct tomoyo_acl_head".
666 * (2) "manager" is a domainname or a program's pathname. 657 * (2) "is_domain" is a bool which is true if "manager" is a domainname, false
667 * (3) "is_domain" is a bool which is true if "manager" is a domainname, false
668 * otherwise.
669 * (4) "is_deleted" is a bool which is true if marked as deleted, false
670 * otherwise. 658 * otherwise.
659 * (3) "manager" is a domainname or a program's pathname.
671 */ 660 */
672struct tomoyo_policy_manager_entry { 661struct tomoyo_policy_manager_entry {
673 struct list_head list; 662 struct tomoyo_acl_head head;
663 bool is_domain; /* True if manager is a domainname. */
674 /* A path to program or a domainname. */ 664 /* A path to program or a domainname. */
675 const struct tomoyo_path_info *manager; 665 const struct tomoyo_path_info *manager;
676 bool is_domain; /* True if manager is a domainname. */
677 bool is_deleted; /* True if this entry is deleted. */
678}; 666};
679 667
680struct tomoyo_preference { 668struct tomoyo_preference {