Skip to content

[lldb] Fix size of write when querying ptr auth mask #7301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool LLDBMemoryReader::queryDataLayout(DataLayoutQueryType type, void *inBuffer,
// disk. Setting the bit in the mask ensures it isn't accidentally cleared
// by ptrauth stripping.
mask_pattern |= LLDB_FILE_ADDRESS_BIT;
memcpy(outBuffer, &mask_pattern, sizeof(uint64_t));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long-term question: Could we change the API vended by the Swift runtime here to at least include a size parameter or is this stable API?

memcpy(outBuffer, &mask_pattern, m_process.GetAddressByteSize());
return true;
}
case DLQ_GetObjCReservedLowBits: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,13 @@ void SwiftLanguageRuntimeImpl::SetupReflection() {
objc_interop ? "with Objective-C interopability" : "Swift only";

auto &triple = exe_module->GetArchitecture().GetTriple();
if (triple.isArch64Bit()) {
auto byte_size = m_process.GetAddressByteSize();
if (byte_size == 8) {
LLDB_LOGF(log, "Initializing a 64-bit reflection context (%s) for \"%s\"",
triple.str().c_str(), objc_interop_msg);
m_reflection_ctx = ReflectionContextInterface::CreateReflectionContext64(
this->GetMemoryReader(), objc_interop, GetSwiftMetadataCache());
} else if (triple.isArch32Bit()) {
} else if (byte_size == 4) {
LLDB_LOGF(log,
"Initializing a 32-bit reflection context (%s) for \"%s\"",
triple.str().c_str(), objc_interop_msg);
Expand Down