Author: Jason Molenda
Date: 2023-11-03T16:26:12-07:00
New Revision: de24b0ef94bc0c4483e39e1bad75dbec793f2b94

URL: 
https://github.com/llvm/llvm-project/commit/de24b0ef94bc0c4483e39e1bad75dbec793f2b94
DIFF: 
https://github.com/llvm/llvm-project/commit/de24b0ef94bc0c4483e39e1bad75dbec793f2b94.diff

LOG: Strip authentication bits from vtable load address (#71128)

The current Darwin arm64e ABI on AArch64 systems using ARMv8.3 & newer
cores, adds authentication bits to the vtable pointer address. The
vtable address must be in addressable memory, so running it through
Process::FixDataAddress will be a no-op on other targets.

This was originally a downstream change that I hadn't upstreamed yet,
and it was surfaced by Greg's changes in
https://github.com/llvm/llvm-project/pull/67599
so I needed to update the local patch, and was reminded that I should
upstream this.

Added: 
    

Modified: 
    
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 17c8b43578691c0..6c763ea1558feb1 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -235,14 +235,17 @@ llvm::Expected<LanguageRuntime::VTableInfo>
                                    "failed to get the address of the value");
 
   Status error;
-  const lldb::addr_t vtable_load_addr =
+  lldb::addr_t vtable_load_addr =
       process->ReadPointerFromMemory(original_ptr, error);
 
   if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS)
     return llvm::createStringError(std::errc::invalid_argument,
         "failed to read vtable pointer from memory at 0x%" PRIx64,
         original_ptr);
-;
+
+  // The vtable load address can have authentication bits with
+  // AArch64 targets on Darwin.
+  vtable_load_addr = process->FixDataAddress(vtable_load_addr);
 
   // Find the symbol that contains the "vtable_load_addr" address
   Address vtable_addr;


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to