From c54e068fd52cce4394dcfae6e9bc5ac852f4970a Mon Sep 17 00:00:00 2001 From: Edmund Grimley Evans Date: Tue, 18 Oct 2016 15:37:45 +0100 Subject: [PATCH] i#1569 AArch64: Make dynamorio_syscall only read the 7th arg when used. Fixes breakage in release-build AArch64 from d193665e exposing dynamorio_syscall's deref of more args than were passed to it. (Currently it seems that no Linux arm64 syscall has more than 6 arguments but several other Linux architectures do.) Review-URL: https://codereview.appspot.com/308700043 --- core/arch/aarch64/aarch64_shared.asm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/arch/aarch64/aarch64_shared.asm b/core/arch/aarch64/aarch64_shared.asm index 4a6f55e702e..6fad02a45e1 100644 --- a/core/arch/aarch64/aarch64_shared.asm +++ b/core/arch/aarch64/aarch64_shared.asm @@ -46,6 +46,7 @@ START_FILE */ DECLARE_FUNC(dynamorio_syscall) GLOBAL_LABEL(dynamorio_syscall:) + cmp w1, #7 mov x8,x0 mov x0,x2 mov x1,x3 @@ -53,7 +54,12 @@ GLOBAL_LABEL(dynamorio_syscall:) mov x3,x5 mov x4,x6 mov x5,x7 + /* We set up first 6 args unconditionally, but read 7th arg from stack + * only if there are at least 7 args. + */ + b.cc 1f ldr x6,[sp] +1: svc #0 ret