android - 由于 SELinux,Systrace 不再适用于 Marshmallow 中的 Nexus 6?有人让它重新工作了吗?

标签 android selinux systrace

我曾经能够在我的 Nexus 6 上运行 systrace,但最近它停止工作了(可能是在最近的每月更新之一之后):systrace 在尝试从我的设备下载跟踪时挂起。

adb logcat 中,我看到了一堆像这样的行

05-26 14:57:08.567  4933  4933 W <my.app.package>: type=1400 audit(0.0:23388710): avc: denied { getattr } for comm=66627379737472616365206E6F7469 path="/sys/kernel/debug/tracing/trace" dev="debugfs" ino=4158 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs:s0 tclass=file permissive=0

我知道 systrace 使用 debugfs,这似乎是一个 SELinux 权限问题(参见 https://source.android.com/security/selinux/validate.html)。有没有人让这个再次工作?

最佳答案

这是设计使然。 Debugfs 中有很多危险的位,因此拆分为 tracefs。有关更多信息,这些文章很方便:

在 AOSP 的 system/sepolicy 中,可以找到 neverallows :

96b1c9ca (Nick Kralevich 2015-12-17 16:38:21 -0800 564) neverallow { domain -init -system_server -dumpstate } debugfs:file no_rw_file_perms;

以及阅读 untrusted_app(上面已涵盖但似乎多余):

$ git blame -L106,106 untrusted_app.te
96b1c9ca (Nick Kralevich 2015-12-17 16:38:21 -0800 106) neverallow untrusted_app debugfs_type:file read;

顺便说一句,如果你得到十六进制编码的通信字段,可以使用 Python 像这样解码它们:

'66627379737472616365206E6F7469'.decode('hex')
'fbsystrace noti

关于android - 由于 SELinux,Systrace 不再适用于 Marshmallow 中的 Nexus 6?有人让它重新工作了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37463159/

相关文章:

android - 在android studio中反编译后如何使我的数据库不可见?

android - 如何为可移动图像创建裁剪层

java - Android:是否可以将 ArrayList<myObject> 放入 bundle 中?

java - 通过对象内的字符串参数对对象的 ArrayList 进行排序

android - Selinux 拒绝在 Android 8 上启动服务

Android Systrace 跟踪文件格式

android - 将供应商服务添加到 ServiceManager with android treble architecture[SELinux policy]

linux - 为什么 execve 调用在启用 SELinux 的情况下失败?

Android Systrace 工具内部使用strace 还是ftrace?

android - react native 分析。 Systrace 未显示 JS 和 native 模块线程