Service xxx does not have a SELinux domain defined.&&avc denied权限问题

init: Service xxx does not have a SELinux domain defined.

该提示说明没有定义SELinux domain,导致服务xxx无法自启动。为了解决这个问题我们按如下方式修改或添加sepolicy文件:

 

修改system/seplicy/file_contexts文件,添加以下内容:

/system/bin/xxx u:object_r:xxx_exec:s0

新增xxx.te文件,并在其中添加如下内容:

     需要为新增的进程增加域、执行权限

     type xxx, domain;

     type xxx_exec, exec_type, file_type;

     然后启用这个域

     init_daemon_domain(xxx)

allow idmap resource_cache_data_file:dir rw_dir_perms;

allow idmap resource_cache_data_file:file create_file_perms;

上面俩行是权限allow,可能会遇到权限还不够,具体增加方法看下面案列

 

 

 

●最后

有时候会遇到avc denied报错问题,这是因为安卓4.4(好像)以后增加了SELINUX权限问题

    权限增加规则如下:    

    案列1)

         <7>[11281.586780] avc: denied { read write } for pid=1217 comm="mediaserver" name="tfa9897"

dev="tmpfs" ino=4385 scontext=u:r:mediaserver:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=0

        allow mediaserver  device chr_file { open read write }; 

       案列2)    

            <7>[11281.586780] avc: denied {dd} for pid=1217 comm="mediaserver" name="tfa9897" dev="tmpfs"

ino=4385 scontext=u:r:aa:s0 tcontext=u:object_r:bb:s0 tclass=ccc permissive=0

        allow aa bb ccc { dd }; 

   

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值