From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 24 06:51:17 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86F6465C; Thu, 24 Apr 2014 06:51:17 +0000 (UTC) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com [IPv6:2a00:1450:4010:c04::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7D251E42; Thu, 24 Apr 2014 06:51:16 +0000 (UTC) Received: by mail-lb0-f175.google.com with SMTP id w7so1658054lbi.34 for ; Wed, 23 Apr 2014 23:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=5v6D1qbKyyHFUsHc27NvUBLUrdNU+LdiRvCZ8gXoVsI=; b=L8oOcVfftc8uOdg4QAU3GayO0BLtq3nOMXpIXgyj5xWO+jipo/vmhMqFTDLibqVKrL k4Mw7HfFThJHJOBaexDdjkE5pXefXDhYAnGaYC79uTywv9Vo0UAQRCduVLmYoPvxFhr0 rsVEulTozottLHkPpTPpxRrfqdmLW2p2bnhBkd+cEz4d1uKXzvuqnLmTsJv4Kwt55AOx HKTwxXc1s97dqOzUuZj0gjwng+JG/MWEcEPNtfEEMFVWmgtIH26zhdFcDMVgEC26kncP +UxH66O6mXp12AuVdDjHiauyi413c+vWu8HTfhDeiz15NRrWgtb40DPndUIwH7Ck2qra BFxg== X-Received: by 10.112.89.234 with SMTP id br10mr43850lbb.60.1398322274790; Wed, 23 Apr 2014 23:51:14 -0700 (PDT) Received: from localhost ([188.230.122.226]) by mx.google.com with ESMTPSA id mw10sm3515084lbb.24.2014.04.23.23.51.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Apr 2014 23:51:13 -0700 (PDT) Date: Thu, 24 Apr 2014 09:51:11 +0300 From: Mikolaj Golub To: Stanislav Sedov Subject: Re: valgrind on amd64 crashes when delivering signal for threaded application Message-ID: <20140424065110.GB10637@gmail.com> References: <20140423200135.GA6009@gmail.com> <5FDC5FC6-8748-494C-982B-0CEF734BD883@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5FDC5FC6-8748-494C-982B-0CEF734BD883@freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2014 06:51:17 -0000 On Wed, Apr 23, 2014 at 11:18:57PM -0700, Stanislav Sedov wrote: > > On Apr 23, 2014, at 1:01 PM, Mikolaj Golub wrote: > > > --- coregrind/m_sigframe/sigframe-amd64-freebsd.c.orig 2014-04-23 22:39:45.000000000 +0300 > > +++ coregrind/m_sigframe/sigframe-amd64-freebsd.c 2014-04-23 22:40:23.000000000 +0300 > > @@ -250,7 +250,7 @@ static Addr build_sigframe(ThreadState * > > UWord err; > > > > rsp -= sizeof(*frame); > > - rsp = VG_ROUNDDN(rsp, 16); > > + rsp = VG_ROUNDDN(rsp, 16) - 8; > > frame = (struct sigframe *)rsp; > > > > if (!extend(tst, rsp, sizeof(*frame))) > > > > Unfortunately, I have poor understanding of valgrind internals and > > what is going on exactly when it delivers a signal to the process, so > > failed to find a proper fix. > > This sounds like a proper solution to me though. Stack handling in valgrind > is indeed convoluted, but it seems in this case it clearly misaligns the stack > as it does not take into account the return address. Any objections if I commit > this fix to valgrind-freebsd? Sure, no objections from my side. Thanks. -- Mikolaj Golub