summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorEvgenii Stepanov <eugenis@google.com>2020-12-15 13:55:32 -0800
committerEvgenii Stepanov <eugenis@google.com>2021-01-06 16:08:18 -0800
commit8564b8d9e61580bef3bd5018cf63e37c78e40053 (patch)
tree31105008dfcd942690f7143595121c2ab5d2bde8 /linker/linker_main.cpp
parentdec48bdd9ee090f3b0e3ff22dcac4689a146e8d0 (diff)
Use ELF notes to set the desired memory tagging level.
Use a note in executables to specify (none|sync|async) heap tagging level. To be extended with (heap x stack x globals) in the future. A missing note disables all tagging. Bug: b/135772972 Test: bionic-unit-tests (in a future change) Change-Id: Iab145a922c7abe24cdce17323f9e0c1063cc1321
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index aad8f6f6f..59e803665 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -66,6 +66,8 @@ static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_cou
static void set_bss_vma_name(soinfo* si);
+void __libc_init_mte(const void* phdr_start, size_t phdr_count, uintptr_t load_bias);
+
// These should be preserved static to avoid emitting
// RELATIVE relocations for the part of the code running
// before linker links itself.
@@ -403,6 +405,8 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
strerror(errno));
}
}
+
+ __libc_init_mte(somain->phdr, somain->phnum, somain->load_bias);
#endif
// Register the main executable and the linker upfront to have