简体   繁体   English

Apple Hypervisor 在 MacOS Big Sur beta 11.0.1 上完全崩溃

[英]Apple Hypervisor is completely broken on MacOS Big Sur beta 11.0.1

I am trying to make a basic command-line tool that makes a VM and runs something using Apple Hypervisor.我正在尝试制作一个基本的命令行工具,该工具可以制作 VM 并使用 Apple Hypervisor 运行某些东西。

When I try to run hv_vm_create(HV_VM_DEFAULT) it gives me an error code -85377023.当我尝试运行hv_vm_create(HV_VM_DEFAULT)它给了我一个错误代码 -85377023。

I tried enforcing App Sandbox and setting the entitlement accordingly for the Big Sur compile target, and now I am getting this output in the console:我尝试强制执行 App Sandbox 并相应地为 Big Sur 编译目标设置权利,现在我在控制台中得到了这个输出:

Killed

From what I understand from this, this is AMFI killing my process.据我了解,这是 AMFI 扼杀了我的进程。 Is this a bug or my problem?这是错误还是我的问题?

When I decided to go down the rabbit hole, I found that in the MacOS Big Sur 11.0.1 beta release notes, they deprecated hv_vm_run(_:) , while the API documentation says that this function is in beta.当我决定深入研究时,我发现在 MacOS Big Sur 11.0.1 测试版发行说明中,他们弃用了hv_vm_run(_:) ,而 API 文档说该功能处于测试阶段。

I didn't go as far as disabling AMFI with a kernel flag, but I am almost certain that this is not expected behavior.我没有使用内核标志禁用 AMFI,但我几乎可以肯定这不是预期的行为。 And that, no matter what, hv_vm_run(_:) can never be deprecated OR be in beta.而且,无论如何, hv_vm_run(_:)永远不会被弃用或处于测试阶段。 I am sure that this function existed well before Big Sur.我确信这个功能在 Big Sur 之前就已经存在了。

If anyone can help me with this or just give a response, please do.如果有人可以帮助我解决这个问题或只是做出回应,请这样做。 Do not keep me in darkness as I don't want to waste time on something which is potentially broken.不要让我陷入黑暗,因为我不想在可能损坏的东西上浪费时间。

Thank you.谢谢你。

PS: I know that there is already a thread in the Apple Developer forums, I am the one who posted it. PS:我知道苹果开发者论坛上已经有一个帖子了,我是发帖的人。 Though, no one is answering there because their community is not even close to being as large as Stack Overflow.尽管如此,没有人回答那里,因为他们的社区甚至没有 Stack Overflow 那么大。

This error code you're seeing is just a poor UX on the macOS side: what it's really trying to communicate is that the com.apple.security.hypervisor entitlement is missing.您看到的这个错误代码只是 macOS 方面的一个糟糕的用户体验:它真正想要传达的是缺少com.apple.security.hypervisor权利。

If you're using Xcode, you can add it like that:如果您使用的是 Xcode,则可以像这样添加它:

  1. Press ⌘N and create a new Property List file.⌘N并创建一个新的属性列表文件。
  2. Add a new property with the key com.apple.security.hypervisor and a boolean value set to YES .添加一个键为com.apple.security.hypervisor且布尔值设置为YES的新属性。
  3. Go to ProjectTargetBuild SettingsSigningCode Signing Entitlements and make sure it uses your newly created entitlements file.转到ProjectTargetBuild SettingsSigningCode Signing Entitlements并确保它使用您新创建的权利文件。

Alternatively, you can use command line:或者,您可以使用命令行:

codesign -s - --entitlements app.entitlements --force path/to/your/binary

Where app.entitlements contents is as follows:其中app.entitlements内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.hypervisor</key>
    <true/>
</dict>
</plist>

The other way you to solve this is to simply set the Deployment Target to 10.13 in the Xcode's settings (props to Alexander Pinske ):解决此问题的另一种方法是简单地在 Xcode 的设置中将部署目标设置为10.13 (支持Alexander Pinske ):

在 General 选项卡中设置 Xcode 部署目标

The reason this works is most likely due to backwards-compatibility, so bear in mind that this might change in the future macOS releases, or, perhaps, on newly introduced platforms like Apple Silicon.这样做的原因很可能是由于向后兼容性,因此请记住,这可能会在未来的 macOS 版本中发生变化,或者可能在 Apple Silicon 等新推出的平台上发生变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检查 MacOS Big Sur 上的库是否存在 - Checking for library existence on MacOS Big Sur 在 macOS Big Sur 上接收 UDP 多播 - Receiving UDP multicast on macOS Big Sur make 命令在 MacOS Big Sur 上不起作用 - 11.5.2 - make command does not work on MacOS Big Sur - 11.5.2 C 代码在 MacOS Catalina 或 Big Sur 中无法编译 - C Code Won't Compile in MacOS Catalina or Big Sur 如果删除了运行它的可执行文件,为什么 fork() 在 MacOs Big Sur 上会失败? - Why does fork() fail on MacOs Big Sur if the executable that runs it is deleted? 配置:错误:C 编译器无法创建可执行文件(macOS:Big Sur) - configure: error: C compiler cannot create executables (macOS: Big Sur) Pecl 无法在 macOS Big Sur 上编译 Imagick 扩展,如何解决? - Pecl cant compile Imagick extention on macOS Big Sur, how fix it? 我目前在 Eclipse MacOS Big Sur 上调试 GDB 时遇到错误 - I'm currently experiencing an error with GDB debugging on Eclipse MacOS Big Sur 如何使用 CLion 在 MacOS Big Sur 上查看 memory 泄漏? - How can I see memory leaks on MacOS Big Sur using CLion? 我需要在 macOS Big Sur 上调用 CSBackupIsItemExcluded(可能来自框架或核心服务)什么? - What do I need to call CSBackupIsItemExcluded (probably from either Frameworks or Core Services) on macOS Big Sur?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM