@@ -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 }
@@ -317,7 +317,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
317317 might_sleep ();
318318
319319 /* transition from exec match to xattr set */
320- state = aa_dfa_outofband_transition (attach -> xmatch . dfa , state );
320+ state = aa_dfa_outofband_transition (attach -> xmatch -> dfa , state );
321321 d = bprm -> file -> f_path .dentry ;
322322
323323 for (i = 0 ; i < attach -> xattr_count ; i ++ ) {
@@ -331,20 +331,20 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
331331 * that not present xattr can be distinguished from a 0
332332 * length value or rule that matches any value
333333 */
334- state = aa_dfa_null_transition (attach -> xmatch . dfa ,
334+ state = aa_dfa_null_transition (attach -> xmatch -> dfa ,
335335 state );
336336 /* Check xattr value */
337- state = aa_dfa_match_len (attach -> xmatch . dfa , state ,
337+ state = aa_dfa_match_len (attach -> xmatch -> dfa , state ,
338338 value , size );
339- index = ACCEPT_TABLE (attach -> xmatch . dfa )[state ];
340- perm = attach -> xmatch . perms [index ].allow ;
339+ index = ACCEPT_TABLE (attach -> xmatch -> dfa )[state ];
340+ perm = attach -> xmatch -> perms [index ].allow ;
341341 if (!(perm & MAY_EXEC )) {
342342 ret = - EINVAL ;
343343 goto out ;
344344 }
345345 }
346346 /* transition to next element */
347- state = aa_dfa_outofband_transition (attach -> xmatch . dfa , state );
347+ state = aa_dfa_outofband_transition (attach -> xmatch -> dfa , state );
348348 if (size < 0 ) {
349349 /*
350350 * No xattr match, so verify if transition to
@@ -413,16 +413,16 @@ static struct aa_label *find_attach(const struct linux_binprm *bprm,
413413 * as another profile, signal a conflict and refuse to
414414 * match.
415415 */
416- if (attach -> xmatch . dfa ) {
416+ if (attach -> xmatch -> dfa ) {
417417 unsigned int count ;
418418 aa_state_t state ;
419419 u32 index , perm ;
420420
421- state = aa_dfa_leftmatch (attach -> xmatch . dfa ,
422- attach -> xmatch . start [AA_CLASS_XMATCH ],
421+ state = aa_dfa_leftmatch (attach -> xmatch -> dfa ,
422+ attach -> xmatch -> start [AA_CLASS_XMATCH ],
423423 name , & count );
424- index = ACCEPT_TABLE (attach -> xmatch . dfa )[state ];
425- perm = attach -> xmatch . perms [index ].allow ;
424+ index = ACCEPT_TABLE (attach -> xmatch -> dfa )[state ];
425+ perm = attach -> xmatch -> perms [index ].allow ;
426426 /* any accepting state means a valid match. */
427427 if (perm & MAY_EXEC ) {
428428 int ret = 0 ;
@@ -525,7 +525,7 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,
525525 /* TODO: move lookup parsing to unpack time so this is a straight
526526 * index into the resultant label
527527 */
528- for (* name = rules -> file . trans .table [index ]; !label && * name ;
528+ for (* name = rules -> file -> trans .table [index ]; !label && * name ;
529529 * name = next_name (xtype , * name )) {
530530 if (xindex & AA_X_CHILD ) {
531531 struct aa_profile * new_profile ;
@@ -579,7 +579,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
579579 break ;
580580 case AA_X_TABLE :
581581 /* TODO: fix when perm mapping done at unload */
582- stack = rules -> file . trans .table [xindex & AA_X_INDEX_MASK ];
582+ stack = rules -> file -> trans .table [xindex & AA_X_INDEX_MASK ];
583583 if (* stack != '&' ) {
584584 /* released by caller */
585585 new = x_table_lookup (profile , xindex , lookupname );
@@ -638,7 +638,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
638638 typeof (* rules ), list );
639639 struct aa_label * new = NULL ;
640640 const char * info = NULL , * name = NULL , * target = NULL ;
641- aa_state_t state = rules -> file . start [AA_CLASS_FILE ];
641+ aa_state_t state = rules -> file -> start [AA_CLASS_FILE ];
642642 struct aa_perms perms = {};
643643 bool nonewprivs = false;
644644 int error = 0 ;
@@ -672,7 +672,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
672672 }
673673
674674 /* find exec permissions for name */
675- state = aa_str_perms (& ( rules -> file ) , state , name , cond , & perms );
675+ state = aa_str_perms (rules -> file , state , name , cond , & perms );
676676 if (perms .allow & MAY_EXEC ) {
677677 /* exec permission determine how to transition */
678678 new = x_to_label (profile , bprm , name , perms .xindex , & target ,
@@ -738,7 +738,7 @@ static int profile_onexec(const struct cred *subj_cred,
738738{
739739 struct aa_ruleset * rules = list_first_entry (& profile -> rules ,
740740 typeof (* rules ), list );
741- aa_state_t state = rules -> file . start [AA_CLASS_FILE ];
741+ aa_state_t state = rules -> file -> start [AA_CLASS_FILE ];
742742 struct aa_perms perms = {};
743743 const char * xname = NULL , * info = "change_profile onexec" ;
744744 int error = - EACCES ;
@@ -771,7 +771,7 @@ static int profile_onexec(const struct cred *subj_cred,
771771 }
772772
773773 /* find exec permissions for name */
774- state = aa_str_perms (& ( rules -> file ) , state , xname , cond , & perms );
774+ state = aa_str_perms (rules -> file , state , xname , cond , & perms );
775775 if (!(perms .allow & AA_MAY_ONEXEC )) {
776776 info = "no change_onexec valid for executable" ;
777777 goto audit ;
@@ -780,7 +780,7 @@ static int profile_onexec(const struct cred *subj_cred,
780780 * onexec permission is linked to exec with a standard pairing
781781 * exec\0change_profile
782782 */
783- state = aa_dfa_null_transition (rules -> file . dfa , state );
783+ state = aa_dfa_null_transition (rules -> file -> dfa , state );
784784 error = change_profile_perms (profile , onexec , stack , AA_MAY_ONEXEC ,
785785 state , & perms );
786786 if (error ) {
@@ -1300,7 +1300,7 @@ static int change_profile_perms_wrapper(const char *op, const char *name,
13001300
13011301 if (!error )
13021302 error = change_profile_perms (profile , target , stack , request ,
1303- rules -> file . start [AA_CLASS_FILE ],
1303+ rules -> file -> start [AA_CLASS_FILE ],
13041304 perms );
13051305 if (error )
13061306 error = aa_audit_file (subj_cred , profile , perms , op , request ,
0 commit comments