aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r--security/tomoyo/common.h54
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 */
316struct tomoyo_name_entry { 316struct 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 */
582struct tomoyo_globally_readable_file_entry { 582struct 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 */
596struct tomoyo_pattern_entry { 596struct 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 */
610struct tomoyo_no_rewrite_entry { 610struct 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 */
647struct tomoyo_aggregator_entry { 647struct 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 */
664struct tomoyo_policy_manager_entry { 664struct 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);
749bool tomoyo_tokenize(char *buffer, char *w[], size_t size); 749bool 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? */
751bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain); 751bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain);
752/* Get the last component of the given domainname. */
753const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain);
754/* Fill "struct tomoyo_request_info". */ 752/* Fill "struct tomoyo_request_info". */
755int tomoyo_init_request_info(struct tomoyo_request_info *r, 753int 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,
759int tomoyo_mount_permission(char *dev_name, struct path *path, char *type, 757int 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. */
762int tomoyo_write_aggregator_policy(char *data, const bool is_delete); 760int tomoyo_write_aggregator(char *data, const bool is_delete);
763int tomoyo_write_transition_control(char *data, const bool is_delete, 761int 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 */
772int tomoyo_write_file_policy(char *data, struct tomoyo_domain_info *domain, 770int 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. */
775int tomoyo_write_globally_readable_policy(char *data, const bool is_delete); 773int 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. */
777int tomoyo_write_mount_policy(char *data, struct tomoyo_domain_info *domain, 775int 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. */
780int tomoyo_write_no_rewrite_policy(char *data, const bool is_delete); 778int 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. */
782int tomoyo_write_pattern_policy(char *data, const bool is_delete); 780int 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. */
784int tomoyo_write_group(char *data, const bool is_delete, const u8 type); 782int tomoyo_write_group(char *data, const bool is_delete, const u8 type);
785int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...) 783int 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. */
788struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname); 786struct 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. */
790struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char * 788struct tomoyo_domain_info *tomoyo_assign_domain(const char *domainname,
791 domainname, 789 const u8 profile);
792 const u8 profile);
793struct tomoyo_profile *tomoyo_profile(const u8 profile); 790struct 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 */
821char *tomoyo_realpath_from_path(struct path *path); 818char *tomoyo_realpath_from_path(struct path *path);
822/* Get patterned pathname. */ 819/* Get patterned pathname. */
823const char *tomoyo_file_pattern(const struct tomoyo_path_info *filename); 820const char *tomoyo_pattern(const struct tomoyo_path_info *filename);
824 821
825/* Check memory quota. */ 822/* Check memory quota. */
826bool tomoyo_memory_ok(void *ptr); 823bool tomoyo_memory_ok(void *ptr);
@@ -882,7 +879,6 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size,
882void tomoyo_check_acl(struct tomoyo_request_info *r, 879void 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 *));
885const 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)
959static inline void tomoyo_put_name(const struct tomoyo_path_info *name) 955static 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}