dortania / bugtracker

Dortania Bugtracker
110 stars 7 forks source link

"AllowRelocationBlock" quirk is required on macOS < 10.8 #251

Open unilock opened 2 years ago

unilock commented 2 years ago

Guide(s): OpenCore Install Guide, perhaps others (that I'm not familiar with)

Link to pages with issue: Every config.plist page (Penryn, Clarkdale, Sandy Bridge, ... not sure about AMD; however, the quirk was required to boot 10.7 in QEMU, virtualizing Penryn on Zen 2)

Issue: The "AllowRelocationBlock" quirk, under OpenCore's config.plist's "Booter" dictionary, is required to boot any version of macOS below 10.8 (exclusively) due to said versions not having implemented support for kernel sliding (KASLR). Without it, memory allocation will fail, presumably when allocating memory for the relocation block.

Sources: OpenCore documentation ("Configuration", section 5.5.1) + this issue on acidanthera's bugtracker

jafd commented 2 years ago

Unfortunately, this doesn't seem to be enough to get Tiger (10.4.10 as downloaded from archive.org) booting with QEMU + OVMF (32-bit). I'm sure I've tried every combination of AllowRelocationBlock and RebuildAppleMemoryMap along with DiscardHibernateMap and SetupVirtualMap. It's always an allocation error and this:

KVM internal error. Suberror: 1
extra data[0]: 0x0000000000000000
extra data[1]: 0x0000000000000030
extra data[2]: 0x0000000000000584
extra data[3]: 0x0000000000000000
extra data[4]: 0x0000000000000000
extra data[5]: 0x0000000000000000
emulation failure
EAX=2d505480 EBX=2d4e9cd3 ECX=2fedded0 EDX=00000000
ESI=2cb0f010 EDI=00000000 EBP=2feddedc ESP=2fedde90
EIP=000b0000 EFL=00010a07 [-O---PC] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
CS =0010 00000000 ffffffff 00c09f00 DPL=0 CS32 [CRA]
SS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
DS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
FS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
GS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT=     2f9de000 00000047
IDT=     2f4a4010 000007ff
CR0=80010033 CR2=00000000 CR3=2fc01000 CR4=00000660
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000800
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <ff> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
unilock commented 2 years ago

@jafd I don't believe that's related to this issue, as what I experienced was an error within XNU, not with KVM itself. I saw you made a comment on the related issue I opened on acidanthera's bug tracker; maybe open an issue on QEMU's bug tracker as well?

jafd commented 2 years ago

Well, I thought, maybe I should try with an older OVMF, so I took the one that Gabriel Somlo patched back in the day. Built a 32-bit version, and was able to move forward just a bit. This is where the log stops now:

00:000 910:000 OCBP: Predefined <nil> \System\Library\CoreServices\boot.efi was found
00:000 915:000 OCB: Adding entry type (T:2|F:0|G:0) - PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x3,0xFFFF,0x0)/\System\Library\CoreServices\boot.efi
00:000 920:000 OCB: Trying to get label from \System\Library\CoreServices\.contentDetails
00:000 924:000 OCB: Trying to get label from \System\Library\CoreServices\.disk_label.contentDetails
00:000 928:000 OCB: Registering entry Mac OS X Install Disc 1 [Apple] (T:2|F:0|G:0|E:0|B:0) - PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x3,0xFFFF,0x0)/\System\Library\CoreServices\boot.efi
00:000 934:000 OCBP: APFS recovery volume handle missing - \System\Library\CoreServices\
00:000 938:000 OCB: APFS recovery is not present - Not Found
00:000 941:000 OCPI: Device Path does not describe a partition
00:000 944:000 OCB: Adding custom entry OpenShell.efi (tool|B:0) -> OpenShell.efi
00:000 949:000 OCB: Registering entry OpenShell.efi [Auto] (T:128|F:0|G:0|E:0|B:0) - <nil>
00:000 953:000 OCB: Adding system entry Reset NVRAM
00:000 956:000 OCB: Registering entry Reset NVRAM [ResetNVRAM:NVRAMTool] (T:256|F:0|G:0|E:0|B:0) - <nil>
00:000 960:000 OCB: Showing menu... 
00:000 964:000 OCHK: InitHotKeys
00:000 967:000 OCKM: Allocated key repeat context 2EED8510 2E7CF990 2F5B2010
00:000 970:000 OCAE: Set screen resolution to 1280x720 - Success
00:000 974:000 OCTY: Registered handler
01:000 923:000 OCHK: FreeHotKeys
01:000 929:000 OCTY: Unregistered handler
01:000 934:000 OCKM: Freeing key repeat context 2EED8510 2E7CF990 2F5B2010
01:000 938:000 OCB: Should boot from 1. Mac OS X Install Disc 1 (T:2|F:0|G:0|E:0|DEF:0)
01:000 943:000 OCB: Perform boot Mac OS X Install Disc 1 to dp PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)/HD(2,GPT,56E67583-C44C-4F3B-A700-782B759591B5,0x64028,0x1FF5BFB0)/\System\Library\CoreServices\boot.efi (0/0)
01:000 978:000 OCSB: Secure boot is disabled, skipping
01:000 982:000 OCB: Arch filtering 2E4A5010(272585)->2E4A5040(134530) caps 3 - Success
01:000 986:000 OCB: Matching <>/0[0] args on type 2
01:000 990:000 OCABC: VMware Mac installed on 2EED8510 - Success
01:000 994:000 OCABC: MMIO devirt start
01:000 997:000 OCABC: MMIO devirt 0xFFC00000 (0x400 pages, 0x8000000000000001) skip 0
02:000 01:000 OCABC: MMIO devirt end, saved 4096 KB
02:000 04:000 OCABC: Only 140/256 slide values are usable!
02:000 08:000 OCABC: Valid slides - 10-26, 128-250
02:000 12:000 OC: Kext reservation size info 500000 exe 0
02:000 15:000 OC: Trying 32-bit XNU hook on mach_kernel
02:000 286:000 OC: Result of 32-bit XNU hook on mach_kernel (00000000) is Success
02:000 293:000 OCAK: Read kernel version 8.10.3 (81003)
02:000 298:000 OCAK: Skipping PanicKextDump on 81003
02:000 302:000 OC: Prelinked status - Not Found
02:000 309:000 OC: Trying kernelcache fuzzy matching on System\Library\Caches\com.apple.kernelcaches\kernelcache.B0161016
02:000 317:000 OC: Kext reservation size info 500000 exe 0
02:000 321:000 OC: Trying 32-bit XNU hook on mach_kernel
02:000 587:000 OC: Result of 32-bit XNU hook on mach_kernel (00000000) is Success
02:000 595:000 OCAK: Read kernel version 8.10.3 (81003)
02:000 600:000 OCAK: Skipping PanicKextDump on 81003
02:000 604:000 OC: Prelinked status - Not Found
02:000 612:000 OC: Kext reservation size info 500000 exe 0
02:000 618:000 OC: Trying 32-bit mkext hook on System\Library\Extensions.mkext
03:000 465:000 OC: Result of mkext hook on System\Library\Extensions.mkext is Success
03:000 491:000 OCAK: Patch success dummy AppleIntelCPUPowerManagement
03:000 495:000 OCAK: Registering 0 APFS timeout
03:000 522:000 OCAK: Failed to mkext find com.apple.filesystems.apfs - Not Found
03:000 525:000 OCAK: Skipping apfs timeout on 81003
03:000 537:000 OC: Mkext status - Success
03:000 542:000 OC: Kext reservation size info 500000 exe 0
03:000 546:000 OC: Trying 32-bit XNU hook on mach_kernel
03:000 818:000 OC: Result of 32-bit XNU hook on mach_kernel (00000000) is Success
03:000 827:000 OCAK: Read kernel version 8.10.3 (81003)
03:000 831:000 OCAK: Skipping PanicKextDump on 81003
03:000 835:000 OC: Prelinked status - Not Found
03:000 839:000 OC: Kext reservation size info 500000 exe 0
03:000 842:000 OCAK: Registering 0 APFS timeout
03:000 845:000 OC: Result of SLE hook on System\Library\Extensions is Success
03:000 850:000 OC: Kext reservation size info 500000 exe 0
03:000 855:000 OC: Trying 32-bit mkext hook on System\Library\Extensions.mkext
04:000 719:000 OC: Result of mkext hook on System\Library\Extensions.mkext is Success
04:000 746:000 OCAK: Patch success dummy AppleIntelCPUPowerManagement
04:000 750:000 OCAK: Registering 0 APFS timeout
04:000 776:000 OCAK: Failed to mkext find com.apple.filesystems.apfs - Not Found
04:000 781:000 OCAK: Skipping apfs timeout on 81003
04:000 794:000 OC: Mkext status - Success
04:000 801:000 OC: Kext reservation size info 500000 exe 0
04:000 805:000 OCAK: Registering 0 APFS timeout
04:000 808:000 OC: Result of SLE hook on System\Library\Extensions is Success
04:000 814:000 AmiShimTimerBoostExit changed current period to 100000

And on the screen, I'm seeing this: image

Thus, can't see if it's XNU yet, or maybe boot.efi.

memmap says:

Type       Start            End              # Pages          Attributes
BS_Code    0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available  0000000000001000-000000000009FFFF 000000000000009F 000000000000000F
Available  0000000000100000-0000000000805FFF 0000000000000706 000000000000000F
ACPI_NVS   0000000000806000-0000000000807FFF 0000000000000002 000000000000000F
Available  0000000000808000-000000000080FFFF 0000000000000008 000000000000000F
ACPI_NVS   0000000000810000-00000000008FFFFF 00000000000000F0 000000000000000F
BS_Data    0000000000900000-00000000013FFFFF 0000000000000B00 000000000000000F
Available  0000000001400000-000000000FFFFFFF 000000000000EC00 000000000000000F
BS_Code    0000000010000000-0000000010004FFF 0000000000000005 000000000000000F
Available  0000000010005000-000000002BF6FFFF 000000000001BF6B 000000000000000F
BS_Data    000000002BF70000-000000002BF8FFFF 0000000000000020 000000000000000F
Available  000000002BF90000-000000002E266FFF 00000000000022D7 000000000000000F
LoaderCode 000000002E267000-000000002E3A6FFF 0000000000000140 000000000000000F
Available  000000002E3A7000-000000002E474FFF 00000000000000CE 000000000000000F
BS_Data    000000002E475000-000000002E4A6FFF 0000000000000032 000000000000000F
Available  000000002E4A7000-000000002E4B9FFF 0000000000000013 000000000000000F
BS_Data    000000002E4BA000-000000002E4E7FFF 000000000000002E 000000000000000F
BS_Code    000000002E4E8000-000000002E511FFF 000000000000002A 000000000000000F
BS_Data    000000002E512000-000000002E53CFFF 000000000000002B 000000000000000F
BS_Code    000000002E53D000-000000002E54BFFF 000000000000000F 000000000000000F
BS_Data    000000002E54C000-000000002E55BFFF 0000000000000010 000000000000000F
RT_Code    000000002E55C000-000000002E565FFF 000000000000000A 800000000000000F
BS_Data    000000002E566000-000000002E5BAFFF 0000000000000055 000000000000000F
LoaderCode 000000002E5BB000-000000002E6BBFFF 0000000000000101 000000000000000F
BS_Data    000000002E6BC000-000000002E7BDFFF 0000000000000102 000000000000000F
LoaderCode 000000002E7BE000-000000002E7CBFFF 000000000000000E 000000000000000F
BS_Data    000000002E7CC000-000000002E7D1FFF 0000000000000006 000000000000000F
Reserved   000000002E7D2000-000000002E7D3FFF 0000000000000002 000000000000000F
BS_Data    000000002E7D4000-000000002E7E3FFF 0000000000000010 000000000000000F
BS_Code    000000002E7E4000-000000002E869FFF 0000000000000086 000000000000000F
BS_Data    000000002E86A000-000000002ECEAFFF 0000000000000481 000000000000000F
ACPI_NVS   000000002ECEB000-000000002ECEEFFF 0000000000000004 000000000000000F
ACPI_Recl  000000002ECEF000-000000002ECF0FFF 0000000000000002 000000000000000F
BS_Data    000000002ECF1000-000000002ECF1FFF 0000000000000001 000000000000000F
RT_Data    000000002ECF2000-000000002ECF2FFF 0000000000000001 800000000000000F
ACPI_Recl  000000002ECF3000-000000002ECF3FFF 0000000000000001 000000000000000F
ACPI_NVS   000000002ECF4000-000000002ECFAFFF 0000000000000007 000000000000000F
Reserved   000000002ECFB000-000000002ED10FFF 0000000000000016 000000000000000F
RT_Data    000000002ED11000-000000002EDAEFFF 000000000000009E 800000000000000F
BS_Data    000000002EDAF000-000000002FCAEFFF 0000000000000F00 000000000000000F
Available  000000002FCAF000-000000002FCB9FFF 000000000000000B 000000000000000F
BS_Code    000000002FCBA000-000000002FE2EFFF 0000000000000175 000000000000000F
RT_Code    000000002FE2F000-000000002FE5EFFF 0000000000000030 800000000000000F
RT_Data    000000002FE5F000-000000002FE82FFF 0000000000000024 800000000000000F
Reserved   000000002FE83000-000000002FE86FFF 0000000000000004 000000000000000F
ACPI_Recl  000000002FE87000-000000002FE8EFFF 0000000000000008 000000000000000F
ACPI_NVS   000000002FE8F000-000000002FE92FFF 0000000000000004 000000000000000F
BS_Data    000000002FE93000-000000002FEB3FFF 0000000000000021 000000000000000F
BS_Code    000000002FEB4000-000000002FEC9FFF 0000000000000016 000000000000000F
BS_Data    000000002FECA000-000000002FEDAFFF 0000000000000011 000000000000000F
BS_Code    000000002FEDB000-000000002FEEBFFF 0000000000000011 000000000000000F
RT_Data    000000002FEEC000-000000002FF6FFFF 0000000000000084 800000000000000F
ACPI_NVS   000000002FF70000-000000002FFFFFFF 0000000000000090 000000000000000F
Reserved   0000000080000000-000000008FFFFFFF 0000000000010000 0000000000000001
MMIO       00000000FFC00000-00000000FFFFFFFF 0000000000000400 8000000000000001

  Reserved  :         65,564 Pages (268,550,144 Bytes)
  LoaderCode:            591 Pages (2,420,736 Bytes)
  LoaderData:              0 Pages (0 Bytes)
  BS_Code   :            609 Pages (2,494,464 Bytes)
  BS_Data   :          8,412 Pages (34,455,552 Bytes)
  RT_Code   :             58 Pages (237,568 Bytes)
  RT_Data   :            327 Pages (1,339,392 Bytes)
  ACPI_Recl :             11 Pages (45,056 Bytes)
  ACPI_NVS  :            401 Pages (1,642,496 Bytes)
  MMIO      :          1,024 Pages (4,194,304 Bytes)
  MMIO_Port :              0 Pages (0 Bytes)
  PalCode   :              0 Pages (0 Bytes)
  Available :        186,075 Pages (762,163,200 Bytes)
  Persistent:              0 Pages (0 Bytes)
              -------------- 
Total Memory:            767 MB (804,798,464 Bytes)
jafd commented 2 years ago

Hmm, from the looks of it, the allocation overlaps with ACPI and Boot Services:

Available  0000000000100000-0000000000805FFF 0000000000000706 000000000000000F <-- 0x583000 is somewhere here
ACPI_NVS   0000000000806000-0000000000807FFF 0000000000000002 000000000000000F
Available  0000000000808000-000000000080FFFF 0000000000000008 000000000000000F
ACPI_NVS   0000000000810000-00000000008FFFFF 00000000000000F0 000000000000000F
BS_Data    0000000000900000-00000000013FFFFF 0000000000000B00 000000000000000F
Available  0000000001400000-000000000FFFFFFF 000000000000EC00 000000000000000F <-- 0x21ab000 which is the end address is here

Okay, now how do I fix the alloc address? :-/

jafd commented 2 years ago

Okay, even when I got the memory map to a saner state (by disabling S3 and S4 on the VM), I'm still getting the same error.