1

在构建 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

然后我检查规则。系统/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)

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

提前致谢。

4

2 回答 2

0

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

# Sepolicy
SELINUX_IGNORE_NEVERALLOWS := true

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

于 2022-02-07T05:46:36.407 回答
-1

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

于 2022-01-11T07:18:38.173 回答