From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: building/using address-sanitizer-enabled emacs? Date: Wed, 17 May 2017 13:05:29 -0700 Organization: UCLA Computer Science Department Message-ID: <3ff64f5d-492a-3368-5cb0-3cd7ffb55fbc@cs.ucla.edu> References: <83wp9scbwi.fsf@gnu.org> <83shkfct06.fsf@gnu.org> <83fugfcp3b.fsf@gnu.org> <9089f9ef-5312-2d82-a671-b63269a3312b@cs.ucla.edu> <83bmr1bfhj.fsf@gnu.org> <83r2zo5ifv.fsf@gnu.org> <2fc8d303-8855-fcb9-754d-bc804c3681fe@cs.ucla.edu> <83efvn5uxq.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8A66C552DD2103B1B0748CEE" X-Trace: blaine.gmane.org 1495051602 5249 195.159.176.226 (17 May 2017 20:06:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 May 2017 20:06:42 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 Cc: jim@meyering.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 17 22:06:37 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dB5DQ-0001H0-FW for ged-emacs-devel@m.gmane.org; Wed, 17 May 2017 22:06:36 +0200 Original-Received: from localhost ([::1]:50580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB5DV-0004vK-Pl for ged-emacs-devel@m.gmane.org; Wed, 17 May 2017 16:06:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB5CX-0004ti-2r for emacs-devel@gnu.org; Wed, 17 May 2017 16:05:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB5CV-0002f2-EK for emacs-devel@gnu.org; Wed, 17 May 2017 16:05:41 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48946) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB5CP-0002dh-Jt; Wed, 17 May 2017 16:05:33 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9D05C160072; Wed, 17 May 2017 13:05:31 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id NBMWyIzOmR0f; Wed, 17 May 2017 13:05:30 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4F233160091; Wed, 17 May 2017 13:05:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m8HfgQgmTUTm; Wed, 17 May 2017 13:05:30 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DE79F160072; Wed, 17 May 2017 13:05:29 -0700 (PDT) In-Reply-To: <83efvn5uxq.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214929 Archived-At: This is a multi-part message in MIME format. --------------8A66C552DD2103B1B0748CEE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 05/17/2017 09:06 AM, Eli Zaretskii wrote: > I think we might be talking about 2 different reports. I meant the > one here: > > http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00246.html Ah, that came after his original report , which is the one I was referring to. I reproduced the later problem, and as near as I can make it out it is due to an incompatibility between vfork and -fsanitize=address. My guess is that the vforked child corrupts the parent's shadow memory. I worked around the problem by installing the attached patch into Emacs. --------------8A66C552DD2103B1B0748CEE Content-Type: text/x-patch; name="0001-Work-around-AddressSanitizer-bug-with-vfork.patch" Content-Disposition: attachment; filename="0001-Work-around-AddressSanitizer-bug-with-vfork.patch" Content-Transfer-Encoding: quoted-printable >From 709259dcc501ef991991a35a6ffb2aef02a62c60 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 17 May 2017 10:58:11 -0700 Subject: [PATCH] Work around AddressSanitizer bug with vfork MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Jim Meyering in: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00246.html * src/conf_post.h (vfork) [ADDRESS_SANITIZER]: Define to fork. Unfortunately with the AddressSanitizer in Fedora 25 x86-64, the vforked child messes up the parent=E2=80=99s shadow memory. This is too bad, as we=E2=80=99d rather have AddressSanitizer catch memory-access bug= s related to vfork. --- src/conf_post.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf_post.h b/src/conf_post.h index 4fc0428..1462bd1 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -302,6 +302,12 @@ extern int emacs_setenv_TZ (char const *); # define ATTRIBUTE_NO_SANITIZE_ADDRESS #endif =20 +/* gcc -fsanitize=3Daddress does not work with vfork in Fedora 25 x86-64= . + For now, assume that this problem occurs on all platforms. */ +#if ADDRESS_SANITIZER && !defined vfork +# define vfork fork +#endif + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #undef noinline --=20 2.9.4 --------------8A66C552DD2103B1B0748CEE--