dtruss fails on ps on OS X 10.11

狂风中的少年 提交于 2019-12-04 04:35:58

The issue has to do with the code signature. If you make a copy and then re-sign it with your own identity (or, presumably, any non-Apple identity), then dtrace will attach to it just fine.

$ mkdir ~/temp
$ cp /bin/ps ~/temp/
$ codesign -f -s `whoami` ~/temp/ps
$ sudo dtruss ~/temp/ps -p 43520 -o args
TheDarkKnight

cannot control executables signed with restricted entitlements

Security Integrity Protection ('rootless') is now preventing dtruss from operating here.

You can disable it by booting into Recovery mode, but it looks like dtrace has specifically been blocked regardless of the state of rootless, as can be seen in the source code if you search for "dtrace cannot control".

You can also see from the comments in 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.
     */
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!