diff options
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r-- | security/tomoyo/common.h | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index ef8fecddb65a..b8b2dac656f1 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
@@ -310,10 +310,10 @@ struct tomoyo_path_info { | |||
310 | }; | 310 | }; |
311 | 311 | ||
312 | /* | 312 | /* |
313 | * tomoyo_name_entry is a structure which is used for linking | 313 | * tomoyo_name is a structure which is used for linking |
314 | * "struct tomoyo_path_info" into tomoyo_name_list . | 314 | * "struct tomoyo_path_info" into tomoyo_name_list . |
315 | */ | 315 | */ |
316 | struct tomoyo_name_entry { | 316 | struct tomoyo_name { |
317 | struct list_head list; | 317 | struct list_head list; |
318 | atomic_t users; | 318 | atomic_t users; |
319 | struct tomoyo_path_info entry; | 319 | struct tomoyo_path_info entry; |
@@ -572,20 +572,20 @@ struct tomoyo_io_buffer { | |||
572 | }; | 572 | }; |
573 | 573 | ||
574 | /* | 574 | /* |
575 | * tomoyo_globally_readable_file_entry is a structure which is used for holding | 575 | * tomoyo_readable_file is a structure which is used for holding |
576 | * "allow_read" entries. | 576 | * "allow_read" entries. |
577 | * It has following fields. | 577 | * It has following fields. |
578 | * | 578 | * |
579 | * (1) "head" is "struct tomoyo_acl_head". | 579 | * (1) "head" is "struct tomoyo_acl_head". |
580 | * (2) "filename" is a pathname which is allowed to open(O_RDONLY). | 580 | * (2) "filename" is a pathname which is allowed to open(O_RDONLY). |
581 | */ | 581 | */ |
582 | struct tomoyo_globally_readable_file_entry { | 582 | struct tomoyo_readable_file { |
583 | struct tomoyo_acl_head head; | 583 | struct tomoyo_acl_head head; |
584 | const struct tomoyo_path_info *filename; | 584 | const struct tomoyo_path_info *filename; |
585 | }; | 585 | }; |
586 | 586 | ||
587 | /* | 587 | /* |
588 | * tomoyo_pattern_entry is a structure which is used for holding | 588 | * tomoyo_no_pattern is a structure which is used for holding |
589 | * "file_pattern" entries. | 589 | * "file_pattern" entries. |
590 | * It has following fields. | 590 | * It has following fields. |
591 | * | 591 | * |
@@ -593,13 +593,13 @@ struct tomoyo_globally_readable_file_entry { | |||
593 | * (2) "pattern" is a pathname pattern which is used for converting pathnames | 593 | * (2) "pattern" is a pathname pattern which is used for converting pathnames |
594 | * to pathname patterns during learning mode. | 594 | * to pathname patterns during learning mode. |
595 | */ | 595 | */ |
596 | struct tomoyo_pattern_entry { | 596 | struct tomoyo_no_pattern { |
597 | struct tomoyo_acl_head head; | 597 | struct tomoyo_acl_head head; |
598 | const struct tomoyo_path_info *pattern; | 598 | const struct tomoyo_path_info *pattern; |
599 | }; | 599 | }; |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * tomoyo_no_rewrite_entry is a structure which is used for holding | 602 | * tomoyo_no_rewrite is a structure which is used for holding |
603 | * "deny_rewrite" entries. | 603 | * "deny_rewrite" entries. |
604 | * It has following fields. | 604 | * It has following fields. |
605 | * | 605 | * |
@@ -607,7 +607,7 @@ struct tomoyo_pattern_entry { | |||
607 | * (2) "pattern" is a pathname which is by default not permitted to modify | 607 | * (2) "pattern" is a pathname which is by default not permitted to modify |
608 | * already existing content. | 608 | * already existing content. |
609 | */ | 609 | */ |
610 | struct tomoyo_no_rewrite_entry { | 610 | struct tomoyo_no_rewrite { |
611 | struct tomoyo_acl_head head; | 611 | struct tomoyo_acl_head head; |
612 | const struct tomoyo_path_info *pattern; | 612 | const struct tomoyo_path_info *pattern; |
613 | }; | 613 | }; |
@@ -636,7 +636,7 @@ struct tomoyo_transition_control { | |||
636 | }; | 636 | }; |
637 | 637 | ||
638 | /* | 638 | /* |
639 | * tomoyo_aggregator_entry is a structure which is used for holding | 639 | * tomoyo_aggregator is a structure which is used for holding |
640 | * "aggregator" entries. | 640 | * "aggregator" entries. |
641 | * It has following fields. | 641 | * It has following fields. |
642 | * | 642 | * |
@@ -644,14 +644,14 @@ struct tomoyo_transition_control { | |||
644 | * (2) "original_name" which is originally requested name. | 644 | * (2) "original_name" which is originally requested name. |
645 | * (3) "aggregated_name" which is name to rewrite. | 645 | * (3) "aggregated_name" which is name to rewrite. |
646 | */ | 646 | */ |
647 | struct tomoyo_aggregator_entry { | 647 | struct tomoyo_aggregator { |
648 | struct tomoyo_acl_head head; | 648 | struct tomoyo_acl_head head; |
649 | const struct tomoyo_path_info *original_name; | 649 | const struct tomoyo_path_info *original_name; |
650 | const struct tomoyo_path_info *aggregated_name; | 650 | const struct tomoyo_path_info *aggregated_name; |
651 | }; | 651 | }; |
652 | 652 | ||
653 | /* | 653 | /* |
654 | * tomoyo_policy_manager_entry is a structure which is used for holding list of | 654 | * tomoyo_manager is a structure which is used for holding list of |
655 | * domainnames or programs which are permitted to modify configuration via | 655 | * domainnames or programs which are permitted to modify configuration via |
656 | * /sys/kernel/security/tomoyo/ interface. | 656 | * /sys/kernel/security/tomoyo/ interface. |
657 | * It has following fields. | 657 | * It has following fields. |
@@ -661,7 +661,7 @@ struct tomoyo_aggregator_entry { | |||
661 | * otherwise. | 661 | * otherwise. |
662 | * (3) "manager" is a domainname or a program's pathname. | 662 | * (3) "manager" is a domainname or a program's pathname. |
663 | */ | 663 | */ |
664 | struct tomoyo_policy_manager_entry { | 664 | struct tomoyo_manager { |
665 | struct tomoyo_acl_head head; | 665 | struct tomoyo_acl_head head; |
666 | bool is_domain; /* True if manager is a domainname. */ | 666 | bool is_domain; /* True if manager is a domainname. */ |
667 | /* A path to program or a domainname. */ | 667 | /* A path to program or a domainname. */ |
@@ -749,8 +749,6 @@ bool tomoyo_parse_number_union(char *data, struct tomoyo_number_union *num); | |||
749 | bool tomoyo_tokenize(char *buffer, char *w[], size_t size); | 749 | bool tomoyo_tokenize(char *buffer, char *w[], size_t size); |
750 | /* Write domain policy violation warning message to console? */ | 750 | /* Write domain policy violation warning message to console? */ |
751 | bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain); | 751 | bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain); |
752 | /* Get the last component of the given domainname. */ | ||
753 | const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain); | ||
754 | /* Fill "struct tomoyo_request_info". */ | 752 | /* Fill "struct tomoyo_request_info". */ |
755 | int tomoyo_init_request_info(struct tomoyo_request_info *r, | 753 | int tomoyo_init_request_info(struct tomoyo_request_info *r, |
756 | struct tomoyo_domain_info *domain, | 754 | struct tomoyo_domain_info *domain, |
@@ -759,7 +757,7 @@ int tomoyo_init_request_info(struct tomoyo_request_info *r, | |||
759 | int tomoyo_mount_permission(char *dev_name, struct path *path, char *type, | 757 | int tomoyo_mount_permission(char *dev_name, struct path *path, char *type, |
760 | unsigned long flags, void *data_page); | 758 | unsigned long flags, void *data_page); |
761 | /* Create "aggregator" entry in exception policy. */ | 759 | /* Create "aggregator" entry in exception policy. */ |
762 | int tomoyo_write_aggregator_policy(char *data, const bool is_delete); | 760 | int tomoyo_write_aggregator(char *data, const bool is_delete); |
763 | int tomoyo_write_transition_control(char *data, const bool is_delete, | 761 | int tomoyo_write_transition_control(char *data, const bool is_delete, |
764 | const u8 type); | 762 | const u8 type); |
765 | /* | 763 | /* |
@@ -769,17 +767,17 @@ int tomoyo_write_transition_control(char *data, const bool is_delete, | |||
769 | * "allow_truncate", "allow_symlink", "allow_rewrite", "allow_rename" and | 767 | * "allow_truncate", "allow_symlink", "allow_rewrite", "allow_rename" and |
770 | * "allow_link" entry in domain policy. | 768 | * "allow_link" entry in domain policy. |
771 | */ | 769 | */ |
772 | int tomoyo_write_file_policy(char *data, struct tomoyo_domain_info *domain, | 770 | int tomoyo_write_file(char *data, struct tomoyo_domain_info *domain, |
773 | const bool is_delete); | 771 | const bool is_delete); |
774 | /* Create "allow_read" entry in exception policy. */ | 772 | /* Create "allow_read" entry in exception policy. */ |
775 | int tomoyo_write_globally_readable_policy(char *data, const bool is_delete); | 773 | int tomoyo_write_globally_readable(char *data, const bool is_delete); |
776 | /* Create "allow_mount" entry in domain policy. */ | 774 | /* Create "allow_mount" entry in domain policy. */ |
777 | int tomoyo_write_mount_policy(char *data, struct tomoyo_domain_info *domain, | 775 | int tomoyo_write_mount(char *data, struct tomoyo_domain_info *domain, |
778 | const bool is_delete); | 776 | const bool is_delete); |
779 | /* Create "deny_rewrite" entry in exception policy. */ | 777 | /* Create "deny_rewrite" entry in exception policy. */ |
780 | int tomoyo_write_no_rewrite_policy(char *data, const bool is_delete); | 778 | int tomoyo_write_no_rewrite(char *data, const bool is_delete); |
781 | /* Create "file_pattern" entry in exception policy. */ | 779 | /* Create "file_pattern" entry in exception policy. */ |
782 | int tomoyo_write_pattern_policy(char *data, const bool is_delete); | 780 | int tomoyo_write_pattern(char *data, const bool is_delete); |
783 | /* Create "path_group"/"number_group" entry in exception policy. */ | 781 | /* Create "path_group"/"number_group" entry in exception policy. */ |
784 | int tomoyo_write_group(char *data, const bool is_delete, const u8 type); | 782 | int tomoyo_write_group(char *data, const bool is_delete, const u8 type); |
785 | int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...) | 783 | int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...) |
@@ -787,9 +785,8 @@ int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...) | |||
787 | /* Find a domain by the given name. */ | 785 | /* Find a domain by the given name. */ |
788 | struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname); | 786 | struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname); |
789 | /* Find or create a domain by the given name. */ | 787 | /* Find or create a domain by the given name. */ |
790 | struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char * | 788 | struct tomoyo_domain_info *tomoyo_assign_domain(const char *domainname, |
791 | domainname, | 789 | const u8 profile); |
792 | const u8 profile); | ||
793 | struct tomoyo_profile *tomoyo_profile(const u8 profile); | 790 | struct tomoyo_profile *tomoyo_profile(const u8 profile); |
794 | /* | 791 | /* |
795 | * Allocate memory for "struct tomoyo_path_group"/"struct tomoyo_number_group". | 792 | * Allocate memory for "struct tomoyo_path_group"/"struct tomoyo_number_group". |
@@ -820,7 +817,7 @@ char *tomoyo_realpath_nofollow(const char *pathname); | |||
820 | */ | 817 | */ |
821 | char *tomoyo_realpath_from_path(struct path *path); | 818 | char *tomoyo_realpath_from_path(struct path *path); |
822 | /* Get patterned pathname. */ | 819 | /* Get patterned pathname. */ |
823 | const char *tomoyo_file_pattern(const struct tomoyo_path_info *filename); | 820 | const char *tomoyo_pattern(const struct tomoyo_path_info *filename); |
824 | 821 | ||
825 | /* Check memory quota. */ | 822 | /* Check memory quota. */ |
826 | bool tomoyo_memory_ok(void *ptr); | 823 | bool tomoyo_memory_ok(void *ptr); |
@@ -882,7 +879,6 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size, | |||
882 | void tomoyo_check_acl(struct tomoyo_request_info *r, | 879 | void tomoyo_check_acl(struct tomoyo_request_info *r, |
883 | bool (*check_entry) (const struct tomoyo_request_info *, | 880 | bool (*check_entry) (const struct tomoyo_request_info *, |
884 | const struct tomoyo_acl_info *)); | 881 | const struct tomoyo_acl_info *)); |
885 | const char *tomoyo_last_word(const char *name); | ||
886 | 882 | ||
887 | /********** External variable definitions. **********/ | 883 | /********** External variable definitions. **********/ |
888 | 884 | ||
@@ -959,8 +955,8 @@ static inline bool tomoyo_invalid(const unsigned char c) | |||
959 | static inline void tomoyo_put_name(const struct tomoyo_path_info *name) | 955 | static inline void tomoyo_put_name(const struct tomoyo_path_info *name) |
960 | { | 956 | { |
961 | if (name) { | 957 | if (name) { |
962 | struct tomoyo_name_entry *ptr = | 958 | struct tomoyo_name *ptr = |
963 | container_of(name, struct tomoyo_name_entry, entry); | 959 | container_of(name, typeof(*ptr), entry); |
964 | atomic_dec(&ptr->users); | 960 | atomic_dec(&ptr->users); |
965 | } | 961 | } |
966 | } | 962 | } |