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

Utils.swift: Add handling for Intel Virtual Machines #622

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

khronokernel
Copy link
Contributor

@khronokernel khronokernel commented Jul 30, 2024

Pallas will override the host’s detected Board ID to "VMM-x86_64" on Intel VMs to allow for software updates regardless of the original model.


Reference:

Pallas will override the host’s detected Board ID to “VMM-x86_64” on Intel VMs to allow for software updates regardless of the original board ID.
let bridgeID = getBridgeModelID()
let hardwareModelID = getIORegInfo(serviceTarget: "target-sub-type") ?? "Unknown"
let gestaltModelStringID = getKeyResultFromGestalt("HWModelStr")

if getVirtualMachineStatus() && getCPUTypeString() == "Intel" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely curious, but what happens on non intel VMs, like apple silicon? I'd like to be complete here before landing the next change to nudge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Apple Silicon, since Apple controls the whole process they simply use the machine's properties as-is (so VMA2MACOSAP for VirtualMac2,1 systems, and likely VMA3MACOSAP for VirtualMac3,1 if that ever comes out)

The reason they implemented this odd VMM-x86_64 system for Intel VMs is that VMware, Parallels, etc control much more of the environment and as such more difficult to support (ex. does Apple want to add VMware7,1, Parallels19,1, etc to their catalog). Apple's solution was to override the model properties when doing software updates

Copy link
Contributor Author

@khronokernel khronokernel Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To follow up, I reversed the relevant framework responsible for this logic:

/System/Library/PrivateFrameworks/SoftwareUpdateCoreSupport.framework/Versions/A/SoftwareUpdateCoreSupport

TL;DR:

  1. _BIDeviceInfoGetHWTargetForMobileAsset fetches the model information
  2. If the host has the x86legacyap secure boot identifier (non-T2), function invokes _BIDeviceInfoGetMacBoardID
  3. If host is virtual machine, return string with format: @VMM-%s, sysctlbyname("hw.machine") (results in VMM-x86_64)
  4. Otherwise, return Board ID from IODeviceTree
Screenshot 2024-07-30 at 3 16 23 PM

@erikng erikng changed the base branch from main to development August 1, 2024 12:03
@erikng
Copy link
Member

erikng commented Aug 1, 2024

I'm going to merge this as-is then make some changes. Thanks for the PR and the feedback/discovery you did. We should talk on Slack some more :)

@erikng erikng merged commit c378a6e into macadmins:development Aug 1, 2024
@erikng erikng mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants