android - 无法 setprop - avc 被拒绝?

标签 android linux firebase samsung-mobile selinux

我试图在 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/

相关文章:

android - 如何删除某些字段中具有重复数据的连续行(在 SQLite 中)?

android - 如何获取加密方案 UUID

linux - 如何显示/proc 中文件的大小?它不应该是零大小

java - 使用 Firebase 对 Java AppEngine 应用程序中的用户进行身份验证

java - 有什么问题吗?服务器响应消息的不同结果

android - 根据Flavor文件夹的内容有条件地应用gradle插件

android - 按软键盘上的 Next IME 按钮时跳过禁用的 EditText

android - 接到来电时如何调用 Activity 。

c - 以编程方式获取给定的进程名称和 ppid

linux - 如何将 "tail -f"压缩为压缩(gzipped)文件?