[Lldb-commits] [lldb] Strip authentication bits from vtable load address (PR #71128)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 2 17:29:22 PDT 2023
https://github.com/jasonmolenda created https://github.com/llvm/llvm-project/pull/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.
>From 74968343a336eee081f8e5dc381d749b863cfe76 Mon Sep 17 00:00:00 2001
From: Jason Molenda <jmolenda at apple.com>
Date: Thu, 2 Nov 2023 17:15:51 -0700
Subject: [PATCH] Strip authentication bits from vtable load address
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.
---
.../CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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;
More information about the lldb-commits
mailing list