xcode 尝试运行kextutil对kext文件返回权限错误

svgewumm  于 2023-11-21  发布在  其他
关注(0)|答案(1)|浏览(127)

你好Stackoverflow社区。
试着通过下面的教程运行-这样我就可以学习如何编写驱动程序实用程序。
http://www.robertopasini.com/index.php/2-uncategorised/625-osx-creating-a-device-driver
我正试图在我的构建生成的kext文件上运行kextutil。根据说明,我将其复制到我的临时文件夹。但我得到以下错误:

admins-Mac-mini:Debug admin$ kextutil -n -t /tmp/ssvac.kext
Skipping staging and system policy checks because not running as root, expect staging errors.
Kext rejected due to improper filesystem permissions: <OSKext 0x7f91d402f140 [0x7fff898b2cc0]> { URL = "file:///private/tmp/ssvac.kext/", ID = "myappleid.ssvac" }
Code Signing Failure: code signature is invalid
Authentication Failures: 
    File owner/permissions are incorrect (must be root:wheel, nonwritable by group/other): 
        /private/tmp/ssvac.kext
        Contents
        _CodeSignature
        CodeResources
        MacOS
        ssvac
        Info.plist

Diagnostics for /private/tmp/ssvac.kext:
Authentication Failures: 
    File owner/permissions are incorrect (must be root:wheel, nonwritable by group/other): 
        /private/tmp/ssvac.kext
        Contents
        _CodeSignature
        CodeResources
        MacOS
        ssvac
        Info.plist

admins-Mac-mini:Debug admin$

字符串
我试着像这样修改权限/所有者:

admins-Mac-mini:Debug admin$ chown root:wheel /tmp/ssvac.kext/

admins-Mac-mini:Debug admin$ ls -lah /tmp/ssvac.kext/
total 0
drwxrwxrwx  3 root   wheel    96B 16 Oct 16:37 .
drwxrwxrwt  7 root   wheel   224B 19 Oct 08:08 ..
drwxr-xr-x  5 admin  wheel   160B 16 Oct 16:37 Contents
admins-Mac-mini:Debug admin$ kextutil -n -t /tmp/ssvac.kext


不知道该怎么解决。如果你有什么建议,我会很感激的。
谢谢你,谢谢
编辑1

My mistake was when I copied from the debug folder to /tmp/, I didn't use the -r switch.  Now that I have, this is the error I'm getting: 

admins-Mac-mini:Debug admin$ cp -r ssvac.kext/ /tmp/
admins-Mac-mini:Debug admin$ sudo kextutil /tmp/
Contents/                     com.apple.launchd.GufwRL5Sf0/ com.google.Keystone/          powerlog/                     ssvac.kext/
admins-Mac-mini:Debug admin$ sudo kextutil /tmp/ssvac.kext/
Password:
Untrusted kexts are not allowed
Kext with invalid signature (-67050) denied: /private/var/db/KernelExtensionManagement/Staging/tmp.RLlmC1/59AFE9EA-12E3-42C0-B3FC-E98EF987D9B2.kext
Bundle (/private/tmp/ssvac.kext) failed to validate, deleting: /private/var/db/KernelExtensionManagement/Staging/tmp.RLlmC1/59AFE9EA-12E3-42C0-B3FC-E98EF987D9B2.kext
Unable to stage kext (/private/tmp/ssvac.kext) to secure location.
admins-Mac-mini:Debug admin$

o8x7eapl

o8x7eapl1#

ls输出中可以看到,kext实际上是至少包含一个Info.plist文件的目录,和代码签名信息。(以Contents开头)通常它还包含一个二进制可执行文件。* 全部 * kext中的文件和子目录必须具有适当的权限,才能考虑加载kext。这意味着必须应用权限使用chown时,* 递归地 * 使用-R标志。
我通常建议不要使用chown,而只是简单地将kext复制到临时位置(用于测试,在macOS 11之前)或/Library/Extensions(从macOS 11开始,或在部署时,或者在测试kext的 Boot 时间行为时)* 作为 * 根用户,因为在代码/编译/加载/调试周期:

# Copies kext to /tmp, owned by root
sudo cp -r "path/to/built.kext" "/tmp/"
# Attempts to load kext
sudo kextutil "/tmp/built.kext"

字符串

  • (强制性免责声明指出,许多类型的kext现在都已被弃用,您需要确保编写kext真的,真的,真的**是您项目的正确前进方向。

相关问题