我试图查看syscall ps用于获取OSX10.11 (El Capitan)上进程的命令行,并遇到以下错误:
# dtruss ps -p 43520 -o args
dtrace: failed to execute ps: dtrace cannot control executables signed with restricted entitlements谷歌的建议是,制作一个ps的副本可以让我绕过这个问题,但这对我来说不管用。为什么我不能在任意的二进制文件上运行dtruss,并且有什么方法可以恢复旧的行为呢?
发布于 2015-11-18 10:01:21
这个问题与代码签名有关。如果你制作了一个副本,然后用你自己的身份重新签名(或者,大概是任何非苹果的身份),那么dtrace就会把它附加在上面。
$ mkdir ~/temp
$ cp /bin/ps ~/temp/
$ codesign -f -s `whoami` ~/temp/ps
$ sudo dtruss ~/temp/ps -p 43520 -o args发布于 2015-10-22 10:00:32
无法控制带有受限制权利的可执行文件。
安全完整性保护(‘无根’)现在正在阻止d构架在这里运行。
您可以通过引导进入恢复模式来禁用它,但是看起来无论无根状态如何,dtrace都被特别阻塞了,如果您搜索"dtrace无法控制“,就可以在源代码中看到这一点。
您还可以从Pcreate中的注释中看到:
/*
* <rdar://problem/13969762>:
* If the process is signed with restricted entitlements, the libdtrace_dyld
* library will not be injected in the process. In this case we kill the
* process and report an error.
*/https://stackoverflow.com/questions/33275204
复制相似问题