【问题标题】:SEAndroid: Does dump state get prop violate never allow ruleSEAndroid:转储状态是否违反了永远不允许的规则
【发布时间】:2022-01-11 06:09:51
【问题描述】:

在构建 AOSP S(12) 时,我遇到了一个奇怪的问题,但可能只在某些时候/某些机器上。 error.log如下

neverallow check failed at out/target/product/msmnile_au/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil:22861 from system/sepolicy/private/property.te:46
  (neverallow domain base_typeattr_745 (file (ioctl read write create setattr lock relabelfrom append unlink link rename open watch watch_mount watch_sb watch_with_perm watch_reads)))
    <root>
    allow at out/target/product/msmnile_au/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil:8901
      (allow dumpstate property_type (file (read getattr map open)))
    <root>
    allow at out/target/product/msmnile_au/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil:11533
      (allow init property_type (file (read write create getattr setattr relabelto append map unlink rename open)))
    <root>
    allow at out/target/product/msmnile_au/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil:6370
      (allow dumpstate_31_0 property_type (file (read getattr map open)))
    <root>
    allow at out/target/product/msmnile_au/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil:8170
      (allow init_31_0 property_type (file (read write create getattr setattr relabelto append map unlink rename open)))

Failed to generate binary
Failed to build policydb

然后我检查规则。 system/sepolicy/private/property.te:46 说:

enforce_sysprop_owner(`
  neverallow domain {
    property_type
    -system_property_type
    -product_property_type
    -vendor_property_type
  }:file no_rw_file_perms;
')

和 system/sepolicy/public/dumpstate.te:278 说:

# Read any system properties
get_prop(dumpstate, property_type)

我的问题是,这是否违反了从不允许规则并导致此错误? 如果是,为什么有时不会弹出此错误。 如果不是,我的错误是什么原因?

提前致谢。

【问题讨论】:

    标签: compiler-errors android-source selinux seandroid


    【解决方案1】:

    我在device/xiaomi/juice/BroadConfig.mk下添加了以下代码

    # Sepolicy
    SELINUX_IGNORE_NEVERALLOWS := true
    

    但是,这在用户构建中不受支持。仅在 userdebug 和 eng 版本中受支持。

    【讨论】:

      【解决方案2】:

      我明白了。原因是我有另一个使用property_type的文件,如果这个文件存在,就会弹出问题;否则,一切顺利。希望这对你有用。顺便说一句,错误信息与真正的问题相去甚远。

      【讨论】:

      • 我也遇到了同样的错误。另一个使用 property_type 的文件是什么?能否请您说明文件名及其路径?还有你采取了什么行动?刚刚删除了文件?
      • 使用property_type的文件是私有文件,不在AOSP中。所以即使我告诉你名字和它的路径也无济于事。您需要采取的措施取决于,如果没有必要,您可以将其删除。否则,请尝试使用 vendor_property_type 而不是 property_type。
      猜你喜欢
      • 2019-05-04
      • 1970-01-01
      • 2017-06-27
      • 2020-04-11
      • 2016-04-15
      • 1970-01-01
      • 2013-01-01
      • 2018-07-03
      相关资源
      最近更新 更多