]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make sure the stack pointer is properly aligned when invoking a
authorTom Hughes <tom@compton.nu>
Sun, 16 Dec 2012 09:52:38 +0000 (09:52 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 16 Dec 2012 09:52:38 +0000 (09:52 +0000)
signal on amd64-linux systems.

The amd64 ABI describes the required alignment on function entry
as follows:

  "In other words, the value (%rsp − 8) is always a multiple
   of 16 when control is transferred to the function entry point.

So we need to 16 byte align and then subtract an extra 8 bytes
to achieve the correct alignment.

Patch from fjgmacc@gmail.com to fix BZ#280114.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13182

coregrind/m_sigframe/sigframe-amd64-linux.c

index 60f70b36f3cbec6c7ae6e197f7eded3d59bcc25e..651ea116756f0b0a4d2f011a8bb2f3a4e1703db7 100644 (file)
@@ -452,7 +452,7 @@ static Addr build_rt_sigframe(ThreadState *tst,
    UWord err;
 
    rsp -= sizeof(*frame);
-   rsp = VG_ROUNDDN(rsp, 16);
+   rsp = VG_ROUNDDN(rsp, 16) - 8;
    frame = (struct rt_sigframe *)rsp;
 
    if (!extend(tst, rsp, sizeof(*frame)))