public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/29358] New: [gdb/testsuite] ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD
Date: Tue, 12 Jul 2022 06:30:52 +0000	[thread overview]
Message-ID: <bug-29358-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29358

            Bug ID: 29358
           Summary: [gdb/testsuite] ASan runtime does not come first in
                    initial library list; you should either link runtime
                    to your application or manually preload it with
                    LD_PRELOAD
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When building gdb with -fsanitize=address and running the gdb testsuite, we run
into:
...
ERROR: GDB process no longer exists
ERROR: (eof) GDB never initialized.
...

In more detail:
...
builtin_spawn /home/vries/gdb_versions/devel/build/gdb/testsuite/../../gdb/gdb
-nw -nx -iex set height 0 -iex set width 0 -data-directory
/home/vries/gdb_versions/devel/build/gdb/testsuite/../data-directory^M
==10637==ASan runtime does not come first in initial library list; you should
either link runtime to your application or manually preload it with
LD_PRELOAD.^M
ERROR: GDB process no longer exists
GDB process exited with wait status 10637 exp13 0 1
UNRESOLVED: gdb.base/libsegfault.exp: gdb emits custom handler warning
...
and:
...
builtin_spawn
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.threads/attach-slow-waitpid/attach-slow-waitpid^M
builtin_spawn /home/vries/gdb_versions/devel/build/gdb/testsuite/../../gdb/gdb
-nw -nx -iex set height 0 -iex set width 0 -data-directory
/home/vries/gdb_versions/devel/build/gdb/testsuite/../data-directory^M
==1953==ASan runtime does not come first in initial library list; you should
either link runtime to your application or manually preload it with
LD_PRELOAD.^M
ERROR: (eof) GDB never initialized.
UNTESTED: gdb.threads/attach-slow-waitpid.exp: Couldn't start GDB with
preloaded lib
...

Both test-cases use gdb_spawn_with_ld_preload, and are indeed the only ones to
do so.

I can prevent the error by doing:
...
export ASAN_OPTIONS=verify_asan_link_order=0
...

Found here (
https://stackoverflow.com/questions/59853730/asan-issue-with-asan-library-loading
), where it is mentioned that it needs to be checked that:
...
libraries from /etc/ld.so.preload do not intercept symbols important for Asan
e.g. malloc, free, etc.
...

I've looked at slow-waitpid.c and debug/segfault.c (the latter in the glibc
sources) that looks ok.

[ An alternative is to use -static-asan, but I haven't tried that. ]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-07-12  6:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12  6:30 vries at gcc dot gnu.org [this message]
2022-07-12 12:04 ` [Bug testsuite/29358] " vries at gcc dot gnu.org
2022-07-12 12:04 ` vries at gcc dot gnu.org

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

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

  git send-email \
    --in-reply-to=bug-29358-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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.
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).