* [PATCH] Maintain stack alignment in ____longjmp_chk on x86_64
@ 2011-04-07 12:30 Andreas Schwab
2011-04-07 13:29 ` Ulrich Drepper
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2011-04-07 12:30 UTC (permalink / raw)
To: libc-hacker
2011-04-07 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (CALL_FAIL):
Maintain aligned stack.
(CHECK_RSP): Remove unused macro.
---
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 da35115..3881082 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). */
--
1.7.4.2
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Maintain stack alignment in ____longjmp_chk on x86_64
2011-04-07 12:30 [PATCH] Maintain stack alignment in ____longjmp_chk on x86_64 Andreas Schwab
@ 2011-04-07 13:29 ` Ulrich Drepper
2011-04-07 13:39 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Drepper @ 2011-04-07 13:29 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-hacker
On Thu, Apr 7, 2011 at 08:29, Andreas Schwab <schwab@redhat.com> wrote:
> + call __GI___fortify_fail; \
> + nop; \
Why would we need the nop after the call? This isn't SPARC...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Maintain stack alignment in ____longjmp_chk on x86_64
2011-04-07 13:29 ` Ulrich Drepper
@ 2011-04-07 13:39 ` Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2011-04-07 13:39 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: libc-hacker
Ulrich Drepper <drepper@gmail.com> writes:
> On Thu, Apr 7, 2011 at 08:29, Andreas Schwab <schwab@redhat.com> wrote:
>> + call __GI___fortify_fail; \
>> + nop; \
>
> Why would we need the nop after the call?
For correct unwind information.
Andreas.
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-07 13:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-07 12:30 [PATCH] Maintain stack alignment in ____longjmp_chk on x86_64 Andreas Schwab
2011-04-07 13:29 ` Ulrich Drepper
2011-04-07 13:39 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).