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-05 08:36:12 -0700
commit8e1f346462d8c1b238a7c6bb501c45b381a45e4d (patch)
tree9bb295abee3821601b7f076aec181c3f29ad570f
parent3b8d2eb7f8435c73692f55f95e9a0ef27015b6c3 (diff)
downloadglibc-8e1f346462d8c1b238a7c6bb501c45b381a45e4d.tar.gz
glibc-8e1f346462d8c1b238a7c6bb501c45b381a45e4d.tar.xz
glibc-8e1f346462d8c1b238a7c6bb501c45b381a45e4d.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--ChangeLog7
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/__start_context.S4
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cec13dc871..8a47768e03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-08-05  H.J. Lu  <hongjiu.lu@intel.com>
 
+	[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.
+
+2015-08-05  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: Compile
 	only for libc.
 	* sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: Likewise.
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.  */