Since ecbc4cf06d6c9253ba92065f320ddd6eeff3177f ("wineboot: Retrieve CPU details through the SMBIOS table."), wineboot assumes that an SMBIOS 3.0+ processor information table is present, and uses those values to populate CPU info in the registry.
On most platforms, raw SMBIOS tables are not available to unprivileged applications, so ntdll "creates" SMBIOS tables with information from other APIs. ntdll creates a v3.0+ processor table, and wineboot is happy.
However on Intel macOS, raw SMBIOS tables are available to unprivileged applications, and ntdll passes them straight through to wineboot. Macs did not start using SMBIOS v3.0 until ~2017, any machines older than that are missing the `thread_count2` variable that `wineboot` uses, leading to a crash or undefined behavior.
One solution would be to stop using actual SMBIOS tables on any Macs, and have ntdll generate the tables. I worry this could cause issues with software that "fingerprints" a machine using SMBIOS tables though (MS Office needed reactivation when GetSystemFirmwareTable was implemented, for example).
Instead, with some small fixes, we can keep using actual SMBIOS tables for most Intel Macs.
There are 4 categories of Macs to consider: - Macs with v2.4 or earlier SMBIOS tables (~2014 and earlier): The processor table doesn't have any `thread_count` fields. Given the age of these machines (none can run an OS still supported by Apple), I think it's acceptable to avoid larger changes to wineboot and have ntdll generate SMBIOS tables. - Macs with v2.5 - v2.9 tables (~2015-2017): These have the `thread_count` field, but not `thread_count2`. With this MR, these should be working again and will still use actual SMBIOS tables. - Macs with v3.0 or later tables (~2018 and newer): These have all the needed fields, and are still using actual SMBIOS tables. - Apple Silicon Macs don't use SMBIOS, ntdll generates the tables.
From: Brendan Shanks bshanks@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57019 --- programs/wineboot/wineboot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 27986527edf..1b04fd3b202 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -822,7 +822,7 @@ static void create_bios_processor_values( HKEY system_key, const char *buf, UINT { const struct smbios_header *hdr; const struct smbios_processor *proc; - unsigned int pkg, core, offset, i; + unsigned int pkg, core, offset, i, thread_count; HKEY hkey, cpu_key, fpu_key = 0, env_key; SYSTEM_CPU_INFORMATION sci; PROCESSOR_POWER_INFORMATION* power_info; @@ -863,6 +863,7 @@ static void create_bios_processor_values( HKEY system_key, const char *buf, UINT for (pkg = core = 0; ; pkg++) { if (!(hdr = find_smbios_entry( SMBIOS_TYPE_PROCESSOR, pkg, buf, len ))) break; + if (hdr->length < 0x28) break; /* version 2.5 is required */ proc = (const struct smbios_processor *)hdr; offset = (const char *)proc - buf + proc->hdr.length; version = get_smbios_string( proc->version, buf, offset, len ); @@ -894,7 +895,8 @@ static void create_bios_processor_values( HKEY system_key, const char *buf, UINT break; }
- for (i = 0; i < proc->thread_count2; i++, core++) + thread_count = (proc->hdr.length >= 0x30) ? proc->thread_count2 : proc->thread_count; + for (i = 0; i < thread_count; i++, core++) { swprintf( buffer, ARRAY_SIZE(buffer), L"%u", core ); if (!RegCreateKeyExW( cpu_key, buffer, 0, NULL, REG_OPTION_VOLATILE,
From: Brendan Shanks bshanks@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57019 --- dlls/ntdll/unix/system.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index e9ed8b6f3a4..13f37ee8a9a 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2059,7 +2059,16 @@ static struct smbios_prologue *create_smbios_data(void) struct smbios_buffer buf = { 0 }; struct smbios_prologue *ret;
- if ((ret = get_smbios_from_iokit())) return ret; + ret = get_smbios_from_iokit(); + if (ret) + { + /* wineboot requires SMBIOS 2.5 or higher tables. */ + if ((ret->major_version >= 3) || + (ret->major_version == 2 && ret->minor_version >= 5)) + return ret; + else + free(ret); + }
/* Apple Silicon Macs don't have SMBIOS, we need to generate it. * Use strings and data from IOKit when available.
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150756
Your paranoid android.
=== debian11b (64 bit WoW report) ===
mf: mf.c:6536: Test failed: Test 3: Unexpected hr 0xc00d36b2.