From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id B299A385AC3E for ; Tue, 12 Jul 2022 12:00:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B299A385AC3E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5A71021CDA for ; Tue, 12 Jul 2022 12:00:53 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4943313638 for ; Tue, 12 Jul 2022 12:00:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Dt2QEHVizWLWGQAAMHmgww (envelope-from ) for ; Tue, 12 Jul 2022 12:00:53 +0000 Date: Tue, 12 Jul 2022 14:00:51 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Run two test-cases with ASAN_OPTIONS=verify_asan_link_order=0 Message-ID: <20220712120050.GA6516@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2022 12:00:57 -0000 Hi, When building gdb with -fsanitize=address we run into: ... builtin_spawn gdb -nw -nx -iex set height 0 -iex set width 0 -data-directory \ build/gdb/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 ... Prevent the ASan runtime error by using ASAN_OPTIONS=verify_asan_link_order=0. This makes both test-cases pass. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29358 Committed to trunk. Thanks, - Tom [gdb/testsuite] Run two test-cases with ASAN_OPTIONS=verify_asan_link_order=0 --- gdb/testsuite/gdb.base/libsegfault.exp | 8 +++++++- gdb/testsuite/gdb.threads/attach-slow-waitpid.exp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/libsegfault.exp b/gdb/testsuite/gdb.base/libsegfault.exp index 6b8453f5550..ceb8c417d4d 100644 --- a/gdb/testsuite/gdb.base/libsegfault.exp +++ b/gdb/testsuite/gdb.base/libsegfault.exp @@ -33,7 +33,7 @@ if { [is_remote host] } { proc gdb_spawn_with_ld_preload {lib cmdline_opts} { global env - save_vars { env(LD_PRELOAD) } { + save_vars { env(LD_PRELOAD) env(ASAN_OPTIONS)} { if { ![info exists env(LD_PRELOAD) ] || $env(LD_PRELOAD) == "" } { set env(LD_PRELOAD) "$lib" @@ -41,6 +41,12 @@ proc gdb_spawn_with_ld_preload {lib cmdline_opts} { append env(LD_PRELOAD) ":$lib" } + # Prevent address sanitizer error: + # 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. + set_sanitizer_default ASAN_OPTIONS verify_asan_link_order 0 + gdb_spawn_with_cmdline_opts $cmdline_opts } } diff --git a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp index 68c866a36f0..93b1d88c0dc 100644 --- a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp +++ b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp @@ -71,7 +71,7 @@ with_test_prefix "compile test executable" { proc gdb_spawn_with_ld_preload {lib} { global env - save_vars { env(LD_PRELOAD) } { + save_vars { env(LD_PRELOAD) env(ASAN_OPTIONS) } { if { ![info exists env(LD_PRELOAD) ] || $env(LD_PRELOAD) == "" } { set env(LD_PRELOAD) "$lib" @@ -79,6 +79,12 @@ proc gdb_spawn_with_ld_preload {lib} { append env(LD_PRELOAD) ":$lib" } + # Prevent address sanitizer error: + # 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. + set_sanitizer_default ASAN_OPTIONS verify_asan_link_order 0 + gdb_start } }