1

我正在尝试创建一个系统服务,该服务在系统启动后运行,除了 sepolicy 文件更新之外,我已遵循所需的步骤。我已经提到了https://android.jlelse.eu/system-service-in-aosp-750007d39555。目前我的服务没有运行,因为 avc denied 错误即将到来。我在许可模式下运行。我试图在 /system/sepolicy/public/service.te 中的 service.te 和 conexts.te 中添加所需的更改。我收到编译错误 [6:49 PM] Kumar, Rathnakaram Anil (uic40644)

[下午 4 点 03 分] 库马尔,Rathnakaram Anil (uic40644)

嗨 Ashwini,我正在尝试为我的测试服务添加 selinux 权限,但遇到错误:[13% 18579/140712] build out/target/product/caaf_denali_pegasus/obj/ETC/sepolicy_freeze_test_intermediates/sepolicy_freeze_test FAILED: out/target/product/caaf_denali_pegasus /obj/ETC/sepolicy_freeze_test_intermediates/sepolicy_freeze_test /bin/bash -c "(diff -rq -x bug_map system/sepolicy/prebuilts/api/29.0/public system/sepolicy/public) && (diff -rq -x bug_map system/sepolicy /prebuilts/api/29.0/private system/sepolicy/private) && (touch out/target/product/caaf_denali_pegasus/obj/ETC/sepolicy_freeze_test_intermediates/sepolicy_freeze_test)" 文件系统/sepolicy/prebuilts/api/29.0/private/service.te和 system/sepolicy/private/service.te 不同文件 system/sepolicy/prebuilts/api/29。0/private/service_contexts 和 system/sepolicy/private/service_contexts 不同。

我找不到有关如何更新新服务的 sepolicy 的任何线索,请帮助我。

4

2 回答 2

0

编辑文件 /system/sepolicy/private/service_contexts 并添加这一行

service_name u:object_r:service_name:s0

重新编译 AOSP。

于 2020-11-03T01:24:23.757 回答
0
  1. 给你的二进制文件一个可出售的,将它添加到“file_contexts”

/vendor/bin/xxx u:object_r:xxx_exec:s0

  1. 创建一个te文件“xxx.te”
# xxx service
type xxx, domain;
type xxx_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(xxx)
于 2020-12-03T06:53:11.830 回答