This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26-360-g6cd380d


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  6cd380dd366d728da9f579eeb9f7f4c47f48e474 (commit)
      from  1c6d89e9a40302430d5986a09c7cf7594b93143c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6cd380dd366d728da9f579eeb9f7f4c47f48e474

commit 6cd380dd366d728da9f579eeb9f7f4c47f48e474
Author: Wang Boshi <wangboshi@huawei.com>
Date:   Fri Sep 15 17:53:23 2017 +0100

    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.

diff --git a/ChangeLog b/ChangeLog
index 48a8b67..1d60d12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-18  Wang Boshi  <wangboshi@huawei.com>  (tiny change)
+
+	* sysdeps/aarch64/start.S: Use MOVL instead of literal pools.
+	* sysdeps/aarch64/sysdep.h (MOVL): Add MOVL macro.
+
 2017-09-17  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
 	* io/read.c (read): Add libc_hidden_weak.
diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index df1c642..c20433a 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,
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index a749a70..aba18de 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -137,6 +137,20 @@
 	ldr	PTR_REG (T), [x##T, #:got_lo12:EXPR];	\
 	OP	PTR_REG (R), [x##T];
 
+/* Load an immediate into R.
+   Note R is a register number and not a register name.  */
+#ifdef __LP64__
+# define MOVL(R, NAME)					\
+	movz	PTR_REG (R), #:abs_g3:NAME;		\
+	movk	PTR_REG (R), #:abs_g2_nc:NAME;		\
+	movk	PTR_REG (R), #:abs_g1_nc:NAME;		\
+	movk	PTR_REG (R), #:abs_g0_nc:NAME;
+#else
+# define MOVL(R, NAME)					\
+	movz	PTR_REG (R), #:abs_g1:NAME;		\
+	movk	PTR_REG (R), #:abs_g0_nc:NAME;
+#endif
+
 /* Since C identifiers are not normally prefixed with an underscore
    on this system, the asm identifier `syscall_error' intrudes on the
    C name space.  Make sure we use an innocuous name.  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    5 +++++
 sysdeps/aarch64/start.S  |    6 +++---
 sysdeps/aarch64/sysdep.h |   14 ++++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]