about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-12 14:38:58 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-01 13:05:22 -0700
commitfa1f4698c17560f8e2bdaa9b89dafc780b00e3b9 (patch)
tree7031f336ebe5b798d835acd7004c688c286f9a69
parent2504551c12a50fcbe8ce50924ef4df2685ff72b2 (diff)
downloadglibc-fa1f4698c17560f8e2bdaa9b89dafc780b00e3b9.tar.gz
glibc-fa1f4698c17560f8e2bdaa9b89dafc780b00e3b9.tar.xz
glibc-fa1f4698c17560f8e2bdaa9b89dafc780b00e3b9.zip
Align stack to 16 bytes when calling __setcontext
Don't use pop to restore %rdi so that stack is aligned to 16 bytes
when calling __setcontext.

	[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.
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/__start_context.S4
1 files 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 52a5afa9a6..96366e0536 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.  */