@@ -77,7 +77,7 @@ static int may_change_ptraced_domain(const struct cred *to_cred,
77
77
/**** TODO: dedup to aa_label_match - needs perm and dfa, merging
78
78
* specifically this is an exact copy of aa_label_match except
79
79
* aa_compute_perms is replaced with aa_compute_fperms
80
- * and policy. dfa with file. dfa
80
+ * and policy-> dfa with file-> dfa
81
81
****/
82
82
/* match a profile and its associated ns component if needed
83
83
* Assumes visibility test has already been done.
@@ -93,16 +93,16 @@ static inline aa_state_t match_component(struct aa_profile *profile,
93
93
const char * ns_name ;
94
94
95
95
if (stack )
96
- state = aa_dfa_match (rules -> file . dfa , state , "&" );
96
+ state = aa_dfa_match (rules -> file -> dfa , state , "&" );
97
97
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 );
99
99
100
100
/* try matching with namespace name and then profile */
101
101
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 );
106
106
}
107
107
108
108
/**
@@ -150,12 +150,12 @@ static int label_compound_match(struct aa_profile *profile,
150
150
label_for_each_cont (i , label , tp ) {
151
151
if (!aa_ns_visible (profile -> ns , tp -> ns , subns ))
152
152
continue ;
153
- state = aa_dfa_match (rules -> file . dfa , state , "//&" );
153
+ state = aa_dfa_match (rules -> file -> dfa , state , "//&" );
154
154
state = match_component (profile , tp , false, state );
155
155
if (!state )
156
156
goto fail ;
157
157
}
158
- * perms = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
158
+ * perms = * (aa_lookup_fperms (rules -> file , state , & cond ));
159
159
aa_apply_modes_to_perms (profile , perms );
160
160
if ((perms -> allow & request ) != request )
161
161
return - EACCES ;
@@ -210,7 +210,7 @@ static int label_components_match(struct aa_profile *profile,
210
210
return 0 ;
211
211
212
212
next :
213
- tmp = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
213
+ tmp = * (aa_lookup_fperms (rules -> file , state , & cond ));
214
214
aa_apply_modes_to_perms (profile , & tmp );
215
215
aa_perms_accum (perms , & tmp );
216
216
label_for_each_cont (i , label , tp ) {
@@ -219,7 +219,7 @@ static int label_components_match(struct aa_profile *profile,
219
219
state = match_component (profile , tp , stack , start );
220
220
if (!state )
221
221
goto fail ;
222
- tmp = * (aa_lookup_fperms (& ( rules -> file ) , state , & cond ));
222
+ tmp = * (aa_lookup_fperms (rules -> file , state , & cond ));
223
223
aa_apply_modes_to_perms (profile , & tmp );
224
224
aa_perms_accum (perms , & tmp );
225
225
}
@@ -317,7 +317,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
317
317
might_sleep ();
318
318
319
319
/* 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 );
321
321
d = bprm -> file -> f_path .dentry ;
322
322
323
323
for (i = 0 ; i < attach -> xattr_count ; i ++ ) {
@@ -331,20 +331,20 @@ static int aa_xattrs_match(const struct linux_binprm *bprm,
331
331
* that not present xattr can be distinguished from a 0
332
332
* length value or rule that matches any value
333
333
*/
334
- state = aa_dfa_null_transition (attach -> xmatch . dfa ,
334
+ state = aa_dfa_null_transition (attach -> xmatch -> dfa ,
335
335
state );
336
336
/* Check xattr value */
337
- state = aa_dfa_match_len (attach -> xmatch . dfa , state ,
337
+ state = aa_dfa_match_len (attach -> xmatch -> dfa , state ,
338
338
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 ;
341
341
if (!(perm & MAY_EXEC )) {
342
342
ret = - EINVAL ;
343
343
goto out ;
344
344
}
345
345
}
346
346
/* transition to next element */
347
- state = aa_dfa_outofband_transition (attach -> xmatch . dfa , state );
347
+ state = aa_dfa_outofband_transition (attach -> xmatch -> dfa , state );
348
348
if (size < 0 ) {
349
349
/*
350
350
* No xattr match, so verify if transition to
@@ -413,16 +413,16 @@ static struct aa_label *find_attach(const struct linux_binprm *bprm,
413
413
* as another profile, signal a conflict and refuse to
414
414
* match.
415
415
*/
416
- if (attach -> xmatch . dfa ) {
416
+ if (attach -> xmatch -> dfa ) {
417
417
unsigned int count ;
418
418
aa_state_t state ;
419
419
u32 index , perm ;
420
420
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 ],
423
423
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 ;
426
426
/* any accepting state means a valid match. */
427
427
if (perm & MAY_EXEC ) {
428
428
int ret = 0 ;
@@ -525,7 +525,7 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,
525
525
/* TODO: move lookup parsing to unpack time so this is a straight
526
526
* index into the resultant label
527
527
*/
528
- for (* name = rules -> file . trans .table [index ]; !label && * name ;
528
+ for (* name = rules -> file -> trans .table [index ]; !label && * name ;
529
529
* name = next_name (xtype , * name )) {
530
530
if (xindex & AA_X_CHILD ) {
531
531
struct aa_profile * new_profile ;
@@ -579,7 +579,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
579
579
break ;
580
580
case AA_X_TABLE :
581
581
/* 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 ];
583
583
if (* stack != '&' ) {
584
584
/* released by caller */
585
585
new = x_table_lookup (profile , xindex , lookupname );
@@ -638,7 +638,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
638
638
typeof (* rules ), list );
639
639
struct aa_label * new = NULL ;
640
640
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 ];
642
642
struct aa_perms perms = {};
643
643
bool nonewprivs = false;
644
644
int error = 0 ;
@@ -672,7 +672,7 @@ static struct aa_label *profile_transition(const struct cred *subj_cred,
672
672
}
673
673
674
674
/* 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 );
676
676
if (perms .allow & MAY_EXEC ) {
677
677
/* exec permission determine how to transition */
678
678
new = x_to_label (profile , bprm , name , perms .xindex , & target ,
@@ -738,7 +738,7 @@ static int profile_onexec(const struct cred *subj_cred,
738
738
{
739
739
struct aa_ruleset * rules = list_first_entry (& profile -> rules ,
740
740
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 ];
742
742
struct aa_perms perms = {};
743
743
const char * xname = NULL , * info = "change_profile onexec" ;
744
744
int error = - EACCES ;
@@ -771,7 +771,7 @@ static int profile_onexec(const struct cred *subj_cred,
771
771
}
772
772
773
773
/* 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 );
775
775
if (!(perms .allow & AA_MAY_ONEXEC )) {
776
776
info = "no change_onexec valid for executable" ;
777
777
goto audit ;
@@ -780,7 +780,7 @@ static int profile_onexec(const struct cred *subj_cred,
780
780
* onexec permission is linked to exec with a standard pairing
781
781
* exec\0change_profile
782
782
*/
783
- state = aa_dfa_null_transition (rules -> file . dfa , state );
783
+ state = aa_dfa_null_transition (rules -> file -> dfa , state );
784
784
error = change_profile_perms (profile , onexec , stack , AA_MAY_ONEXEC ,
785
785
state , & perms );
786
786
if (error ) {
@@ -1300,7 +1300,7 @@ static int change_profile_perms_wrapper(const char *op, const char *name,
1300
1300
1301
1301
if (!error )
1302
1302
error = change_profile_perms (profile , target , stack , request ,
1303
- rules -> file . start [AA_CLASS_FILE ],
1303
+ rules -> file -> start [AA_CLASS_FILE ],
1304
1304
perms );
1305
1305
if (error )
1306
1306
error = aa_audit_file (subj_cred , profile , perms , op , request ,
0 commit comments