From: Tom Hughes Date: Sun, 16 Dec 2012 09:52:38 +0000 (+0000) Subject: Make sure the stack pointer is properly aligned when invoking a X-Git-Tag: svn/VALGRIND_3_9_0~491 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c791a86cb8a50037b3aca0cd7a251f2bd2bb8b0;p=thirdparty%2Fvalgrind.git Make sure the stack pointer is properly aligned when invoking a 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 --- diff --git a/coregrind/m_sigframe/sigframe-amd64-linux.c b/coregrind/m_sigframe/sigframe-amd64-linux.c index 60f70b36f3..651ea11675 100644 --- a/coregrind/m_sigframe/sigframe-amd64-linux.c +++ b/coregrind/m_sigframe/sigframe-amd64-linux.c @@ -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)))