Debugging universal kext panic on 11.2.1 Apple Silicon + KDK11.3

I'm running into problems trying to get symbols loaded into an lldb session debugging a panic of a custom, universal kext. The panic happens when LogicX closes a MIDI port implemented by a MIDIplugin and serviced by the kext.
When the KP happens, I am able to attach the debugger, but running:
Code Block
command script import "/Library/Developer/KDKs/KDK_11.3_20E5186d.kdk/System/Library/Kernels/kernel.release.t8101.dSYM/Contents/Resources/Python/kernel_release.py"

results in this:

Code Block
(lldb) kdp-remote 192.168.1.96
Version: Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101; UUID=9FE8C0DA-8ED0-381C-9CEC-2A779F3E1503; stext=0xfffffe00142b4000
Kernel UUID: 9FE8C0DA-8ED0-381C-9CEC-2A779F3E1503
Load Address: 0xfffffe00142b4000
WARNING: Unable to locate kernel binary on the debugger system.
Target arch: arm64e
Traceback (most recent call last):
File "/Library/Developer/KDKs/KDK_11.3_20E5186d.kdk/System/Library/Kernels/kernel.release.t8101.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 704, in __init__
self.register_set = Armv8_RegisterSet()
File "/Library/Developer/KDKs/KDK_11.3_20E5186d.kdk/System/Library/Kernels/kernel.release.t8101.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 63, in __init__
self.switch_context_address = osplugin_target_obj.FindSymbols('Switch_context')[0].GetSymbol().GetStartAddress().GetLoadAddress(osplugin_target_obj)
File "/Users/wdawson/Downloads/Xcode-beta.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 10450, in __getitem__
raise IndexError
IndexError
Target arch: arm64e
Traceback (most recent call last):
File "/Library/Developer/KDKs/KDK_11.3_20E5186d.kdk/System/Library/Kernels/kernel.release.t8101.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 704, in __init__
self.register_set = Armv8_RegisterSet()
File "/Library/Developer/KDKs/KDK_11.3_20E5186d.kdk/System/Library/Kernels/kernel.release.t8101.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 63, in __init__
self.switch_context_address = osplugin_target_obj.FindSymbols('Switch_context')[0].GetSymbol().GetStartAddress().GetLoadAddress(osplugin_target_obj)
File "/Users/wdawson/Downloads/Xcode-beta.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 10450, in __getitem__
raise IndexError
IndexError
Process 1 stopped
* thread #1, stop reason = signal SIGSTOP
frame #0: 0xffffffe0143c9770
error: kdp read memory failed
Target 0: (No executable module.) stopped.
(lldb)

Things I've tried:
  1. Multiple permutations of Xcode 12.4 - 12.5b2 and KDKs, though only KDK11.3 seems to have the release T8101 kernel binary.

  2. On Intel (because the KDK says you can't do it on M1), where the KP does NOT happen, running the DEVELOPMENT and KASAN kernels hoping they might assert on something bad the kext is doing.

  3. Loading a panic coredump into lldb. (Same result as "live" debugging the panic.

Can anyone shed any light or at least validate that I should be able to symbolicate in an lldb session using the KDKs?

Thanks in advance for any pointers or help!
  • Wade


I don't have a solution and am not a developer, but I get the identical crash with same date/timestamp as you. Mac mini M1, Big Sur 11.2.2. When I restart my Mac, the crash message always shows up as if it was a panic crash/restart, with this text in the log. Is an audio kext causing this? I did have a virtual sound driver (blackhole) installed for awhile, but I removed it after it started preventing me from choosing audio sources. I also run Parallels M1 tech preview, and a VM of Windows 10 for ARM on that. Which occasionally has a crash, but not sure if it's related to this.


I see very similar error messages when I try to get symbols for a kernel crash. I have the gut feeling that it is related to the fact that my host machine is an Intel one and the target is an Apple Silicon or maybe because my host OS is Catalina.
Code Block
% lldb /Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel
(lldb) target create "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel"
Loading kernel debugging from /Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/kernel.py
LLDB version lldb-1200.0.44.2
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
settings set target.process.python-os-plugin-path "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py"
settings set target.trap-handler-names hndl_allintrs hndl_alltraps trap_from_kernel hndl_double_fault hndl_machine_check _fleh_prefabt _ExceptionVectorsBase _ExceptionVectorsTable _fleh_undef _fleh_dataabt _fleh_irq _fleh_decirq _fleh_fiq_generic _fleh_dec
command script import "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/xnu.py"
xnu debug macros loaded successfully. Run showlldbtypesummaries to enable type summaries.
settings set target.process.optimization-warnings false
Current executable set to '/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel' (x86_64).
(lldb) kdp-remote 192.168.3.1
Version: Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101; UUID=9FE8C0DA-8ED0-381C-9CEC-2A779F3E1503; stext=0xfffffe001eeec000
Kernel UUID: 9FE8C0DA-8ED0-381C-9CEC-2A779F3E1503
Load Address: 0xfffffe001eeec000
WARNING: Unable to locate kernel binary on the debugger system.
Target arch: arm64e
Traceback (most recent call last):
File "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 704, in __init__
self.register_set = Armv8_RegisterSet()
File "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 63, in __init__
self.switch_context_address = osplugin_target_obj.FindSymbols('Switch_context')[0].GetSymbol().GetStartAddress().GetLoadAddress(osplugin_target_obj)
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 10450, in __getitem__
raise IndexError
IndexError
Target arch: arm64e
Traceback (most recent call last):
File "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 704, in __init__
self.register_set = Armv8_RegisterSet()
File "/Library/Developer/KDKs/KDK_11.2.3_20D91.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py", line 63, in __init__
self.switch_context_address = osplugin_target_obj.FindSymbols('Switch_context')[0].GetSymbol().GetStartAddress().GetLoadAddress(osplugin_target_obj)
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 10450, in __getitem__
raise IndexError
IndexError
Process 1 stopped
* thread #1, stop reason = signal SIGSTOP
frame #0: 0xffffffe01f001770
error: kdp read memory failed
Target 0: (No executable module.) stopped.

Debugging universal kext panic on 11.2.1 Apple Silicon + KDK11.3
 
 
Q