From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 5C50E385840F for ; Mon, 31 Jul 2023 07:15:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C50E385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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 8F584223B5 for ; Mon, 31 Jul 2023 07:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690787756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2yfbHzjixPRC4RLTGh/LZbhdbGdnF7jeUZQVoGXIW2E=; b=qBHnm3LOH/hQMbncS6AzZuhQEmocPbv3LkHzZr5UrY3ZH84xI5Cx99gjUQzfGgSkpM8m2Q EK0oaqC8tc30mkRpkLC/9wnNlNsgs6LAkkqCVEbv3SRR9FYI1SM6j2EE1ytODBGWaxUMCi WePtPacQUa8lS2Vt4kFLXb+6oC+gR3Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690787756; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2yfbHzjixPRC4RLTGh/LZbhdbGdnF7jeUZQVoGXIW2E=; b=MMOyinDFRt0npZICXHE3pFiRmZxVgFGRQnIqJYhmX4wYqswEE+6pMESuD8KMWIXH6uLnu8 zmPWI1OJRlJ7KZBA== 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 74A701322C for ; Mon, 31 Jul 2023 07:15:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 90HDGqxfx2QvewAAMHmgww (envelope-from ) for ; Mon, 31 Jul 2023 07:15:56 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/testsuite] Set TSAN_OPTIONS by default to history_size=7 Date: Mon, 31 Jul 2023 09:15:47 +0200 Message-Id: <20230731071547.1140-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 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 List-Id: I build gdb with -fsanitize=thread and ran the testsuite, and into the case that a race is detected, but we see the full stack trace only for one of the two accesses, and the other one is showing "failed to restore the stack". Try to prevent this by setting ThreadSanitizer flag history_size [1] to the maximum (7) by default, as suggested here [2]. Tested on x86_64-linux. [1] https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags [2] https://groups.google.com/g/thread-sanitizer/c/VzSWE7UxhIE --- gdb/testsuite/lib/gdb.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 66c04a2efe2..c42f5308752 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -71,6 +71,14 @@ proc set_sanitizer_default { env_var var_id val } { set_sanitizer_default TSAN_OPTIONS suppressions \ $srcdir/../tsan-suppressions.txt +# When using ThreadSanitizer we may run into the case that a race is detected, +# but we see the full stack trace only for one of the two accesses, and the +# other one is showing "failed to restore the stack". +# Try to prevent this by setting history_size to the maximum (7) by default. +# See also the ThreadSanitizer docs ( +# https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags ). +set_sanitizer_default TSAN_OPTIONS history_size 7 + # If GDB is built with ASAN (and because there are leaks), it will output a # leak report when exiting as well as exit with a non-zero (failure) status. # This can affect tests that are sensitive to what GDB prints on stderr or its base-commit: 8e72ee1de8df0789c0ac593467d34387af388c83 -- 2.35.3