MachineIdentifier Storage Analysis
Background
Migrating machineIdentifier from a standalone machineIdentifier.bin file to the config.plist manifest requires validation that this change won't cause compatibility issues with Virtualization.framework.
Methodology
- Analyzed security-pcc's VMBundle.Config implementation
- Checked for dependencies between VZMacAuxiliaryStorage and VZMacMachineIdentifier
- Verified Virtualization.framework API behavior
Key Findings
1. security-pcc Implementation
Storage Location: machineIdentifier stored directly in config.plist
Loading Method:
2. VZMacAuxiliaryStorage Independence
Creation API:
Key Points:
- Only requires
hwModelparameter - Does NOT need
machineIdentifier - Two components are completely independent
3. VZMacPlatformConfiguration Assembly
Three independent components, no binding validation.
Data Serialization Verification
machineIdentifier Data Representation
plist Compatibility
PropertyList Encoder Support:
Datatype in plist is represented as<data>binary block- Fully compatible, no size limit (for ECID's 8 bytes)
Risk Assessment
✅ No-Risk Items
-
API Dependency:
VZMacMachineIdentifier(dataRepresentation:)only needsDataparameter- Doesn't care about data source (file vs plist vs memory)
-
AuxiliaryStorage Independence:
- Creating
VZMacAuxiliaryStorageonly needshardwareModel - Completely decoupled from
machineIdentifier
- Creating
-
ECID Stability:
dataRepresentationis deterministic serialization- Same ECID always produces same
Data
-
security-pcc Precedent:
- Official PCC tools use this approach
- Thoroughly tested
⚠️ Considerations (Already Handled)
-
First Boot Creation:
- ✅ Implemented: Detect empty data, auto-create and save
-
Data Corruption Recovery:
- ✅ Implemented: Detect invalid data, auto-regenerate
-
Backward Compatibility:
- ⚠️ Existing VMs need migration
- But user stated "暂时不用考虑兼容性" (no need to consider compatibility for now)
Conclusion
✅ No Issues
Integrating machineIdentifier into config.plist is safe and correct:
- API Compatible: Virtualization.framework doesn't care about data source
- Component Independence: AuxiliaryStorage and machineIdentifier have no dependencies
- Official Precedent: security-pcc has validated this approach
- Reliable Serialization:
Data↔VZMacMachineIdentifierconversion is stable
Implementation Verification
Our implementation matches security-pcc exactly:
Identical code pattern to security-pcc.
Final Verdict
No issues.
Our implementation approach:
- Follows security-pcc's official pattern
- Aligns with Virtualization.framework API design
- Properly handles first-boot creation and data recovery scenarios
Safe to use.