2014-10-31 91 views
9

我在優勝美地的kext上有一個代碼簽名。但kextload失敗。
這是版本2 codesign。 codesign --verify爲真。
但kextload失敗。爲什麼不加載優勝美地?codeigned kext但爲什麼不加載優勝美地(10.10)

這是我的日誌。

我檢查了codesign -dvvv ./myKext.kext並且沒關係。

codesign -dvvv ./myKext.kext返回如下:

Executable=/Path/to/myKext 
Identifier=com.myKext.kext.Firewall 
Format=bundle with Mach-O thin (x86_64) 
CodeDirectory v=20100 size=317 flags=0x0(none) hashes=9+3 location=embedded 
Hash type=sha1 size=20 
CDHash=d0ff68bd8b49c650f45349c2d1570d45a8c1f148 
Signature size=8544 
Authority=Developer ID Application: My Kext Co., Ltd. (R2PBZJ465V) 
Authority=Developer ID Certification Authority 
Authority=Apple Root CA 
Timestamp=2014. 10. 31. 오전 11:09:35 
Info.plist entries=18 
TeamIdentifier=not set 
Sealed Resources version=2 rules=12 files=1 
Internal requirements count=1 size=188 

這表明,版本2
sudo kextload ./myKext.kext還是返回了以下內容:

/Path/to/myKext.kext failed to load - (libkern/kext) not loadable (reason unspecified); check the system/kernel logs for errors or try kextutil(8).

cat /var/log/system.log回報:

com.apple.kextd[19]: ERROR: invalid signature for com.myKext.kext.Firewall, will not load

sudo kextutil -l ./myKext.kext返回:

Diagnostics for ./myKext.kext: 
Code Signing Failure: code signature is invalid 
ERROR: invalid signature for com.myKext.kext.Firewall, will not load 

爲什麼是無效簽名?
我已經使用優勝美地的version2 codesign簽名了。
我做錯了什麼標誌?有人請教我。

+0

我只是猜測,但不會蘋果需要參與代碼簽名,以使其有效嗎? – trojanfoe 2014-10-31 10:09:27

+0

您是否向Apple請求過您的DeveloperID已添加kext codignign屬性? – TheDarkKnight 2014-10-31 10:36:35

+0

這看起來像這個相同的問題:http://stackoverflow.com/questions/26283158/codesigning-kext-with-kext-enabled-certificate-fails-during-kextload-code-sign – pmdj 2014-11-03 09:56:33

回答

8

我也有同樣的問題。我和你分享瞭解決方案。

Apple更改了Mac Developer Program,並從中刪除了對kext的認證。 因此,即使您是Mac開發者計劃的成員,除非您在Developer ID and Gatekeeper處要求,否則您將不會獲得kext開發認證。

BTW,蘋果說,

"KEXT signing is intended for signing commercially shipping kexts or projects broadly distributed in a large organization."

所以我們所能做的就是通過添加 「KEXT-dev亡模式= 1」 啓動ARG運行我們的KEXT發展模式的內核擴展。像,

sudo nvram boot-args="debug=0x146 kext-dev-mode=1" 

並重新啓動。

我希望這會對你有所幫助。

+0

這個答案已過時,因爲El Capitan(10.11)。詳情請參閱其他答案。 – 2016-12-26 13:33:12

0

我同意ParaDevil的回答。
對於OS X優勝美地,你可以做到以下幾點:

  1. 下載 「內核調試工具包」;
  2. 運行安裝程序包;
  3. 繼續「Read Me」步驟;
  4. 的 「自述」 說:

In order to load unsigned kexts, the system must have "KEXT Developer Mode" enabled by adding the "kext-dev-mode=1" boot-arg. The following command (followed by a reboot) would be suitable to prepare a system for testing non-production kexts:     

sudo nvram boot-args="debug=0x146 kext-dev-mode=1" 

Once this is done, the machine will be able to load any valid kext; signatures will still be checked, but a failed verification will just result in a log message. Note: This applies to kexts that contain a binary, as well as codeless (plist-only) kexts. The system will remain in developer mode until you manually remove the boot-arg or clear nvram and reboot. You can exit developer mode by redefining the boot-arg to your previous settings, or clear your boot-args as follows:

sudo nvram -d boot-args 

Apple recommends that you make use of KEXT Developer Mode rather than use your Developer ID certificate to sign drivers while they are under development. Ideally you should sign a driver using a Developer ID certificate only when it reaches its final stages of testing and is being evaluated for release to customers.


對於OS X厄爾尼諾船長10.11命令:

sudo nvram boot-args="debug=0x146 kext-dev-mode=1" 

沒有效果。

閱讀System Integrity Protection Guide/Kernel Extensions瞭解更多信息。

0

作爲2016年12月的:

這是由於在埃爾卡皮坦(10.11)推出的System Integrity Protection功能。從El Capitan開始,kext-dev-mode啓動選項不起作用,所以ParaDevil的答案不起作用。通過重新啓動您的計算機,並在啓動時按住Command鍵和R鍵

  1. 引導到恢復OS:相反,你必須從this page下面的說明,禁用SIP。

  2. 從Utilities菜單啓動終端。

  3. 運行以下命令:

    csrutil disable 
    

當您重新啓動,系統完整性保護應禁用。

相關問題