summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2018-07-04 17:55:15 +0200
committerWaldemar Brodkorb <wbrodkorb@conet.de>2018-08-10 16:01:21 +0200
commit57436cad9cc452eeeeafe007705daa9752835b14 (patch)
tree2a0f9ea119453a6c64f5f085d96dfdb41cd6de82
parent685a704f0265ef4e35300310c8f3d03f9fea3fbe (diff)
rtld: Do not protect RELRO segments when we don't use an MMU.
Without MMU, we cannot mark memory regions as read-only. * ldso/ldso/dl-elf.c (_dl_protect_relro): Do nothing if __ARCH_USE_MMU__ is defined. Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
-rw-r--r--ldso/ldso/dl-elf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index d264e6a49..1768b5bb8 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -117,6 +117,7 @@ int _dl_unmap_cache(void)
void
_dl_protect_relro (struct elf_resolve *l)
{
+#ifdef __ARCH_USE_MMU__
ElfW(Addr) base = (ElfW(Addr)) DL_RELOC_ADDR(l->loadaddr, l->relro_addr);
ElfW(Addr) start = (base & PAGE_ALIGN);
ElfW(Addr) end = ((base + l->relro_size) & PAGE_ALIGN);
@@ -126,6 +127,7 @@ _dl_protect_relro (struct elf_resolve *l)
_dl_dprintf(2, "%s: cannot apply additional memory protection after relocation", l->libname);
_dl_exit(0);
}
+#endif
}
/* This function's behavior must exactly match that