This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[2.23, PATCH] BZ #18661: Align stack to 16 bytes when calling __setcontext
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 4 Aug 2015 09:49:50 -0700
- Subject: [2.23, PATCH] BZ #18661: Align stack to 16 bytes when calling __setcontext
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Don't use pop to restore %rdi so that stack is aligned to 16 bytes
when calling __setcontext.
I am planning to check it in after 2.22 is branched.
H.J.
--
[BZ #18661]
* sysdeps/unix/sysv/linux/x86_64/__start_context.S
(__start_context): Don't use pop to restore %rdi so that stack
is aligned to 16 bytes when calling __setcontext.
---
sysdeps/unix/sysv/linux/x86_64/__start_context.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/x86_64/__start_context.S b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
index 52a5afa..96366e0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/__start_context.S
+++ b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
@@ -31,8 +31,8 @@ ENTRY(__start_context)
on the stack pointer for the next context. */
movq %rbx, %rsp
- popq %rdi /* This is the next context. */
- cfi_adjust_cfa_offset(-8)
+ /* Don't use pop here so that stack is aligned to 16 bytes. */
+ movq (%rsp), %rdi /* This is the next context. */
testq %rdi, %rdi
je 2f /* If it is zero exit. */
--
2.4.3