unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jim@meyering.net, emacs-devel@gnu.org
Subject: Re: building/using address-sanitizer-enabled emacs?
Date: Wed, 17 May 2017 13:05:29 -0700	[thread overview]
Message-ID: <3ff64f5d-492a-3368-5cb0-3cd7ffb55fbc@cs.ucla.edu> (raw)
In-Reply-To: <83efvn5uxq.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

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 
<http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00182.html>, 
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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Work-around-AddressSanitizer-bug-with-vfork.patch --]
[-- Type: text/x-patch; name="0001-Work-around-AddressSanitizer-bug-with-vfork.patch", Size: 1353 bytes --]

From 709259dcc501ef991991a35a6ffb2aef02a62c60 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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=UTF-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’s shadow memory.  This is too
bad, as we’d rather have AddressSanitizer catch memory-access bugs
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
 
+/* gcc -fsanitize=address 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
-- 
2.9.4


  reply	other threads:[~2017-05-17 20:05 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07  3:40 building/using address-sanitizer-enabled emacs? Jim Meyering
2017-05-07 19:54 ` Paul Eggert
2017-05-07 21:44   ` Jim Meyering
2017-05-08  2:36   ` Eli Zaretskii
2017-05-08  5:42     ` Paul Eggert
2017-05-08 14:39       ` Eli Zaretskii
2017-05-08 14:46         ` Paul Eggert
2017-05-08 16:04           ` Eli Zaretskii
2017-05-09  5:48             ` Jim Meyering
2017-05-09 15:18               ` Eli Zaretskii
2017-05-09 17:06                 ` Jim Meyering
2017-05-09 17:45                   ` Eli Zaretskii
2017-05-09 19:22               ` Paul Eggert
2017-05-09 22:49                 ` Jim Meyering
2017-05-10  2:41                   ` Eli Zaretskii
2017-05-16 21:49                     ` Paul Eggert
2017-05-17  2:24                       ` Eli Zaretskii
2017-05-17 14:46                         ` Paul Eggert
2017-05-17 16:06                           ` Eli Zaretskii
2017-05-17 20:05                             ` Paul Eggert [this message]
2017-05-18  4:15                               ` Eli Zaretskii
2017-05-09 23:15 ` Philipp Stephani
2017-05-10  2:42   ` Eli Zaretskii
2017-05-10 22:24     ` Philipp Stephani
2017-05-13  8:02       ` Eli Zaretskii
2017-05-13 15:08         ` [PATCH] Fix use of sockaddr_in Philipp Stephani
2017-05-13 16:52           ` Eli Zaretskii
2017-05-13 19:14             ` Andreas Schwab
2017-05-13 19:29               ` Eli Zaretskii
2017-05-13 20:05                 ` Andreas Schwab
2017-05-14  2:32                   ` Eli Zaretskii
2017-05-14  6:11                     ` Andreas Schwab
2017-05-14 14:20                       ` Eli Zaretskii
2017-05-15  6:15                         ` Paul Eggert
2017-05-15  9:04                           ` Philipp Stephani
2017-05-17 20:38                             ` Paul Eggert
2017-05-27 11:35                               ` Philipp Stephani
2017-05-17 15:16                           ` Eli Zaretskii
2017-05-17 20:15                             ` Paul Eggert
2017-05-14 10:28           ` Lars Ingebrigtsen
2017-05-14 19:06             ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ff64f5d-492a-3368-5cb0-3cd7ffb55fbc@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jim@meyering.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).