软件平台:Android11
硬件平台:QCS6125
Android 11上需要对一个节点进行写操作,但是添加了Selinux以后还是报错
allow platform_app yft_temperature_file:file { write read getattr open };
加了权限还是一直报avc
01-26 09:40:55.556 7891 7891 W yft.factorymode: type=1400 audit(0.0:361): avc: denied { write } for name="chip_power" dev="sysfs" ino=42191 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:yft_temperature_file:s0 tclass=file permissive=0 app=com.yft.factorymode
发现需要确实是Android 11 platform_app 缺少mlstrustedobject
但是因为要过cts,不能直接修改platform_app的type
修改yft_temperature_file即可
-type yft_temperature_file, fs_type, sysfs_type;
+type yft_temperature_file, fs_type, sysfs_type, mlstrustedobject;
修改后编译生效
在Android11系统上,针对QCS6125硬件平台的应用尝试写入节点chip_power时遇到Selinux权限问题。即使添加了allowplatform_appyft_temperature_file规则,仍收到avc拒绝写入的错误。问题在于platform_app缺少mlstrustedobject权限,但由于CTS测试要求,不能直接修改platform_app的类型。解决方案是修改yft_temperature_file的类型,添加mlstrustedobject属性并重新编译生效。
4084

被折叠的 条评论
为什么被折叠?



