Reland "[MTE] remap stacks with PROT_MTE when requested by dlopened library"
This reverts commit c20e1c2bdfc00b3fb7931da5e88ceac3fa4df4b2.
Reason for revert: Was not the root-cause of test failure.
Change-Id: I7dcd9fc3cbac47703fa8ecd5aafd7e1c3ed87301
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 135eaa3..ffbf136 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2212,6 +2212,14 @@
loading_trace.End();
if (si != nullptr) {
+ if (si->has_min_version(7) && si->memtag_stack()) {
+ LD_LOG(kLogDlopen, "... dlopen enabling MTE for: realpath=\"%s\", soname=\"%s\"",
+ si->get_realpath(), si->get_soname());
+ if (auto* cb = __libc_shared_globals()->memtag_stack_dlopen_callback) {
+ cb();
+ }
+ }
+
void* handle = si->to_handle();
LD_LOG(kLogDlopen,
"... dlopen calling constructors: realpath=\"%s\", soname=\"%s\", handle=%p",