Skip to content
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

Do not patch PLT stubs for MallocStackLogging in MacOS #477

Merged
merged 1 commit into from
Oct 5, 2023
Merged
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
9 changes: 9 additions & 0 deletions src/memray/_memray/macho_shenanigans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,15 @@ patch_symbols_in_shared_object(
<< section->sectname << ")";
continue;
}
// MacOS has some memory interposition libraries that can make us crash (via
// stackoverflow when initializing TLS variables) if we patch them. This is because these
// libraries interact in a way we cannot avoid with libdyld, which in turn sets the TLS
// on first init.
if (strstr(image_name, "MallocStackLogging")) {
LOG(DEBUG) << "Skipping section " << i << " (" << section->segname << ":"
<< section->sectname << ")";
continue;
}
LOG(DEBUG) << "Patching section " << i << " (" << section->segname << ":"
<< section->sectname << ")";
patch_stubs(section, slide, dyninfo_table, restore_original);
Expand Down
Loading