打开了SELINUX后,开机过程中log如下:
[   48.530560] type=1400 audit(1467283596.977:209): avc: denied { write } for pid=6360 comm="droid.launcher3" name="card0" dev="tmpfs" ino=10259 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=ubject_r:device:s0 tclass=chr_file permissive=0
[   48.573350] type=1400 audit(1467283597.020:210): avc: denied { write } for pid=6313 comm="ndroid.systemui" name="card0" dev="tmpfs" ino=10259 scontext=u:r:platform_app:s0:c512,c768 tcontext=ubject_r:device:s0 tclass=chr_file permissive=0
[   48.594576] type=1400 audit(1467283597.020:211): avc: denied { write } for pid=6380 comm="RenderThread" name="card0" dev="tmpfs" ino=10259 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=ubject_r:device:s0 tclass=chr_file permissive=0
[   48.742435] type=1400 audit(1467283597.189:212): avc: denied { write } for pid=6386 comm="RenderThread" name="card0" dev="tmpfs" ino=10259 scontext=u:r:platform_app:s0:c512,c768 tcontext=ubject_r:device:s0 tclass=chr_file permissive=0从上面log分析,应该给予untrusted_app一个write权限.
所以我在external/sepolicy/untrusted_app.te中增加了下面这句:
allow untrusted_app device:chr_file write;  然后重编验证,还是报这个错误.其他的selinxu错误都不在出现了,就这句出现.分析上面的log发现,
scontext=u:r:untrusted_app:s0:c512,c768
上面这句有不一样的地方,
一般的selinux错误,scontext由4个部分组成,最后一个部分是s0,但是这里的log后i名还有c512,c768
感觉跟这个有关系.有大侠知道怎么回事吗.
多谢多谢.

解决方案 »

  1.   

    我遇到的这个问题解决了。原因是scontext中的安全上下文的安全级别改变导致的。解决方法用restorecon -R 被改变的那个目录(文件)。
      

  2.   

    看看要write的文件的安全context是什么
      

  3.   

    http://blog.csdn.net/lushengchu_luis/article/details/52775740   同样问题  亲测有效
      

  4.   

    有可能是用户权限的问题,你在其它没有selinux权限的设备上删除此目录,再手动创建一下,试试,
      

  5.   

    这个涉及到了selinux的多层访问控制(MLS)
    /system/sepolicy/mls文件中有对于chr_file的控制,你可以先看一下.
      

  6.   

    有关系。你需要在file.te中配置type platform_app, domain, mlstrustedsubject; 即可,因为你加的权限被MLS机制否定了。