From 7dae9d646009b0ef49ef088733b8637094e15ff9 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Thu, 29 Nov 2018 23:00:53 -0800 Subject: [PATCH] [LibOS/glibc] Don't ignore redzone in syscall-template.S For trivial system call, sysdeps/unix/syscall-template.S is used to generate system call stub functions, which ignores redzone. This commit fixes the issue. Also use %rcx instead of %rbx without pushq/popq as %rcx is clobbered in system call ABI. Signed-off-by: Isaku Yamahata --- LibOS/glibc-2.19/syscalldb.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/LibOS/glibc-2.19/syscalldb.h b/LibOS/glibc-2.19/syscalldb.h index 14daf8e4..7d6d4a92 100644 --- a/LibOS/glibc-2.19/syscalldb.h +++ b/LibOS/glibc-2.19/syscalldb.h @@ -5,12 +5,17 @@ .weak syscalldb .type syscalldb, @function -# define SYSCALLDB \ - pushq %rbx; \ - movq syscalldb@GOTPCREL(%rip), %rbx; \ - call *%rbx; \ - popq %rbx; - +# if defined(PSEUDO) && defined(SYSCALL_NAME) && defined(SYSCALL_SYMBOL) +# define SYSCALLDB \ + subq $128, %rsp; \ + movq syscalldb@GOTPCREL(%rip), %rcx; \ + call *%rcx; \ + addq $128, %rsp +# else +# define SYSCALLDB \ + movq syscalldb@GOTPCREL(%rip), %rcx; \ + call *%rcx +# endif #else /* !__ASSEMBLER__ */ asm (