Android SELinux 添加权限后不生效
Android 12上需要对一个节点进行写操作,但是添加了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 SELinux 权限问题(二)—添加权限后不生效_it_rensheng的博客-CSDN博客_selinux 权限加不上
发现需要确实是Android 12 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;
修改后编译生效

本文针对Android12中平台应用无法对特定节点进行写操作的问题进行了深入探讨。通过修改yft_temperature_file类型,增加了mlstrustedobject属性,解决了SELinux权限添加后仍然无效的情况。
1万+

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



