Subject: bug#19366: Guile

From: [email-masked] (Ludovic Courtès)
Date: Sat, 13 Dec 2014 16:38:53 +0100

retitle 19366 Building Guile 1.8 with AddressSanitizer
thanks

Joshua Rogers <[email-masked]> skribis:

> When compiling guile from the source with AddressSanitizer, Asan picks
> up a bug:
>
> cat alist.doc arbiters.doc async.doc backtrace.doc boolean.doc chars.doc
> continuations.doc debug.doc deprecation.doc deprecated.doc
> discouraged.doc dynl.doc dynwind.doc environments.doc eq.doc error.doc
> eval.doc evalext.doc extensions.doc feature.doc fluids.doc fports.doc
> futures.doc gc.doc goops.doc gsubr.doc gc-mark.doc gc-segment.doc
> gc-malloc.doc gc-card.doc guardians.doc hash.doc hashtab.doc hooks.doc
> i18n.doc init.doc ioext.doc keywords.doc lang.doc list.doc load.doc
> macros.doc mallocs.doc modules.doc numbers.doc objects.doc objprop.doc
> options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc
> properties.doc random.doc rdelim.doc read.doc root.doc rw.doc
> scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc
> stackchk.doc stacks.doc stime.doc strings.doc srfi-4.doc srfi-13.doc
> srfi-14.doc strorder.doc strports.doc struct.doc symbols.doc threads.doc
> throw.doc values.doc variable.doc vectors.doc version.doc vports.doc
> weaks.doc ramap.doc unif.doc dynl.doc filesys.doc posix.doc net_db.doc
> socket.doc regex-posix.doc |
> GUILE="/root/srcs/guile-1.8/guile-1.8-1.8.8+1/pre-inst-guile"
> ../scripts/snarf-check-and-output-texi          > guile-procedures.texi
> || { rm guile-procedures.texi; false; }
> =================================================================
> ==51918== ERROR: AddressSanitizer: stack-buffer-underflow on address
> 0x7fff531555c0 at pc 0x2ac7bd9a92e8 bp 0x7fff53155330 sp 0x7fff53155328
> READ of size 8 at 0x7fff531555c0 thread T0

[...]

> (/root/srcs/guile-1.8/guile-1.8-1.8.8+1/libguile/.libs/lt-guile+0x400bad)
> Address 0x7fff531555c0 is located at offset 0 in frame
> <scm_i_init_guile> of T0's stack:
>   This frame has 1 object(s):
>     [32, 56) 'body_data'
> HINT: this may be a false positive if your program uses some custom
> stack unwind mechanism or swapcontext
>       (longjmp and C++ exceptions *are* supported)

Because Guile 1.8 uses a custom garbage collector which scans the C
stack for references to heap-allocated objects, chances are that Asan
will view such accesses as suspicious, even though they are in fact
harmless.

However, Guile 1.8 is no longer maintained.

You could try running Asan on Guile 2.0, which has been the stable
series for a number of years.  Guile 2.0 uses the BDW GC (aka. libgc).
It may similarly raise false positives, but since libgc is widely used,
you might be able find feedback from people who have tried using Asan
with it.

HTH,
Ludo’.