@@ -77,7 +77,7 @@ static int may_change_ptraced_domain(const struct cred *to_cred,
7777/**** TODO: dedup to aa_label_match - needs perm and dfa, merging
7878 * specifically this is an exact copy of aa_label_match except
7979 * aa_compute_perms is replaced with aa_compute_fperms
80- * and policy. dfa with file. dfa
80+ * and policy-> dfa with file-> dfa
8181 ****/
8282/* match a profile and its associated ns component if needed
8383 * Assumes visibility test has already been done.
@@ -93,16 +93,16 @@ static inline aa_state_t match_component(struct aa_profile *profile,
9393 const char * ns_name ;
9494
9595 if (stack )
96- state = aa_dfa_match (rules -> file . dfa , state , "&" );
96+ state = aa_dfa_match (rules -> file -> dfa , state , "&" );
9797 if (profile -> ns == tp -> ns )
98- return aa_dfa_match (rules -> file . dfa , state , tp -> base .hname );
98+ return aa_dfa_match (rules -> file -> dfa , state , tp -> base .hname );
9999
100100 /* try matching with namespace name and then profile */
101101 ns_name = aa_ns_name (profile -> ns , tp -> ns , true);
102- state = aa_dfa_match_len (rules -> file . dfa , state , ":" , 1 );
103- state = aa_dfa_match (rules -> file . dfa , state , ns_name );
104- state = aa_dfa_match_len (rules -> file . dfa , state , ":" , 1 );
105- return aa_dfa_match (rules -> file . dfa , state , tp -> base .hname );
102+ state = aa_dfa_match_len (rules -> file -> dfa , state , ":" , 1 );
103+ state = aa_dfa_match (rules -> file -> dfa , state , ns_name );
104+ state = aa_dfa_match_len (rules -> file -> dfa , state , ":" , 1 );
105+ return aa_dfa_match (rules -> file -> dfa , state , tp -> base .hname );
106106}
107107
108108/**
@@ -150,12 +150,12 @@ static int label_compound_match(struct aa_profile *profile,
150150 label_for_each_cont (i , label , tp ) {
151151 if (!aa_ns_visible (profile -> ns , tp -> ns , subns ))
152152 continue ;
153- state = aa_dfa_match (rules -> file . dfa , state , "//&" );
153+ state = aa_dfa_match (rules -> file -> dfa , state , "//&" );
154154 state = match_component (profile , tp , false, state );
155155 if (!state )
156156 goto fail ;
157157 }
158- * perms = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
158+ * perms = * (aa_lookup_fperms (rules -> file , state , & cond ));
159159 aa_apply_modes_to_perms (profile , perms );
160160 if ((perms -> allow & request ) != request )
161161 return - EACCES ;
@@ -210,7 +210,7 @@ static int label_components_match(struct aa_profile *profile,
210210 return 0 ;
211211
212212next :
213- tmp = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
213+ tmp = * (aa_lookup_fperms (rules -> file , state , & cond ));
214214 aa_apply_modes_to_perms (profile , & tmp );
215215 aa_perms_accum (perms , & tmp );
216216 label_for_each_cont (i , label , tp ) {
@@ -219,7 +219,7 @@ static int label_components_match(struct aa_profile *profile,
219219 state = match_component (profile , tp , stack , start );
220220 if (!state )
221221 goto fail ;
222- tmp = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
222+ tmp = * (aa_lookup_fperms (rules -> file , state , & cond ));
223223 aa_apply_modes_to_perms (profile , & tmp );
224224 aa_perms_accum (perms , & tmp );
225225 }
@@ -316,7 +316,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
316316 might_sleep ();
317317
318318 /* transition from exec match to xattr set */
319- state = aa_dfa_outofband_transition (attach -> xmatch . dfa , state );
319+ state = aa_dfa_outofband_transition (attach -> xmatch -> dfa , state );
320320 d = bprm -> file -> f_path .dentry ;
321321
322322 for (i = 0 ; i < attach -> xattr_count ; i ++ ) {
@@ -330,20 +330,20 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
330330 * that not present xattr can be distinguished from a 0
331331 * length value or rule that matches any value
332332 */
333- state = aa_dfa_null_transition (attach -> xmatch . dfa ,
333+ state = aa_dfa_null_transition (attach -> xmatch -> dfa ,
334334 state );
335335 /* Check xattr value */
336- state = aa_dfa_match_len (attach -> xmatch . dfa , state ,
336+ state = aa_dfa_match_len (attach -> xmatch -> dfa , state ,
337337 value , size );
338- index = ACCEPT_TABLE (attach -> xmatch . dfa )[state ];
339- perm = attach -> xmatch . perms [index ].allow ;
338+ index = ACCEPT_TABLE (attach -> xmatch -> dfa )[state ];
339+ perm = attach -> xmatch -> perms [index ].allow ;
340340 if (!(perm & MAY_EXEC )) {
341341 ret = - EINVAL ;
342342 goto out ;
343343 }
344344 }
345345 /* transition to next element */
346- state = aa_dfa_outofband_transition (attach -> xmatch . dfa , state );
346+ state = aa_dfa_outofband_transition (attach -> xmatch -> dfa , state );
347347 if (size < 0 ) {
348348 /*
349349 * No xattr match, so verify if transition to
@@ -412,16 +412,16 @@ static struct aa_label *find_attach(const struct linux_binprm *bprm,
412412 * as another profile, signal a conflict and refuse to
413413 * match.
414414 */
415- if (attach -> xmatch . dfa ) {
415+ if (attach -> xmatch -> dfa ) {
416416 unsigned int count ;
417417 aa_state_t state ;
418418 u32 index , perm ;
419419
420- state = aa_dfa_leftmatch (attach -> xmatch . dfa ,
421- attach -> xmatch . start [AA_CLASS_XMATCH ],
420+ state = aa_dfa_leftmatch (attach -> xmatch -> dfa ,
421+ attach -> xmatch -> start [AA_CLASS_XMATCH ],
422422 name , & count );
423- index = ACCEPT_TABLE (attach -> xmatch . dfa )[state ];
424- perm = attach -> xmatch . perms [index ].allow ;
423+ index = ACCEPT_TABLE (attach -> xmatch -> dfa )[state ];
424+ perm = attach -> xmatch -> perms [index ].allow ;
425425 /* any accepting state means a valid match. */
426426 if (perm & MAY_EXEC ) {
427427 int ret = 0 ;
@@ -524,7 +524,7 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,
524524 /* TODO: move lookup parsing to unpack time so this is a straight
525525 * index into the resultant label
526526 */
527- for (* name = rules -> file . trans .table [index ]; !label && * name ;
527+ for (* name = rules -> file -> trans .table [index ]; !label && * name ;
528528 * name = next_name (xtype , * name )) {
529529 if (xindex & AA_X_CHILD ) {
530530 struct aa_profile * new_profile ;
@@ -577,7 +577,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
577577 break ;
578578 case AA_X_TABLE :
579579 /* TODO: fix when perm mapping done at unload */
580- stack = rules -> file . trans .table [xindex & AA_X_INDEX_MASK ];
580+ stack = rules -> file -> trans .table [xindex & AA_X_INDEX_MASK ];
581581 if (* stack != '&' ) {
582582 /* released by caller */
583583 new = x_table_lookup (profile , xindex , lookupname );
@@ -636,7 +636,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
636636 typeof (* rules ), list );
637637 struct aa_label * new = NULL ;
638638 const char * info = NULL , * name = NULL , * target = NULL ;
639- aa_state_t state = rules -> file . start [AA_CLASS_FILE ];
639+ aa_state_t state = rules -> file -> start [AA_CLASS_FILE ];
640640 struct aa_perms perms = {};
641641 bool nonewprivs = false;
642642 int error = 0 ;
@@ -670,7 +670,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
670670 }
671671
672672 /* find exec permissions for name */
673- state = aa_str_perms (& ( rules -> file ) , state , name , cond , & perms );
673+ state = aa_str_perms (rules -> file , state , name , cond , & perms );
674674 if (perms .allow & MAY_EXEC ) {
675675 /* exec permission determine how to transition */
676676 new = x_to_label (profile , bprm , name , perms .xindex , & target ,
@@ -736,7 +736,7 @@ static int profile_onexec(const struct cred *subj_cred,
736736{
737737 struct aa_ruleset * rules = list_first_entry (& profile -> rules ,
738738 typeof (* rules ), list );
739- aa_state_t state = rules -> file . start [AA_CLASS_FILE ];
739+ aa_state_t state = rules -> file -> start [AA_CLASS_FILE ];
740740 struct aa_perms perms = {};
741741 const char * xname = NULL , * info = "change_profile onexec" ;
742742 int error = - EACCES ;
@@ -769,7 +769,7 @@ static int profile_onexec(const struct cred *subj_cred,
769769 }
770770
771771 /* find exec permissions for name */
772- state = aa_str_perms (& ( rules -> file ) , state , xname , cond , & perms );
772+ state = aa_str_perms (rules -> file , state , xname , cond , & perms );
773773 if (!(perms .allow & AA_MAY_ONEXEC )) {
774774 info = "no change_onexec valid for executable" ;
775775 goto audit ;
@@ -778,7 +778,7 @@ static int profile_onexec(const struct cred *subj_cred,
778778 * onexec permission is linked to exec with a standard pairing
779779 * exec\0change_profile
780780 */
781- state = aa_dfa_null_transition (rules -> file . dfa , state );
781+ state = aa_dfa_null_transition (rules -> file -> dfa , state );
782782 error = change_profile_perms (profile , onexec , stack , AA_MAY_ONEXEC ,
783783 state , & perms );
784784 if (error ) {
@@ -1298,7 +1298,7 @@ static int change_profile_perms_wrapper(const char *op, const char *name,
12981298
12991299 if (!error )
13001300 error = change_profile_perms (profile , target , stack , request ,
1301- rules -> file . start [AA_CLASS_FILE ],
1301+ rules -> file -> start [AA_CLASS_FILE ],
13021302 perms );
13031303 if (error )
13041304 error = aa_audit_file (subj_cred , profile , perms , op , request ,
0 commit comments