diff options
author | Andreas Schwab <schwab@redhat.com> | 2011-04-07 16:23:52 -0400 |
---|---|---|
committer | Petr Baudis <pasky@suse.cz> | 2011-05-27 00:29:09 +0200 |
commit | 7d789b1b4d3531172f788d13a76cf7d5a429835e (patch) | |
tree | b93440a4902a1de76ba3bb79e0f116c2623fbde9 /sysdeps | |
parent | c81fb726d822c5c5296c21c9d47c323ce14aa723 (diff) | |
download | glibc-7d789b1b4d3531172f788d13a76cf7d5a429835e.tar.gz glibc-7d789b1b4d3531172f788d13a76cf7d5a429835e.tar.xz glibc-7d789b1b4d3531172f788d13a76cf7d5a429835e.zip |
Maintain stack alignment in ____longjmp_chk on x86_64
(cherry picked from commit e451d22b22c959a4dbf86dbc9f125985601473ab)
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S index da35115b9f..3881082cff 100644 --- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S +++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,2004,2005,2006,2009,2010 Free Software Foundation, Inc. +/* Copyright (C) 2001,2004,2005,2006,2009,2010,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,19 +30,23 @@ longjmp_msg: //#define __longjmp ____longjmp_chk #ifdef PIC -# define CALL_FAIL leaq longjmp_msg(%rip), %rdi; \ - call __GI___fortify_fail +# define CALL_FAIL subq $8, %rsp; \ + cfi_remember_state; \ + cfi_def_cfa_offset(16); \ + leaq longjmp_msg(%rip), %rdi; \ + call __GI___fortify_fail; \ + nop; \ + cfi_restore_state #else -# define CALL_FAIL movq $longjmp_msg, %rdi; \ - call __fortify_fail +# define CALL_FAIL subq $8, %rsp; \ + cfi_remember_state; \ + cfi_def_cfa_offset(16); \ + movq $longjmp_msg, %rdi; \ + call __fortify_fail; \ + nop; \ + cfi_restore_state #endif -#define CHECK_RSP(reg) \ - cmpq reg, %rsp; \ - jbe .Lok; \ - CALL_FAIL; \ -.Lok: - /* Jump to the position specified by ENV, causing the setjmp call there to return VAL, or 1 if VAL is 0. void __longjmp (__jmp_buf env, int val). */ |