@@ -759,7 +759,11 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a)
759
759
}
760
760
}
761
761
762
- /* This is the slow part of avc audit with big stack footprint */
762
+ /*
763
+ * This is the slow part of avc audit with big stack footprint.
764
+ * Note that it is non-blocking and can be called from under
765
+ * rcu_read_lock().
766
+ */
763
767
noinline int slow_avc_audit (struct selinux_state * state ,
764
768
u32 ssid , u32 tsid , u16 tclass ,
765
769
u32 requested , u32 audited , u32 denied , int result ,
@@ -826,7 +830,7 @@ int __init avc_add_callback(int (*callback)(u32 event), u32 events)
826
830
* @ssid,@tsid,@tclass : identifier of an AVC entry
827
831
* @seqno : sequence number when decision was made
828
832
* @xpd: extended_perms_decision to be added to the node
829
- * @flags: the AVC_* flags, e.g. AVC_NONBLOCKING, AVC_EXTENDED_PERMS, or 0.
833
+ * @flags: the AVC_* flags, e.g. AVC_EXTENDED_PERMS, or 0.
830
834
*
831
835
* if a valid AVC entry doesn't exist,this function returns -ENOENT.
832
836
* if kmalloc() called internal returns NULL, this function returns -ENOMEM.
@@ -845,21 +849,6 @@ static int avc_update_node(struct selinux_avc *avc,
845
849
struct hlist_head * head ;
846
850
spinlock_t * lock ;
847
851
848
- /*
849
- * If we are in a non-blocking code path, e.g. VFS RCU walk,
850
- * then we must not add permissions to a cache entry
851
- * because we will not audit the denial. Otherwise,
852
- * during the subsequent blocking retry (e.g. VFS ref walk), we
853
- * will find the permissions already granted in the cache entry
854
- * and won't audit anything at all, leading to silent denials in
855
- * permissive mode that only appear when in enforcing mode.
856
- *
857
- * See the corresponding handling of MAY_NOT_BLOCK in avc_audit()
858
- * and selinux_inode_permission().
859
- */
860
- if (flags & AVC_NONBLOCKING )
861
- return 0 ;
862
-
863
852
node = avc_alloc_node (avc );
864
853
if (!node ) {
865
854
rc = - ENOMEM ;
@@ -1120,7 +1109,7 @@ int avc_has_extended_perms(struct selinux_state *state,
1120
1109
* @tsid: target security identifier
1121
1110
* @tclass: target security class
1122
1111
* @requested: requested permissions, interpreted based on @tclass
1123
- * @flags: AVC_STRICT, AVC_NONBLOCKING, or 0
1112
+ * @flags: AVC_STRICT or 0
1124
1113
* @avd: access vector decisions
1125
1114
*
1126
1115
* Check the AVC to determine whether the @requested permissions are granted
@@ -1205,8 +1194,7 @@ int avc_has_perm_flags(struct selinux_state *state,
1205
1194
struct av_decision avd ;
1206
1195
int rc , rc2 ;
1207
1196
1208
- rc = avc_has_perm_noaudit (state , ssid , tsid , tclass , requested ,
1209
- (flags & MAY_NOT_BLOCK ) ? AVC_NONBLOCKING : 0 ,
1197
+ rc = avc_has_perm_noaudit (state , ssid , tsid , tclass , requested , 0 ,
1210
1198
& avd );
1211
1199
1212
1200
rc2 = avc_audit (state , ssid , tsid , tclass , requested , & avd , rc ,
0 commit comments