selinux case_1

若在 dmesg 發現下面的 selinux 的 log,
代表 scontext 裡的 bbbbbb 缺少了對 tclass=file 類型的 cccccc 文件的 開啟,讀取權限,
需要在相應的 te 裡加入權限

mtype=1400 audit(1582687499.739:364)^[[0m: avc: denied { open } for pid=1102 comm="aaaaaa" path="/sys/xxxxx" dev="sysfs" ino=39149 scontext=u:r:bbbbbb:s0 tcontext=u:object_r:cccccc:s0 tclass=file permissive=1

mtype=1400 audit(1582687499.739:363)^[[0m: avc: denied { read } for pid=1102 comm="aaaaaa" name="battery_type" dev="sysfs" ino=39149 scontext=u:r:bbbbbb:s0 tcontext=u:object_r:cccccc:s0 tclass=file permissive=1

device/ccccccccc/sepolicy/aaaaaa.te

allow bbbbbb cccccc:file { read };
allow bbbbbb cccccc:file { open };

reference : https://blog.csdn.net/tung214/article/details/72734086

原文地址:https://www.cnblogs.com/youchihwang/p/12367332.html