2015-10-22 39 views
7

我是想看看哪些系統調用ps用來獲取在OS X 10.11(埃爾卡皮坦)進程的命令行,然後跑進了以下錯誤:dtruss對OS PS失敗X 10.11

# dtruss ps -p 43520 -o args 

dtrace: failed to execute ps: dtrace cannot control executables signed with restricted entitlements 

谷歌搜索導致的建議,使ps副本將允許我繞過這一點,但這並不適用於我。爲什麼我不能在任意二進制文件上運行dtruss,並且有什麼方法可以恢復舊的行爲?

回答

10

問題與代碼簽名做。如果你製作了一個副本,然後用你自己的身份(或者大概是任何非Apple身份)重新簽名,那麼dtrace就會附加到它上面。

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

是的,這是有道理的,因爲源代碼中的註釋是指使用受限權利簽名的進程,所以移除簽名會改變該邏輯的處理方式。 – TheDarkKnight

4

cannot control executables signed with restricted entitlements

安全完整性保護('無根')現在可以防止在此操作dtruss。

您可以disable it通過引導進入恢復模式,但它看起來像的DTrace已明確了無論無根狀態的屏蔽,可以在source code中可以看出,如果你搜索「的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. 
    */ 
+0

是否禁用它實際上適合您? – Glyph

+0

@Glyph,沒有dtrace專門用於系統進程。我已經更新了答案。 – TheDarkKnight