tee-supplicant selinux ioctl 异常解决
问题:
写rpmb key和google key时一直报失败。
通过setenforce 0配置为permissive模式后,写key成功。
遂着手解决selinux权限问题。
可是添加了allow tee root_block_device:blk_file { read open ioctl };规则之后,还是会报如下错误。
15476 08-31 14:49:58.539 289 289 W tee-supplicant: type=1400 audit(0.0:134): avc: denied { ioctl } for path="/dev/block/mmcblk0" dev="tmpfs" ino=11294 ioctlcmd=0xb300 scontext=u:r:tee:s0 tcontext=u:object_r:root_block_device:s0 tclass=blk_file permissive=0 15479 08-31 14:49:58.591 289 289 W tee-supplicant: type=1400 audit(0.0:135): avc: denied { ioctl } for path="/dev/block/mmcblk0" dev="tmpfs" ino=11294 ioctlcmd=0xb300 scontext=u:r:tee:s0 tcontext=u:object_r:root_block_device:s0 tclass=blk_file permissive=0
看out目录下vendor/etc/selinux/中搜索对应的规则,也是存在的。W( ̄_ ̄)W
vendor_sepolicy.cil:2747:(allow tee_30_0 root_block_device_30_0 (blk_file (ioctl read open)))
解决:
看了这篇文章:https://blog.csdn.net/sinat_37343534/article/details/116125866 (Android Q 平台 增加文件ioctl 的SElinux权限)
增加如下规则之后就都正常了:
allowxperm tee root_block_device:blk_file ioctl 0xb300;
其他:
两篇讲selinux的文章:
Android : SELinux 简析&修改: https://www.cnblogs.com/blogs-of-lxl/p/7515023.html
深入理解SELinux SEAndroid:https://www.cnblogs.com/ztguang/p/12644906.html