Fix address slot overruns causing AMDSupport panics#102
Fix address slot overruns causing AMDSupport panics#102averycblack merged 10 commits intoacidanthera:masterfrom
Conversation
Offset was giving me nonsensically large values. I wasn't able to find any correlation between slide, kext offset, etc, though the addr field does appear to be accurate. Will need to be tested in older macOS versions (currently tested on Sonoma)
Not really safe as currently written but good enough for testing
|
Should be good to go now - turns out the panics were from the load commands being overwritten (probably). |
Lilu/Sources/kern_mach.cpp
Outdated
| return nullptr; | ||
| } | ||
|
|
||
| kern_return_t MachInfo::kcGetAddressSlots(mach_header_64 *hdr, segment_command_64 *segment) { |
There was a problem hiding this comment.
This changes things quite heavily for all macOS versions and we support back to 10.4, how far back can we test? If not so much, perhaps more reasonable to provide a guard with getKernelVersion?
There was a problem hiding this comment.
https://github.com/acidanthera/Lilu/blob/master/Lilu/Sources/kern_mach.cpp#L934
My understanding is that this should only affect Big Sur+. I made sure to not touch what I thought was the Prelinked kernel implementation here
Totally down to older versions, I think I got a big sur installer somewhere I could boot pretty quickly as a test. M4700 has 10.8 as well if we need a PK test.
There was a problem hiding this comment.
I do have reasonable suspicion that the sections are not page aligned in older versions. Taking a look at 10.13 and 10.8 now. Would it be worth extending this fix to those versions as well? It would increase the test surface pretty substantially.
There was a problem hiding this comment.
Could do, but really need to test. I have VMs with older versions, but I almost do not use kexts there.
|
The issue has been confirmed to be caused by an out-of-bounds write. I tested on my Hackintosh with macOS 26.2 (25C56) and can confirm the fix works. |
|
Tested relatively quickly on macOS versions 10.8, 10.13, 10.15, and 11. Didn't look at the logs too closely but I didn't see anything strange with the addresses printed and Whatevergreen, AppleALC, AiportBrcmFixup, etc all appeared to be working as far back as 10.8. This is still limited to x86_64 builds so theoretically we should just need tests on 10.6 and/or 10.7 I think. I don't have any machines that could realistically test those versions unfortunately. |
|
@vit9696 I see a couple paths forward - I'll leave it up to you as to what you want to do:
It sounds like @Goldfish64 does not have any machines running 10.6/7. I do not either - a VM test is probably the best we will get with these older versions. |
|
I tested both macOS 10.6.8 and macOS 10.7.5 in a VM with ATI Radeon HD 6450 GPU. I can confirm that VSMC and WEG load fine there. I can also confirm that patching I think this patch should be safe to merge. Could you handle that please? Will need to update the changelog and release planning. |
|
Will do |
|
Excellent!!! I tested it here with macOS Tahoe 26.2 using various setups, and one in particular using an RX 6900 XT (Device ID 73AF, which requires FakeID for 73BF) and the installation worked perfectly, no longer needing to temporarily disable WhateverGreen during the macOS Tahoe installation. Another thing I noticed that solved the problem was installing macOS Tahoe 26.2 with the AMFIPass.kext (1.4.1) kext and the set of 3 kexts to activate BCM94360 (IO80211FamilyLegacy.kext, IOSkywalkFamily.kext and AirPortBrcmNIC.kext) also enabled. |
EDIT: Should be good to go now
The address slot functionality assumed that the following text would be aligned on page boundaries after the macho header. This isn't the case for kexts though, with AMDSupport in Tahoe only having ~16 bytes of space between the header and first section within the __TEXT segment. Lilu would overwrite __cxx_global_var_init (first function in the __text section of the __TEXT segment) with the patched addresses, causing panics as shown below (Thanks @ParaDoX1994):

There is two parts to this PR -
but it is currently causing panics on my system and I haven't had a ton of time to debug.This is related to both acidanthera/WhateverGreen#126 and acidanthera/WhateverGreen#124