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

Darwin: sysctl kern.uuid returns the same value on two different devices #1058

Closed
d1ss0nanz opened this issue Apr 12, 2021 · 7 comments
Closed

Comments

@d1ss0nanz
Copy link
Contributor

d1ss0nanz commented Apr 12, 2021

Describe the bug
I have two MacBooks, a 2017 MBP 13 and a 2020 MBP 16.

On both devices InfoStat.HostID holds the same UUID string because the output of sysctl kern.uuid is the same on both systems.

A quick Google search the colliding HostID reveals that the problem is much larger: https://www.google.com/search?q=C86236B2-4976-3542-80CA-74A6B8B4BA03

To Reproduce
[~]$ sysctl kern.uuid kern.uuid: C86236B2-4976-3542-80CA-74A6B8B4BA03 [~]$ ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)' "IOPlatformUUID" = "E646F33F-0C8D-xxxx-yyyy-8BB62B8C33CD"

[~]$ sysctl kern.uuid kern.uuid: C86236B2-4976-3542-80CA-74A6B8B4BA03 [~]$ ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)' "IOPlatformUUID" = "F6C92D4C-07EB-aaaa-bbbb-9144BB09C35B"

Expected behavior
There should be different HostIDs returned on different hosts.

Environment:
Machine A:
[~]$ sw_vers ProductName: macOS ProductVersion: 11.2.3 BuildVersion: 20D91 [~]$ uname -a Darwin Daniels-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Machine B:
[~]$ sw_vers ProductName: macOS ProductVersion: 11.2.3 BuildVersion: 20D91 [~]$ uname -a Darwin Daniels-MacBook-Pro-13.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

@d1ss0nanz
Copy link
Contributor Author

BTW: IOPlatformUUID is the official Hardware UUID that is show in the Hardware Overview of the System Report.

@d1ss0nanz
Copy link
Contributor Author

d1ss0nanz commented Apr 12, 2021

I've seen #350 and want to mention that neither of the two hosts has been somehow imaged. I've acquired both from different sources and they are clean setups.

I've updated both independently to Big Sur. And they are both using iCloud.

@d1ss0nanz
Copy link
Contributor Author

d1ss0nanz commented Apr 12, 2021

I've checked the output of sysctl kern and the following UUIDs are also the same between the two systems:

kern.kernelcacheuuid
kern.systemfilesetuuid
kern.filesetuuid

kern.auxiliaryfilesetuuid for example is not the same.

@d1ss0nanz
Copy link
Contributor Author

Digging through the Darwin header files, I'm wondering if kern.uuid was ever meant to be unique across machines?

https://github.com/apple/darwin-xnu/blob/8f02f2a044b9bb1ad951987ef5bab20ec9486310/bsd/kern/kern_sysctl.c#L1850 seems to be the place where sysctl is retrieving the value

https://github.com/apple/darwin-xnu/blob/8f02f2a044b9bb1ad951987ef5bab20ec9486310/osfmk/kern/debug.c#L332 could be the place where kernel_uuid_string[] is initialised. If that is the case, it is extracted from a kernel header and based on "information on the internet" created at link time and used solely for identifying kernel builds in PANICs.

No comes the bummer: I've searched for my non-unique HostID on Google: >1000 results of Kernel Panics, all from Big Sur builds.

https://www.google.com/search?q=C86236B2-4976-3542-80CA-74A6B8B4BA03

@d1ss0nanz d1ss0nanz changed the title sysctl kern.uuid returns the same value on two different devices Darwin: sysctl kern.uuid returns the same value on two different devices Apr 13, 2021
@d1ss0nanz
Copy link
Contributor Author

I've opened #1059

@Lomanic
Copy link
Collaborator

Lomanic commented Apr 13, 2021

Indeed, kern.uuid seems to be a unique identifier for a given kernel version, 622D2470-C34D-31F9-A62B-6AA9A3C6A3CD returns a lot of results for my 10.12 VM.

https://developer.apple.com/library/archive/technotes/tn1103/_index.html doesn't list IOPlatformUUIDas a unique identifiers, but it's probably because it's an older doc. https://github.com/golang/go/wiki/Darwin tells us that the oldest MacOS version ever supported is Mac OS X Snow Leopard 10.6, and this IOPlatformUUID variable property seems to have been introduced with 10.5, so this is safe to use.

@shirou
Copy link
Owner

shirou commented Oct 30, 2021

closed via #1059 is merged. Thank you for the report! (and also that survey, @Lomanic!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants