@@ -112,6 +112,8 @@ enum tomoyo_path_acl_index {
112112 TOMOYO_MAX_PATH_OPERATION
113113};
114114
115+ #define TOMOYO_RW_MASK ((1 << TOMOYO_TYPE_READ) | (1 << TOMOYO_TYPE_WRITE))
116+
115117enum tomoyo_path_number3_acl_index {
116118 TOMOYO_TYPE_MKBLOCK ,
117119 TOMOYO_TYPE_MKCHAR ,
@@ -289,17 +291,19 @@ struct tomoyo_number_group_member {
289291 *
290292 * (1) "list" which is linked to the ->acl_info_list of
291293 * "struct tomoyo_domain_info"
292- * (2) "type" which tells type of the entry (either
293- * "struct tomoyo_path_acl" or "struct tomoyo_path2_acl").
294+ * (2) "is_deleted" is a bool which is true if this domain is marked as
295+ * "deleted", false otherwise.
296+ * (3) "type" which tells type of the entry.
294297 *
295298 * Packing "struct tomoyo_acl_info" allows
296- * "struct tomoyo_path_acl" to embed "u8" + "u16" and
297- * "struct tomoyo_path2_acl" to embed "u8"
298- * without enlarging their structure size.
299+ * "struct tomoyo_path_acl" to embed "u16" and "struct tomoyo_path2_acl"
300+ * "struct tomoyo_path_number_acl" "struct tomoyo_path_number3_acl" to embed
301+ * "u8" without enlarging their structure size.
299302 */
300303struct tomoyo_acl_info {
301304 struct list_head list ;
302- u8 type ;
305+ bool is_deleted ;
306+ u8 type ; /* = one of values in "enum tomoyo_acl_entry_type_index". */
303307} __packed ;
304308
305309/*
@@ -438,17 +442,15 @@ struct tomoyo_path2_acl {
438442 * It has following fields.
439443 *
440444 * (1) "head" which is a "struct tomoyo_acl_info".
441- * (2) "is_deleted " is boolean .
442- * (3) "dev_name " is the device name .
443- * (4) "dir_name " is the mount point .
445+ * (2) "dev_name " is the device name .
446+ * (3) "dir_name " is the mount point .
447+ * (4) "fs_type " is the filesystem type .
444448 * (5) "flags" is the mount flags.
445449 *
446- * Directives held by this structure are "allow_rename", "allow_link" and
447- * "allow_pivot_root".
450+ * Directive held by this structure is "allow_mount".
448451 */
449452struct tomoyo_mount_acl {
450453 struct tomoyo_acl_info head ; /* type = TOMOYO_TYPE_MOUNT_ACL */
451- bool is_deleted ;
452454 struct tomoyo_name_union dev_name ;
453455 struct tomoyo_name_union dir_name ;
454456 struct tomoyo_name_union fs_type ;
@@ -914,6 +916,16 @@ void tomoyo_run_gc(void);
914916
915917void tomoyo_memory_free (void * ptr );
916918
919+ int tomoyo_update_domain (struct tomoyo_acl_info * new_entry , const int size ,
920+ bool is_delete , struct tomoyo_domain_info * domain ,
921+ bool (* check_duplicate ) (const struct tomoyo_acl_info
922+ * ,
923+ const struct tomoyo_acl_info
924+ * ),
925+ bool (* merge_duplicate ) (struct tomoyo_acl_info * ,
926+ struct tomoyo_acl_info * ,
927+ const bool ));
928+
917929/********** External variable definitions. **********/
918930
919931/* Lock for GC. */
@@ -1042,52 +1054,6 @@ static inline bool tomoyo_is_same_number_union
10421054 p1 -> max_type == p2 -> max_type && p1 -> is_group == p2 -> is_group ;
10431055}
10441056
1045- static inline bool tomoyo_is_same_path_acl (const struct tomoyo_path_acl * p1 ,
1046- const struct tomoyo_path_acl * p2 )
1047- {
1048- return tomoyo_is_same_acl_head (& p1 -> head , & p2 -> head ) &&
1049- tomoyo_is_same_name_union (& p1 -> name , & p2 -> name );
1050- }
1051-
1052- static inline bool tomoyo_is_same_path_number3_acl
1053- (const struct tomoyo_path_number3_acl * p1 ,
1054- const struct tomoyo_path_number3_acl * p2 )
1055- {
1056- return tomoyo_is_same_acl_head (& p1 -> head , & p2 -> head )
1057- && tomoyo_is_same_name_union (& p1 -> name , & p2 -> name )
1058- && tomoyo_is_same_number_union (& p1 -> mode , & p2 -> mode )
1059- && tomoyo_is_same_number_union (& p1 -> major , & p2 -> major )
1060- && tomoyo_is_same_number_union (& p1 -> minor , & p2 -> minor );
1061- }
1062-
1063-
1064- static inline bool tomoyo_is_same_path2_acl (const struct tomoyo_path2_acl * p1 ,
1065- const struct tomoyo_path2_acl * p2 )
1066- {
1067- return tomoyo_is_same_acl_head (& p1 -> head , & p2 -> head ) &&
1068- tomoyo_is_same_name_union (& p1 -> name1 , & p2 -> name1 ) &&
1069- tomoyo_is_same_name_union (& p1 -> name2 , & p2 -> name2 );
1070- }
1071-
1072- static inline bool tomoyo_is_same_path_number_acl
1073- (const struct tomoyo_path_number_acl * p1 ,
1074- const struct tomoyo_path_number_acl * p2 )
1075- {
1076- return tomoyo_is_same_acl_head (& p1 -> head , & p2 -> head )
1077- && tomoyo_is_same_name_union (& p1 -> name , & p2 -> name )
1078- && tomoyo_is_same_number_union (& p1 -> number , & p2 -> number );
1079- }
1080-
1081- static inline bool tomoyo_is_same_mount_acl (const struct tomoyo_mount_acl * p1 ,
1082- const struct tomoyo_mount_acl * p2 )
1083- {
1084- return tomoyo_is_same_acl_head (& p1 -> head , & p2 -> head ) &&
1085- tomoyo_is_same_name_union (& p1 -> dev_name , & p2 -> dev_name ) &&
1086- tomoyo_is_same_name_union (& p1 -> dir_name , & p2 -> dir_name ) &&
1087- tomoyo_is_same_name_union (& p1 -> fs_type , & p2 -> fs_type ) &&
1088- tomoyo_is_same_number_union (& p1 -> flags , & p2 -> flags );
1089- }
1090-
10911057static inline bool tomoyo_is_same_domain_initializer_entry
10921058(const struct tomoyo_domain_initializer_entry * p1 ,
10931059 const struct tomoyo_domain_initializer_entry * p2 )
0 commit comments