about summary refs log tree commit diff
path: root/sysdeps/aarch64/start.S
diff options
context:
space:
mode:
authorWang Boshi <wangboshi@huawei.com>2017-09-15 17:53:23 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2017-09-18 18:15:47 +0100
commit6cd380dd366d728da9f579eeb9f7f4c47f48e474 (patch)
treea6c1ac8110060c1bc059697def0bc5b2cb9e66b7 /sysdeps/aarch64/start.S
parent1c6d89e9a40302430d5986a09c7cf7594b93143c (diff)
downloadglibc-6cd380dd366d728da9f579eeb9f7f4c47f48e474.tar.gz
glibc-6cd380dd366d728da9f579eeb9f7f4c47f48e474.tar.xz
glibc-6cd380dd366d728da9f579eeb9f7f4c47f48e474.zip
AArch64: use movz/movk instead of literal pools in start.S
eXecute-Only Memory (XOM) is a protection mechanism against some ROP
attacks. XOM sets the code as executable and unreadable, so the access
to any data, like literal pools, in the code section causes the fault
with XOM. The compiler can disable literal pools for C source files,
but not for assembly files, so I use movz/movk instead of literal pools
in start.S for XOM.

I add MOVL macro with movz/movk instructions like movl pseudo-instruction
in armasm, and use the macro instead of literal pools.

	* sysdeps/aarch64/start.S: Use MOVL instead of literal pools.
	* sysdeps/aarch64/sysdep.h (MOVL): Add MOVL macro.
Diffstat (limited to 'sysdeps/aarch64/start.S')
-rw-r--r--sysdeps/aarch64/start.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index df1c642c12..c20433ad73 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -71,9 +71,9 @@ _start:
 	ldr     PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
 #else
 	/* Set up the other arguments in registers */
-	ldr	PTR_REG (0), =main
-	ldr	PTR_REG (3), =__libc_csu_init
-	ldr	PTR_REG (4), =__libc_csu_fini
+	MOVL (0, main)
+	MOVL (3, __libc_csu_init)
+	MOVL (4, __libc_csu_fini)
 #endif
 
 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,