当前位置: 代码迷 >> 综合 >> selinux没有权限问题
  详细解决方案

selinux没有权限问题

热度:47   发布时间:2024-01-21 19:29:51.0

 cat /proc/kmsg | grep avc 或 dmesg | grep avc

 audit(0.0:67): avc: denied { write } for path="/dev/block/vold/93:96" dev="tmpfs" ino=1263 scontext=u:r:kernel:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0  

 

分析过程: 
缺少什么权限:           { write }权限, 
谁缺少权限:               scontext=u:r:kernel:s0, 

对哪个文件缺少权限:tcontext=u:object_r:block_device 

什么类型的文件:        tclass=blk_file  

 

解决方法:kernel.te 

allow kernel block_device:blk_file write; 

 

编译可能出现报错,

neverallow on line 805 of system/sepolicy/private/system_server.te (or line 35726 of policy.conf) violated by allow system_server sdcardfs:file { read };

说明这个文件里的策略和你新加的策略有冲突

那么需要修改报错对应文件的neverallow语句,我直接注释掉,编译通过,问题解决