Bug 1024162 - valgrind causes crashes in signal handlers on x86_64
Summary: valgrind causes crashes in signal handlers on x86_64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: valgrind
Version: 6.4
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Mark Wielaard
QA Contact: Miloš Prchlík
URL: https://bugs.kde.org/show_bug.cgi?id=...
Whiteboard:
Depends On:
Blocks: 1026230 1056252
TreeView+ depends on / blocked
 
Reported: 2013-10-29 03:09 UTC by Tom Lane
Modified: 2014-10-14 06:36 UTC (History)
5 users (show)

Fixed In Version: valgrind-3.8.1-3.3.el6
Doc Type: Bug Fix
Doc Text:
Prior to this update, Red Hat Enterprise Linux 6 signal handlers were executed on a misaligned stack when used on the AMD64 and Intel 64 architectures. Consequently, instructions that require 16-byte data alignment terminated unexpectedly. This update fixes the stack pointer alignment and now, invoking a signal on the AMD64 and Intel 64 architectures is executed properly.
Clone Of:
: 1026230 (view as bug list)
Environment:
Last Closed: 2014-10-14 06:36:59 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
KDE Software Compilation 280114 0 None None None Never
Red Hat Product Errata RHBA-2014:1464 0 normal SHIPPED_LIVE valgrind bug fix update 2014-10-14 01:10:53 UTC

Description Tom Lane 2013-10-29 03:09:53 UTC
Description of problem:
I'd like to lobby for valgrind upstream's revision 13182 to be included into RHEL6.  It looks like this:

$ svn diff -c 13182
Index: coregrind/m_sigframe/sigframe-amd64-linux.c
===================================================================
--- coregrind/m_sigframe/sigframe-amd64-linux.c (revision 13181)
+++ coregrind/m_sigframe/sigframe-amd64-linux.c (revision 13182)
@@ -452,7 +452,7 @@
    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)))

Without this, signal handlers are executed on a misaligned stack, and so
instructions that require correct 16-byte alignment dump core.

I see that this behavior was previously reported as rhbz #950585, which was
closed WONTFIX apparently because it was thought to be a Postgres-specific problem.  It isn't, though I'll admit that I'm griping mainly because this is preventing me from using valgrind on Postgres.

Version-Release number of selected component (if applicable):
valgrind-3.8.1-3.2.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
There's a reproducer included in https://bugs.kde.org/show_bug.cgi?id=280114
where the issue was first diagnosed.

Comment 2 Mark Wielaard 2013-10-29 09:09:12 UTC
Full upstream commit log describes this as:

    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 to fix BZ#280114.

The upstream bug report has a very small SIGALRM based testcase for this.

Comment 4 Miloš Prchlík 2014-06-03 12:26:00 UTC
Verified for build valgrind-3.8.1-3.5.el6.

Comment 5 errata-xmlrpc 2014-10-14 06:36:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1464.html


Note You need to log in before you can comment on or make changes to this bug.