Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rosetta2 as a binfmt_misc handler on macOS Ventura #1088

Closed
jandubois opened this issue Oct 7, 2022 · 3 comments · Fixed by #1155
Closed

Use Rosetta2 as a binfmt_misc handler on macOS Ventura #1088

jandubois opened this issue Oct 7, 2022 · 3 comments · Fixed by #1155
Labels

Comments

@jandubois
Copy link
Member

jandubois commented Oct 7, 2022

I just learned that on macOS Ventura you can register Rosetta2 as a binfmt_misc handler inside a VM running in arm64 mode. That should mean that instead of using qemu-static emulation we should be able to run amd64 containers "compiled" into arm64, which should provide a big speed boost for code that is not available natively for arm64 (like mssql):

https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta

Originally posted by @jandubois in #889 (comment)

@AkihiroSuda
Copy link
Member

This needs implementing Virtualization.framework support (#889) right?

Or is it technically and legally possible to run Rosetta2 inside QEMU?
What is the license of the Rosetta2 binfmt_misc?

@jandubois
Copy link
Member Author

This needs implementing Virtualization.framework support (#889) right?

I don't know; it depends on if we can get VirtioFS support without it.

Or if it will be possible to somehow bridge between the VirtioFS volume and qemu in some other way. I suspect not, as event notification will be a challenge, but it doesn't hurt to try...

I suspect that the binfmt_misc handler is just copying stuff to the Rosetta volume; Rosetta will perform the translation on the host and put the results back into the volume, so binfmt_misc can execute it from there.

What is the license of the Rosetta2 binfmt_misc?

I didn't think about it, but we would not distribute the software; it would come directly from Apple. So how would calling this from inside qemu be any different from running any other part of the OS from inside any kind of application. Since we don't link it to qemu, but just call it from a kernel hook, I don't see any problems there either.

@chrisx8
Copy link
Contributor

chrisx8 commented Oct 29, 2022

Just a side note, Rosetta works great in UTM, when I launch VMs using Virtualization.framework.

I think theoretically, Rosetta should work in QEMU, but it's intended to be used with Virtualization.framework. The Rosetta binary is provided in a VirtioFS volume.

See UTM docs on Rosetta

@jandubois jandubois linked a pull request Nov 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants