Android11 SELinux:avc:denied { read } for name=“cache“ dev=“dm-4“ ino=16 scontext=u:r:system_app等报错

(1) avc: denied { read } for name="cache" dev="dm-4" ino=16 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0

分析过程:

缺少什么权限:      {  read  }权限,

谁缺少权限:        scontext=u:r:system_app:s0

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

什么类型的文件:    tclass=lnk_file

permissive=0  : 权限拒绝

完整的意思: system_app进程对cache_file类型的lnk_file缺少read权限。

解决的方法:

缺什么权限补什么,一步一步补到没有avc denied为止。

扫描二维码关注公众号,回复: 16009493 查看本文章

解决权限问题需要修改的权限文件如下位置,以.te结尾

device/mediatek/sepolicy/bsp/non_plat/system_app.te

device/mediatek/sepolicy/basic/non_plat/system_app.te

device/mediatek/sepolicy/basic/plat_private/system_app.te

device/mediatek/sepolicy/bsp/non_plat/system_app.te

device/mediatek/sepolicy/bsp/plat_private/system_app.te

在以上的路径文件中,加入以下代码

allow system_app cache_file:lnk_file read;
(2)avc: denied { read } for name="cache" dev="dm-4" ino=16 scontext=u:r:uncrypt:s0 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0

解决思路同(1): 只是在找到的不同路径文件中,加入以下代码

allow uncrypt cache_file:lnk_file read;
(3)avc: denied { setattr } for name="uncrypt_file" dev="dm-9" ino=6587 scontext=u:r:system_app:s0 tcontext=u:object_r:cache_recovery_file:s0 tclass=file permissive=0

解决思路同(1): 只是在找到的不同路径文件中,加入以下代码

allow system_app cache_recovery_file:file setattr;

能在device中找到的.te文件尽量在其中添加selinux权限,而不是改变system下的selinux权限

感谢大佬的博文指导:https://blog.csdn.net/tung214/article/details/72734086

https://www.freesion.com/article/6573116485/

猜你喜欢

转载自blog.csdn.net/lwz622/article/details/120186338