From patchwork Tue Aug 4 16:49:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 8003 Received: (qmail 108967 invoked by alias); 4 Aug 2015 16:49:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 108954 invoked by uid 89); 4 Aug 2015 16:49:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga11.intel.com X-ExtLoop1: 1 Date: Tue, 4 Aug 2015 09:49:50 -0700 From: "H.J. Lu" To: GNU C Library Subject: [2.23, PATCH] BZ #18661: Align stack to 16 bytes when calling __setcontext Message-ID: <20150804164950.GA1621@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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. */