From: Yury Norov <ynorov@caviumnetworks.com>
To: <libc-alpha@sourceware.org>, <linux-kernel@vger.kernel.org>
Cc: <arnd@arndb.de>, <catalin.marinas@arm.com>,
<marcus.shawcroft@arm.com>, <philb@gnu.org>,
<davem@davemloft.net>, <szabolcs.nagy@arm.com>,
<maxim.kuvyrkov@linaro.org>, <joseph@codesourcery.com>,
<pinskia@gmail.com>, Yury Norov <ynorov@caviumnetworks.com>
Subject: [PATCH 23/27] [AARCH64] delouse input arguments in system functions
Date: Tue, 21 Jun 2016 08:07:07 +0300 [thread overview]
Message-ID: <1466485631-3532-25-git-send-email-ynorov@caviumnetworks.com> (raw)
In-Reply-To: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com>
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
sysdeps/aarch64/__longjmp.S | 2 ++
sysdeps/aarch64/dl-tlsdesc.S | 6 ++++++
sysdeps/aarch64/memcmp.S | 3 +++
sysdeps/aarch64/memcpy.S | 4 +++-
sysdeps/aarch64/memmove.S | 3 +++
sysdeps/aarch64/memset.S | 3 ++-
sysdeps/aarch64/setjmp.S | 1 +
sysdeps/aarch64/strchr.S | 1 +
sysdeps/aarch64/strchrnul.S | 1 +
sysdeps/aarch64/strcmp.S | 2 ++
sysdeps/aarch64/strcpy.S | 2 ++
sysdeps/aarch64/strlen.S | 2 ++
sysdeps/aarch64/strncmp.S | 3 +++
sysdeps/aarch64/strnlen.S | 3 +++
sysdeps/aarch64/strrchr.S | 1 +
sysdeps/aarch64/sysdep.h | 4 +++-
sysdeps/unix/sysv/linux/aarch64/clone.S | 7 +++++++
sysdeps/unix/sysv/linux/aarch64/getcontext.S | 1 +
sysdeps/unix/sysv/linux/aarch64/setcontext.S | 1 +
sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 1 +
20 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 58332be..0377715 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -46,6 +46,8 @@ ENTRY (__longjmp)
cfi_offset(d14, JB_D14<<3)
cfi_offset(d15, JB_D15<<3)
+ DELOUSE(0)
+
ldp x19, x20, [x0, #JB_X19<<3]
ldp x21, x22, [x0, #JB_X21<<3]
ldp x23, x24, [x0, #JB_X23<<3]
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index fe8a17d..718dddf 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,6 +74,7 @@
cfi_startproc
.align 2
_dl_tlsdesc_return:
+ DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
@@ -126,6 +127,7 @@ _dl_tlsdesc_undefweak:
td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
from [x0,#8] here happens after the initialization of td->arg. */
ldar xzr, [x0]
+ DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
@@ -174,6 +176,7 @@ _dl_tlsdesc_dynamic:
stp x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
+ DELOUSE(0)
/* Save just enough registers to support fast path, if we fall
into slow path we will save additional registers. */
@@ -279,12 +282,14 @@ _dl_tlsdesc_resolve_rela:
SAVE_Q_REGISTERS
+ DELOUSE(3)
ldr PTR_REG (1), [x3, #PTR_SIZE]
bl _dl_tlsdesc_resolve_rela_fixup
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*8]
+ DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
@@ -346,6 +351,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
ldr x0, [sp, #32+16*9]
+ DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index ae2d997..982aa02 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -47,6 +47,9 @@
#define mask x13
ENTRY_ALIGN (memcmp, 6)
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
cbz limit, L(ret0)
eor tmp1, src1, src2
tst tmp1, #7
diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
index 442f390..e0bbbf8 100644
--- a/sysdeps/aarch64/memcpy.S
+++ b/sysdeps/aarch64/memcpy.S
@@ -46,7 +46,9 @@
#include <sysdep.h>
ENTRY_ALIGN (memcpy, 6)
-
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
mov dst, dstin
cmp count, #64
b.ge L(cpy_not_short)
diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.S
index dd91db0..3f72dea 100644
--- a/sysdeps/aarch64/memmove.S
+++ b/sysdeps/aarch64/memmove.S
@@ -46,6 +46,9 @@
#define D_h x14
ENTRY_ALIGN (memmove, 6)
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
cmp dstin, src
b.lo L(downwards)
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
index e49f4d6..e8eed9e 100644
--- a/sysdeps/aarch64/memset.S
+++ b/sysdeps/aarch64/memset.S
@@ -52,7 +52,8 @@
#define tmp3w w9
ENTRY_ALIGN (__memset, 6)
-
+ DELOUSE(0)
+ DELOUSE(2)
mov dst, dstin /* Preserve return value. */
ands A_lw, val, #255
#ifndef DONT_USE_DC
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index da83f19..d608660 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -33,6 +33,7 @@ END (_setjmp)
libc_hidden_def (_setjmp)
ENTRY (__sigsetjmp)
+ DELOUSE(0)
1:
stp x19, x20, [x0, #JB_X19<<3]
diff --git a/sysdeps/aarch64/strchr.S b/sysdeps/aarch64/strchr.S
index 5e3aecf..838384c 100644
--- a/sysdeps/aarch64/strchr.S
+++ b/sysdeps/aarch64/strchr.S
@@ -62,6 +62,7 @@
/* Locals and temporaries. */
ENTRY (strchr)
+ DELOUSE(0)
mov wtmp2, #0x0401
movk wtmp2, #0x4010, lsl #16
dup vrepchr.16b, chrin
diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S
index a624c8d..b60df26 100644
--- a/sysdeps/aarch64/strchrnul.S
+++ b/sysdeps/aarch64/strchrnul.S
@@ -60,6 +60,7 @@
identify exactly which byte is causing the termination. */
ENTRY (__strchrnul)
+ DELOUSE(0)
/* Magic constant 0x40100401 to allow us to identify which lane
matches the termination condition. */
mov wtmp2, #0x0401
diff --git a/sysdeps/aarch64/strcmp.S b/sysdeps/aarch64/strcmp.S
index ba0ccb4..ccfe281 100644
--- a/sysdeps/aarch64/strcmp.S
+++ b/sysdeps/aarch64/strcmp.S
@@ -49,6 +49,8 @@
/* Start of performance-critical section -- one 64B cache line. */
ENTRY_ALIGN(strcmp, 6)
+ DELOUSE(0)
+ DELOUSE(1)
eor tmp1, src1, src2
mov zeroones, #REP8_01
tst tmp1, #7
diff --git a/sysdeps/aarch64/strcpy.S b/sysdeps/aarch64/strcpy.S
index 0694199..2a281b9 100644
--- a/sysdeps/aarch64/strcpy.S
+++ b/sysdeps/aarch64/strcpy.S
@@ -91,6 +91,8 @@
#define MIN_PAGE_SIZE (1 << MIN_PAGE_P2)
ENTRY_ALIGN (STRCPY, 6)
+ DELOUSE(0)
+ DELOUSE(1)
/* For moderately short strings, the fastest way to do the copy is to
calculate the length of the string in the same way as strlen, then
essentially do a memcpy of the result. This avoids the need for
diff --git a/sysdeps/aarch64/strlen.S b/sysdeps/aarch64/strlen.S
index 9b4d1da..4734cfb 100644
--- a/sysdeps/aarch64/strlen.S
+++ b/sysdeps/aarch64/strlen.S
@@ -85,6 +85,8 @@
boundary. */
ENTRY_ALIGN (strlen, 6)
+ DELOUSE(0)
+ DELOUSE(1)
and tmp1, srcin, MIN_PAGE_SIZE - 1
mov zeroones, REP8_01
cmp tmp1, MIN_PAGE_SIZE - 16
diff --git a/sysdeps/aarch64/strncmp.S b/sysdeps/aarch64/strncmp.S
index f6a17fd..a372654 100644
--- a/sysdeps/aarch64/strncmp.S
+++ b/sysdeps/aarch64/strncmp.S
@@ -51,6 +51,9 @@
#define endloop x15
ENTRY_ALIGN_AND_PAD (strncmp, 6, 7)
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
cbz limit, L(ret0)
eor tmp1, src1, src2
mov zeroones, #REP8_01
diff --git a/sysdeps/aarch64/strnlen.S b/sysdeps/aarch64/strnlen.S
index 4cce45f..6f67221 100644
--- a/sysdeps/aarch64/strnlen.S
+++ b/sysdeps/aarch64/strnlen.S
@@ -50,6 +50,9 @@
#define REP8_80 0x8080808080808080
ENTRY_ALIGN_AND_PAD (__strnlen, 6, 9)
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
cbz limit, L(hit_limit)
mov zeroones, #REP8_01
bic src, srcin, #15
diff --git a/sysdeps/aarch64/strrchr.S b/sysdeps/aarch64/strrchr.S
index 44c1917..bb85a60 100644
--- a/sysdeps/aarch64/strrchr.S
+++ b/sysdeps/aarch64/strrchr.S
@@ -68,6 +68,7 @@
identify exactly which byte is causing the termination, and why. */
ENTRY(strrchr)
+ DELOUSE(0)
cbz x1, L(null_search)
/* Magic constant 0x40100401 to allow us to identify which lane
matches the requested byte. Magic constant 0x80200802 used
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index f2ea821..c4ff5e7 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -25,10 +25,12 @@
#define AARCH64_R(NAME) R_AARCH64_ ## NAME
#define PTR_REG(n) x##n
#define PTR_LOG_SIZE 3
-#else
+#define DELOUSE(n)
+#else /* __ILP32__ */
#define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
#define PTR_REG(n) w##n
#define PTR_LOG_SIZE 2
+#define DELOUSE(n) mov w##n, w##n
#endif
#define PTR_SIZE (1<<PTR_LOG_SIZE)
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index 596fb9c..91a1d4c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -39,6 +39,13 @@
*/
.text
ENTRY(__clone)
+ DELOUSE(0)
+ DELOUSE(1)
+ DELOUSE(2)
+ DELOUSE(3)
+ DELOUSE(4)
+ DELOUSE(5)
+ DELOUSE(6)
/* Save args for the child. */
mov x10, x0
mov x11, x2
diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index 71e526c..35ff326 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -30,6 +30,7 @@
.text
ENTRY(__getcontext)
+ DELOUSE(0)
/* The saved context will return to the getcontext() call point
with a return value of 0 */
str xzr, [x0, oX0 + 0 * SZREG]
diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
index d17f8c8..7d854bd 100644
--- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -34,6 +34,7 @@
.text
ENTRY (__setcontext)
+ DELOUSE(0)
/* Save a copy of UCP. */
mov x9, x0
diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
index c1a16f3..764fedc 100644
--- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S
@@ -27,6 +27,7 @@
.text
ENTRY(__swapcontext)
+ DELOUSE(0)
/* Set the value returned when swapcontext() returns in this context. */
str xzr, [x0, oX0 + 0 * SZREG]
--
2.7.4
next prev parent reply other threads:[~2016-06-21 5:47 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 5:06 [RFC PATCH 00/27] ARM64: support ILP32 Yury Norov
2016-06-21 5:06 ` [PATCH 01/27] [AARCH64] Fix utmp struct for compatibility reasons Yury Norov
2016-06-21 10:14 ` Szabolcs Nagy
2016-06-23 4:35 ` Yury Norov
2016-06-23 5:07 ` Andrew Pinski
2016-06-23 7:32 ` Andreas Schwab
2016-06-23 7:36 ` Yury Norov
2016-06-23 7:37 ` Andrew Pinski
2016-06-24 11:33 ` Florian Weimer
2016-06-23 7:36 ` Andrew Pinski
2016-06-23 7:56 ` Andreas Schwab
2016-06-24 11:38 ` Florian Weimer
2016-06-25 23:26 ` Andrew Pinski
2016-06-26 6:13 ` Yury Norov
2016-06-21 10:24 ` Joseph Myers
2016-06-21 5:06 ` [PATCH] no wrappers Yury Norov
2016-06-21 6:04 ` Yury Norov
2016-06-21 5:06 ` [PATCH 02/27] [AARCH64] Add header guards to sysdep.h headers Yury Norov
2016-06-21 10:23 ` Szabolcs Nagy
2016-06-21 5:06 ` [PATCH 03/27] Add dynamic ILP32 AARCH64 relocations to elf.h Yury Norov
2016-06-21 10:26 ` Joseph Myers
2016-06-21 5:06 ` [PATCH 04/27] [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in LDST_PCREL and LDST_GLOBAL Yury Norov
2016-06-21 7:54 ` Andreas Schwab
2016-06-21 8:36 ` Yury Norov
2016-06-21 9:13 ` Andreas Schwab
2016-06-21 5:06 ` [PATCH 05/27] [AARCH64] Use PTR_REG in crti.S Yury Norov
2016-06-21 10:28 ` Joseph Myers
2016-06-22 6:02 ` Yury Norov
2016-06-22 7:45 ` Andreas Schwab
2016-06-22 10:37 ` Joseph Myers
2016-06-21 5:06 ` [PATCH 06/27] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S Yury Norov
2016-06-21 8:05 ` Andreas Schwab
2016-06-21 5:06 ` [PATCH 07/27] [AARCH64] Use PTR_* macros in dl-trampoline.S Yury Norov
2016-06-21 5:06 ` [PATCH 08/27] [AARCH64] Use PTR_* in start.S Yury Norov
2016-06-21 5:06 ` [PATCH 09/27] [AARCH64] Use PTR_REG in getcontext.S Yury Norov
2016-06-21 5:06 ` [PATCH 10/27] [AARCH64] Detect ILP32 in configure scripts Yury Norov
2016-06-21 8:01 ` Andreas Schwab
2016-06-21 10:30 ` Joseph Myers
2016-06-21 5:06 ` [PATCH 11/27] [AARCH64] Syscalls for ILP32 are passed always via 64bit values Yury Norov
2016-06-21 7:56 ` Andreas Schwab
2016-06-21 11:42 ` Zhangjian (Bamvor)
2016-06-21 11:54 ` Andreas Schwab
2016-06-21 11:57 ` Zhangjian (Bamvor)
2016-06-22 15:49 ` Catalin Marinas
2016-06-23 6:32 ` Yury Norov
2016-06-21 5:06 ` [PATCH 12/27] [AARCH64] Add ILP32 support to elf_machine_load_address Yury Norov
2016-06-21 5:06 ` [PATCH 13/27] [AARCH64] Set up wordsize for ILP32 Yury Norov
2016-06-21 5:06 ` [PATCH 14/27] [AARCH64] Add ILP32 to makefiles Yury Norov
2016-06-21 5:06 ` [PATCH 15/27] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Yury Norov
2016-06-21 7:59 ` Andreas Schwab
2016-06-21 5:07 ` [PATCH 16/27] [AARCH64] Add ILP32 ld.so to the known interpreter names Yury Norov
2016-06-21 5:07 ` [PATCH 17/27] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found Yury Norov
2016-06-21 5:07 ` [PATCH 18/27] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Yury Norov
2016-06-21 7:45 ` Andreas Schwab
2016-06-21 7:52 ` Zhangjian (Bamvor)
2016-06-21 5:07 ` [PATCH 19/27] [AARCH64] Add typesizes.h for ILP32 Yury Norov
2016-06-21 7:58 ` Andreas Schwab
2016-06-21 11:59 ` Zhangjian (Bamvor)
2016-06-23 4:54 ` Yury Norov
2016-06-21 5:07 ` [PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories Yury Norov
2016-06-21 8:12 ` Andreas Schwab
2016-06-21 10:44 ` Joseph Myers
2016-06-27 7:56 ` Andreas Schwab
2016-06-27 8:03 ` Arnd Bergmann
2016-06-21 5:07 ` [PATCH 21/27] [AARCH64] ILP32: introduce syscalls that pass off_t Yury Norov
2016-06-21 10:35 ` Joseph Myers
2016-06-23 5:57 ` Yury Norov
2016-06-23 11:57 ` Joseph Myers
2016-06-21 5:07 ` [PATCH 22/27] [AARCH64] ILP32: support stat syscall family Yury Norov
2016-06-21 8:38 ` Andreas Schwab
2016-06-21 10:46 ` Joseph Myers
2016-06-27 7:51 ` Andreas Schwab
2016-06-21 5:07 ` Yury Norov [this message]
2016-06-21 8:08 ` [PATCH 23/27] [AARCH64] delouse input arguments in system functions Andreas Schwab
2016-06-21 10:36 ` Joseph Myers
2016-06-21 15:42 ` Arnd Bergmann
2016-06-21 16:37 ` Andrew Pinski
2016-06-21 5:07 ` [PATCH 24/27] Add support for AT_ARM64_MIDR Yury Norov
2016-06-21 8:09 ` Andreas Schwab
2016-06-21 5:07 ` [PATCH 25/27] [AARCH64] Fix ILP32 warning Yury Norov
2016-06-21 10:44 ` Joseph Myers
2016-06-21 5:07 ` [PATCH 26/27] [AARCH64] Change type of __align to long long Yury Norov
2016-06-21 8:10 ` Andreas Schwab
2016-06-21 10:57 ` Zhangjian (Bamvor)
2016-07-06 10:36 ` Andreas Schwab
2016-06-21 5:07 ` [PATCH 27/27] Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32 Yury Norov
2016-06-21 10:32 ` Joseph Myers
2016-06-21 10:23 ` [RFC PATCH 00/27] ARM64: support ILP32 Joseph Myers
2016-06-21 12:06 ` Zhangjian (Bamvor)
2016-06-22 2:04 ` Yury Norov
2016-06-28 15:26 ` Yury Norov
2016-06-21 15:10 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466485631-3532-25-git-send-email-ynorov@caviumnetworks.com \
--to=ynorov@caviumnetworks.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcus.shawcroft@arm.com \
--cc=maxim.kuvyrkov@linaro.org \
--cc=philb@gnu.org \
--cc=pinskia@gmail.com \
--cc=szabolcs.nagy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).