Android SELinux——添加策略实例(十五)

        通过前面的文章,我们基本了解在 Android 系统中 SELinux 策略配置和基本语法,这里我们就来看一些常见的问题及其解决方案。这里我们主要看通过 allow 添加策略的方案。

一、直接添加权限

       添加策略一般都是根据 Log 中的信息,使用 audit2allow 生成策略,谁缺少权限,就修改谁的 .te 文件。

示例

selinux: avc: denied { set } for property=vold.decrypt pid=7192 uid=2000 gid=2000 scontext=u:r:shell:s0
tcontext=u:object_r:exported_vold_prop:s0 tclass=property_service permissive=0

        从 Log 中可以看出来进程 u:r:shell:s0 缺少对 property_service 类型的对象 u:object_r:exported_vold_prop:s0 的 set 权限。 通过 audit2allow 生成策略也比较简单:

#============= shell ===========&#

猜你喜欢

转载自blog.csdn.net/c19344881x/article/details/142464728