如何分析SELinux Policy Exception

  1. SELinux Policy Exception Log 格式.
    SELinux Policy Exception 的LOG 关键字是 “avc: denied” 或者 “avc: denied”, 下面就是一句典型的LOG
    <5>[ 27.706805] (3)[304:logd.auditd]type=1400 audit(1420041991.220:17): avc: denied { execute } for pid=2182 comm=“app_process” path="/data/dalvik-cache/arm64/system@framework@boot.oat" dev=“mmcblk0p18” ino=15109 scontext=u:r:root_channel:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file permissive=0

具体说明如下:
<5> : kernel log level
[ 27.706805] : kernel time
(3) : cpu number
[304:logd.auditd] : 表示此LOG 是通过auditd 打印的.
type=1400 : SYSCALL
type=AVC - for kernel events
type=USER_AVC - for user-space object manager events
audit(1420041991.220:17) : audit(time:serial_number)
avc: denied { execute } : field depend on what type of event is being audited.
pid=2182 comm=“app_process” : If a task, then log the process id (pid) and the name of the executable file (comm).
path="/data/dalvik-cache/arm64/system@framework@boot.oat" dev=“mmcblk0p18” ino=15109: The information of target.
subject context : u:r:root_channel:s0
target context : u:object_r:dalvikcache_data_file:s0
tclass : the object class of the target class=system
permissive: permissive (1) or enforcing (0)

  1. 基本分析流程
    1). 将SELinux 调到 permissive mode, 然后一次性抓取出所有的"avc:" 的LOG.
  • 如果问题与开机流程无关, 并且eng 版本能够复现.
    adb shell setenforce 0
  • 如果问题与开机流程相关, 或者只有user build 能够复现. 按下列FAQ 设置permissive mode
    2). 确认访问是否是必须的?是否是违法恶意访问?
    3). 如果是正常访问, 确认访问的目标类型是否太过广泛,如果太过广泛, 细化具体的文件目标。
    4). 添加对应的SELinux Policy 到对应的Policy 文件。
    5). 如果是违法恶意访问, 追查上层feature owner 的责任。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值