【问题标题】:avc denied even with proper policy added即使添加了适当的策略,avc 也会被拒绝
【发布时间】:2016-06-22 15:57:49
【问题描述】:

在 AOSP 构建中,我收到了以下 avc 被拒绝的消息,

01-01 00:01:28.600    1458-1458/? W/iw﹕ type=1400 audit(0.0:5): avc: denied { create } for scontext=u:r:system_app:s0 tcontext=u:r:system_app:s0 tclass=netlink_socket permissive=0
01-01 00:01:28.660    1460-1460/? W/ndc﹕ type=1400 audit(0.0:6): avc: denied { write } for name="netd" dev="tmpfs" ino=1575 scontext=u:r:system_app:s0 tcontext=u:object_r:netd_socket:s0 tclass=sock_file permissive=0
01-01 00:01:28.720    1461-1461/? W/ndc﹕ type=1400 audit(0.0:7): avc: denied { write } for name="netd" dev="tmpfs" ino=1575 scontext=u:r:system_app:s0 tcontext=u:object_r:netd_socket:s0 tclass=sock_file permissive=0
01-01 00:01:28.790    1462-1462/? W/ndc﹕ type=1400 audit(0.0:8): avc: denied { write } for name="netd" dev="tmpfs" ino=1575 scontext=u:r:system_app:s0 tcontext=u:object_r:netd_socket:s0 tclass=sock_file permissive=0
01-01 00:01:28.860    1463-1463/? W/ndc﹕ type=1400 audit(0.0:9): avc: denied { write } for name="netd" dev="tmpfs" ino=1575 scontext=u:r:system_app:s0 tcontext=u:object_r:netd_socket:s0 tclass=sock_file permissive=0

使用audit2allow 我得到了关注

allow system_app netd_socket:sock_file write; 
allow system_app self:netlink_socket create;

我已将相同内容添加到device/<vendor-path>/sepolicy/system_app.te 还从neverallow 政策中排除了系统应用程序,如下external/sepolicy/app.te

neverallow { appdomain -system_app }
    self:{
        netlink_socket
        netlink_firewall_socket
        netlink_tcpdiag_socket
        netlink_nflog_socket
        netlink_xfrm_socket
        netlink_audit_socket
        netlink_ip6fw_socket
        netlink_dnrt_socket
    } *;

但仍然获得相同的权限被拒绝 avc 日志。

【问题讨论】:

  • 您在更改 te 文件后是否遇到完全相同的审核失败?
  • 你是如何重建和部署的?检查设备上@9​​87654328@ 的大小/校验和可能是值得的,以确保您的更改正在传播到 initramfs。

标签: android selinux


【解决方案1】:

从您的更改中看不出任何问题。假设您的 sepolicy 更改没有构建到内核中。
请尝试 make kernelclean 并重建内核,vim 在以下文件中:

out/target/product/xxxx/obj/ETC/sepolicy_intermediates/policy.conf

所有的sepolicy都应该在policy.conf中,grep你新添加的策略来检查它是否已经编译到内核中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 2017-04-19
    • 1970-01-01
    • 2019-05-04
    • 1970-01-01
    • 1970-01-01
    • 2018-11-16
    相关资源
    最近更新 更多