From 49ba7544c2ebbcfc50ce1e02add6bd739f475c4c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Jun 2018 23:53:58 -0700 Subject: [PATCH] Remove AddressSanitizer bug workaround MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This workaround no longer appears to be needed. * src/alloc.c (USE_ALIGNED_ALLOC): Don’t leave undefined merely because ADDRESS_SANITIZER is defined, as that bug in -fsanitize=address appears to have been fixed. See: https://github.com/google/sanitizers/issues/337 * src/conf_post.h (vfork): Improve comment. --- src/alloc.c | 9 ++++----- src/conf_post.h | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 4186347440c..f600c89ae2c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1146,11 +1146,10 @@ lisp_free (void *block) verify (POWER_OF_2 (BLOCK_ALIGN)); /* Use aligned_alloc if it or a simple substitute is available. - Address sanitization breaks aligned allocation, as of gcc 4.8.2 and - clang 3.3 anyway. Aligned allocation is incompatible with - unexmacosx.c, so don't use it on Darwin. */ + Aligned allocation is incompatible with unexmacosx.c, so don't use + it on Darwin unless CANNOT_DUMP. */ -#if ! ADDRESS_SANITIZER && !defined DARWIN_OS +#if !defined DARWIN_OS || defined CANNOT_DUMP # if (defined HAVE_ALIGNED_ALLOC \ || (defined HYBRID_MALLOC \ ? defined HAVE_POSIX_MEMALIGN \ @@ -1446,7 +1445,7 @@ laligned (void *p, size_t size) static void * lmalloc (size_t size) { -#if USE_ALIGNED_ALLOC +#ifdef USE_ALIGNED_ALLOC if (! MALLOC_IS_GC_ALIGNED && size % GCALIGNMENT == 0) return aligned_alloc (GCALIGNMENT, size); #endif diff --git a/src/conf_post.h b/src/conf_post.h index bf2cfc4f05f..30f3b953056 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -350,7 +350,8 @@ extern int emacs_setenv_TZ (char const *); # define ATTRIBUTE_NO_SANITIZE_UNDEFINED #endif -/* gcc -fsanitize=address does not work with vfork in Fedora 25 x86-64. +/* gcc -fsanitize=address does not work with vfork in Fedora 28 x86-64. See: + https://lists.gnu.org/r/emacs-devel/2017-05/msg00464.html For now, assume that this problem occurs on all platforms. */ #if ADDRESS_SANITIZER && !defined vfork # define vfork fork -- 2.39.2