我试图在 Samsung S7 上为应用程序设置 firebase Debug模式但不能
adb shell setprop firebase.analytics.debug-mode com.roostertech.net.app
avc: denied { set } for property=firebase.analytics.debug-mode pid=19845 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0
随机尝试设置其他属性也被拒绝
avc: denied { set } for property=log.wtf pid=21107 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:log_prop:s0 tclass=property_service permissive=0
avc: denied { set } for property=firebase pid=21086 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0
但是这个属性log.tag.FA可以设置就好了
adb shell setprop log.tag.FA VERBOSE
我找不到任何关于允许设置哪些属性的文档?
最佳答案
正如您在错误消息中看到的那样,每个属性都可以有自己的上下文。
属性到 SELinux 上下文的映射在 property_contexts
文件中定义,例如 system/sepolicy/private/property_contexts .
您需要确保您的进程运行的上下文 (shell
) 允许更改上下文 default_prop
的属性。
您需要在您的一个 .te
文件中为此定义 allow
策略。
set_prop(shell, default_prop)
如果你想知道 shell
当前允许设置哪些属性,你最好检查 $OUT/root/sepolicy
中编译的 selinux 文件。由于我手边没有关于如何执行此操作的命令,我建议您改用 grep 查找规则,并假设现在所有规则都已编译到 sepolicy
文件中。
grep -rni "set_prop(shell" --include="*.te"
关于android - 无法 setprop - avc 被拒绝?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45361173/