From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /p8HNItizWIsSBEAWB0awg (envelope-from ) for ; Tue, 12 Jul 2022 08:01:15 -0400 Received: by simark.ca (Postfix, from userid 112) id C38341E5EA; Tue, 12 Jul 2022 08:01:15 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=PZgwDv2R; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 538161E222 for ; Tue, 12 Jul 2022 08:01:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 903C93856962 for ; Tue, 12 Jul 2022 12:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 903C93856962 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1657627274; bh=Fb8klWID7+aG2EhKN+tpIdoH+ZJjzFR5orsm4pvJGag=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PZgwDv2RVGVLundwIP+YK1eK4++laANLO2OQLQJlUWzBUEtVFB8DUAReY5NsSIurV q+xCvQufmCifud04FHqVRDTjOjln9dZgP+o4gC3UJZM9ZqTgVWjrCmkGjarZO2j4iI njj+EJLZm2LYlSNnN/1Os6G+phKAewVizPHK5ssM= 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 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-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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 } }