public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Align signal stack pointer after allocating stackframe
@ 2023-05-16 14:09 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-05-16 14:09 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ce96593c882b393461084048533120e9c1e9d328

commit ce96593c882b393461084048533120e9c1e9d328
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon May 15 11:33:21 2023 +0300

    hurd: Align signal stack pointer after allocating stackframe
    
    sizeof (*stackframe) appears to be divisible by 16, but we should not
    rely on that. So make sure to leave enough space for the stackframe
    first, and then align the final pointer at 16 bytes.
    
    Checked on x86_64-gnu.
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
    Message-Id: <20230515083323.1358039-3-bugaevc@gmail.com>

Diff:
---
 sysdeps/mach/hurd/x86/trampoline.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c
index 19bddad8e1..1f92064ebf 100644
--- a/sysdeps/mach/hurd/x86/trampoline.c
+++ b/sysdeps/mach/hurd/x86/trampoline.c
@@ -196,15 +196,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
 #endif
     }
 
+  /* Push the arguments to call `trampoline' on the stack.  */
+  sigsp -= sizeof (*stackframe);
 #ifdef __x86_64__
   /* Align SP at 16 bytes.  Coupled with the fact that sigreturn_addr is
      16-byte aligned within the stackframe struct, this ensures that it ends
      up on a 16-byte aligned address, as required by the ABI.  */
   sigsp = (void *) ((uintptr_t) sigsp & ~15UL);
 #endif
-
-  /* Push the arguments to call `trampoline' on the stack.  */
-  sigsp -= sizeof (*stackframe);
   stackframe = sigsp;
 
   if (_hurdsig_catch_memory_fault (stackframe))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-16 14:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 14:09 [glibc] hurd: Align signal stack pointer after allocating stackframe Samuel Thibault

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).