Skip to content

Commit 2631202

Browse files
Merge pull request #7301 from augusto2112/size-ptr-auth-mask-5.9
[lldb] Fix size of write when querying ptr auth mask
2 parents 5cbd9b7 + b119f5e commit 2631202

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/LLDBMemoryReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bool LLDBMemoryReader::queryDataLayout(DataLayoutQueryType type, void *inBuffer,
2929
// disk. Setting the bit in the mask ensures it isn't accidentally cleared
3030
// by ptrauth stripping.
3131
mask_pattern |= LLDB_FILE_ADDRESS_BIT;
32-
memcpy(outBuffer, &mask_pattern, sizeof(uint64_t));
32+
memcpy(outBuffer, &mask_pattern, m_process.GetAddressByteSize());
3333
return true;
3434
}
3535
case DLQ_GetObjCReservedLowBits: {

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,13 @@ void SwiftLanguageRuntimeImpl::SetupReflection() {
519519
objc_interop ? "with Objective-C interopability" : "Swift only";
520520

521521
auto &triple = exe_module->GetArchitecture().GetTriple();
522-
if (triple.isArch64Bit()) {
522+
auto byte_size = m_process.GetAddressByteSize();
523+
if (byte_size == 8) {
523524
LLDB_LOGF(log, "Initializing a 64-bit reflection context (%s) for \"%s\"",
524525
triple.str().c_str(), objc_interop_msg);
525526
m_reflection_ctx = ReflectionContextInterface::CreateReflectionContext64(
526527
this->GetMemoryReader(), objc_interop, GetSwiftMetadataCache());
527-
} else if (triple.isArch32Bit()) {
528+
} else if (byte_size == 4) {
528529
LLDB_LOGF(log,
529530
"Initializing a 32-bit reflection context (%s) for \"%s\"",
530531
triple.str().c_str(), objc_interop_msg);

0 commit comments

Comments
 (0)