[Lldb-commits] [lldb] r319500 - We had a situation where a kext was inlined into the kernel,

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 30 15:31:19 PST 2017


Author: jmolenda
Date: Thu Nov 30 15:31:18 2017
New Revision: 319500

URL: http://llvm.org/viewvc/llvm-project?rev=319500&view=rev
Log:
We had a situation where a kext was inlined into the kernel,
but still listed in the kernel's kext table with the kernel
binary UUID.  This resulted in the kernel text section being
loaded at the kext address and problems ensuing.  Instead,
if there is a kext with the same UUID as the kernel, lldb
should skip over it.

<rdar://problem/35757689> 

Modified:
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=319500&r1=319499&r2=319500&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Nov 30 15:31:18 2017
@@ -1229,6 +1229,16 @@ bool DynamicLoaderDarwinKernel::ParseKex
         break;
       }
     }
+    // If this "kext" entry is actually an alias for the kernel --
+    // the kext was compiled into the kernel or something -- then
+    // we don't want to load the kernel's text section at a different
+    // address.  Ignore this kext entry.
+    if (kext_summaries[new_kext].GetUUID().IsValid() 
+        && m_kernel.GetUUID().IsValid() 
+        && kext_summaries[new_kext].GetUUID() == m_kernel.GetUUID()) {
+      to_be_added[new_kext] = false;
+      break;
+    }
     if (add_this_one) {
       number_of_new_kexts_being_added++;
     }




More information about the lldb-commits mailing list