From patchwork Mon Jul 31 07:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 73371 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 917143858401 for ; Mon, 31 Jul 2023 07:16:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 917143858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690787779; bh=2yfbHzjixPRC4RLTGh/LZbhdbGdnF7jeUZQVoGXIW2E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=J4AAmd3JlgAx2Efg2a4QU2xFZPb1pDfnv69GhNqAOOcjeNqLxItPibKdJRDrzsXmq hDYtaXVIWGOGzXVbZ5ZJHRBmeaM09F1njqYSy4zzkUqqyE0d8iGw67oklwkcQeP5yY ljhSXuyvvVbv+ZsxRD41xV7qFJEjgISsVAYCIz8U= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 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) 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 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 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 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-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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(+) base-commit: 8e72ee1de8df0789c0ac593467d34387af388c83 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