GNU bug report logs - #76393
Warn about -fsanitizer=address builds

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Tue, 18 Feb 2025 12:35:02 UTC

Severity: wishlist

Done: Pip Cet <pipcet <at> protonmail.com>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 76393 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 76393 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#76393: Warn about -fsanitizer=address builds
Date: Sat, 01 Mar 2025 13:57:22 +0000
"Eli Zaretskii" <eliz <at> gnu.org> writes:

> Ping!  Can we make progress with this issue, please?

Is this sufficiently diplomatic?  It also removes a reference to unexec
that somehow survived the no-purespace merge :-)

By the way, I think I'm responsible for the "minor" memory leak that
happens during pdumping, because the hash table freezing code duplicates
the hash table and never freezes the original copy.  Trying to fix that
now, though I don't think leaking memory during pdumper is a high
priority.

Pip

From 95bbb25afcafa24edb5b31dbf28a41378bd90fa7 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> protonmail.com>
Subject: [PATCH] Improve instructions for running with -fsanitize=address
 (bug#76393)

* etc/DEBUG (ASAN_OPTIONS): Add 'detect_stack_use_after_return=0'
requirement.  Remove obsolete unexec commentary.
---
 etc/DEBUG | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/etc/DEBUG b/etc/DEBUG
index ca061063454..b95ea7e7e8c 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -1010,14 +1010,16 @@ program.
 ** Running Emacs with address sanitization
 
 Building Emacs with address sanitization can help debug memory-use
-problems, such as freeing the same object twice.  To use
-AddressSanitizer with GCC and similar compilers, append
+problems, such as freeing the same object twice.  It does, however,
+require special care to ensure that Emacs's garbage collection continues
+working.  To use AddressSanitizer with GCC and similar compilers, append
 '-fsanitize=address' to CFLAGS, either when running 'configure' or
-running 'make'.  Configure, build and run Emacs with
-ASAN_OPTIONS='detect_leaks=0' in the environment to suppress
-diagnostics of minor memory leaks in Emacs.  For example:
+running 'make'.  When running Emacs, ensure the ASAN_OPTIONS environment
+variable is set and includes 'detect_stack_use_after_return=0' (to keep
+GC working) and 'detect_leaks=0' (to avoid noisy diagnostics about minor
+memory leaks in Emacs).  For example:
 
-  export ASAN_OPTIONS='detect_leaks=0'
+  export ASAN_OPTIONS='detect_leaks=0,detect_stack_use_after_return=0'
   ./configure CFLAGS='-O0 -g3 -fsanitize=address'
   make
   src/emacs
@@ -1034,8 +1036,7 @@ will let you gain control when an error is detected and before
 AddressSanitizer outputs to stderr or terminates the program.
 
 Address sanitization is incompatible with undefined-behavior
-sanitization, unfortunately.  Address sanitization is also
-incompatible with the --with-dumping=unexec option of 'configure'.
+sanitization, unfortunately.
 
 *** Address poisoning/unpoisoning
 
-- 
2.48.1





This bug report was last modified 76 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.