繁体   English   中英

新创建的服务的 AndroidP-SELinux 权限被拒绝

[英]AndroidP-SELinux Permission Denied for a new created service

当我添加一个新服务时,发现错误如下:

SELinux : avc:  denied  { add } for service=xxxManagerService pid=3798 uid=1000 scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager permissive=0

然后我在system_server.te添加允许:

allow system_server default_android_service:service_manager { add };

但是发生了构建错误:

libsepol.report_failure: neverallow on line 517 of system/sepolicy/public/domain.te (or line 10355 of policy.conf) violated by allow system_server default_android_service:service_manager { add };
libsepol.check_assertions: 1 neverallow failures occurred
Error while expanding policy
out/host/linux-x86/bin/checkpolicy:  loading policy configuration from out/target/product/sti6030d111/obj/ETC/sepolicy_neverallows_intermediates/policy.conf
[ 11% 22/200] target thumb C++: libpqcontrol <= vendor/amlogic/common/frameworks/services/systemcontrol/PQ/SSMAction.cpp

我应该怎么做才能成功,并通过 cts。

Android 带有一长串neverallow规则,可确保您不会授予破坏设备安全性的权限。 幸运的是,这些neverallow规则在代码中都有详细说明。 如果您在system/sepolicy/public/domain.te查找第 517 行,您会发现:

不允许为默认服务标签添加 service_manager。 相反,域应该使用更具体的类型,例如 system_app_service 而不是通用类型。 {,hw,vnd}service.te 中定义了新的 service_types,{,hw,vnd}service_contexts 中定义了从服务名称到 service_type 的新映射。

您可能使用了audit2allow来创建规则。 起初这似乎是一个简单的解决方案,但它几乎总是会导致难以阅读的规则集。 最后,除了了解 Android 中 SELinux 的基础知识之外,别无他法。

请参阅此处了解更多信息。

我无法举例说明现在要做什么,因为您需要做的事情取决于您要添加的服务类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM