public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [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
@ 2022-07-12  6:30 vries at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-07-12  6:30 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug testsuite/29358] [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
  2022-07-12  6:30 [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 vries at gcc dot gnu.org
@ 2022-07-12 12:04 ` vries at gcc dot gnu.org
  2022-07-12 12:04 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-07-12 12:04 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.1
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-July/190672.html

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug testsuite/29358] [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
  2022-07-12  6:30 [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 vries at gcc dot gnu.org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-07-12 12:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=75948417af8f86d1b9b0e3b51f904e1345927885

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-12 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12  6:30 [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 vries at gcc dot gnu.org
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

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).