summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2022-09-15 12:30:52 -0700
committerWaldemar Brodkorb <wbx@openadk.org>2022-09-21 10:35:40 +0200
commite260620eb4c28d4243f62c1d5f7e66cc6e773b8c (patch)
treeba4097a5e9976e74e5a708e79004eba2ff9877e2
parentfc4d8e59e9d5595047b9bc89147ac4ff12a8b802 (diff)
xtensa: ldso: make GOT protection adjustment conditional
Xtensa PERFORM_BOOTSTRAP_GOT macro uses mprotect to make bits of GOT writable, but noMMU linux kernel returns ENOSYS to mprotect syscalls, and syscall wrapper tries to update errno with the error code. This happens well before the relocations are done and results in writes to unrelated locations, memory corruption or protection violations. Only define PERFORM_BOOTSTRAP_GOT when building xtensa configuration with MMU support. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r--ldso/ldso/xtensa/dl-startup.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
index 92877aa01..439bdbd7a 100644
--- a/ldso/ldso/xtensa/dl-startup.h
+++ b/ldso/ldso/xtensa/dl-startup.h
@@ -88,6 +88,7 @@ __asm__ (
/* Function calls are not safe until the GOT relocations have been done. */
#define NO_FUNCS_BEFORE_BOOTSTRAP
+#if defined(__ARCH_USE_MMU__)
#define PERFORM_BOOTSTRAP_GOT(tpnt) \
do { \
xtensa_got_location *got_loc; \
@@ -124,3 +125,4 @@ do { \
PROT_READ | PROT_WRITE | PROT_EXEC); \
} \
} while (0)
+#endif