我曾经能够在我的 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。有关更多信息,这些文章很方便:
- https://www.phoronix.com/scan.php?page=news_item&px=TraceFS-Linux-Tracing-FS
- https://lwn.net/Articles/630526/
在 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/