Prechádzať zdrojové kódy

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>
Max Filippov 2 rokov pred
rodič
commit
e260620eb4
1 zmenil súbory, kde vykonal 2 pridanie a 0 odobranie
  1. 2 0
      ldso/ldso/xtensa/dl-startup.h

+ 2 - 0
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