From patchwork Mon Oct 7 08:45:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 98449 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 36DA63860C30 for ; Mon, 7 Oct 2024 08:45:50 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 475AD3858D20 for ; Mon, 7 Oct 2024 08:45:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 475AD3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 475AD3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728290726; cv=none; b=BFu8lxww48LGEsDCwfa6avKnKvxLVRCdhek8IQ3w05nHrAeoV5VnD/L+hkx8OZ3QB6KmbDTRwdxj+gLE/fxvMlBbV3V04PqvED0TvRvEIU4P322/eXWTQyGkv/uYAGH3YzqHDmIHBNuSYO5pPG6zHjsDpiipaBmV37LMVXmAeO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728290726; c=relaxed/simple; bh=GtqajA6kwx0o7cIjMbmvjfUQX8aDSZ2NokJOtPZsmDM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=mZcTp3BV/jtNXwS4N4VyUWnDAh2PyqXgbKqSSBenmuTKv7peO8x8U1rMcaLcMd7qh1s0bIxGXnneH5yJY9GuumlvaOz19T8jvn43JFj2S01lYfWOFQWUafVcFqqWt5ZkQ7RndiZkfrM8Jn7HgzrybjElI1Qv1kgoR59x9F2C7GM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3511921F39 for ; Mon, 7 Oct 2024 08:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728290723; 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=P3CjwuhZ7qADuPBjtrFtTNZCLtPwaXtZIHzTlcOoHho=; b=tXwev8bFfvZVA7my4vNBGaa2V4imz8M3GvAMZvlwYw6R5tk0VJXnYo6aLYEGFYDmWY1MYo 0iOGUiZrx2RUej5HpsAch6LctjES9rUukHMUjKIJF8HktYKN1SB7hCY6aaVrRkmzJbh/o9 Ed0nirjDvxTfNL1e7HlVD8a0QJMOlwQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728290723; 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=P3CjwuhZ7qADuPBjtrFtTNZCLtPwaXtZIHzTlcOoHho=; b=XTxnU/23Zof3jhf9vEe3NySRfamXp9HOFZv3wEUpDIrSIHETXyE940V/MiSO4OH7rHbQsn qCf/kQ6cMCOhHiBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728290723; 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=P3CjwuhZ7qADuPBjtrFtTNZCLtPwaXtZIHzTlcOoHho=; b=tXwev8bFfvZVA7my4vNBGaa2V4imz8M3GvAMZvlwYw6R5tk0VJXnYo6aLYEGFYDmWY1MYo 0iOGUiZrx2RUej5HpsAch6LctjES9rUukHMUjKIJF8HktYKN1SB7hCY6aaVrRkmzJbh/o9 Ed0nirjDvxTfNL1e7HlVD8a0QJMOlwQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728290723; 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=P3CjwuhZ7qADuPBjtrFtTNZCLtPwaXtZIHzTlcOoHho=; b=XTxnU/23Zof3jhf9vEe3NySRfamXp9HOFZv3wEUpDIrSIHETXyE940V/MiSO4OH7rHbQsn qCf/kQ6cMCOhHiBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1A97313786 for ; Mon, 7 Oct 2024 08:45:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KIALBaOfA2cEBgAAD6G6ig (envelope-from ) for ; Mon, 07 Oct 2024 08:45:23 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed] [gdb/testsuite] Fix gdb.python/py-inferior.exp with -fsanitize=thread Date: Mon, 7 Oct 2024 10:45:14 +0200 Message-Id: <20241007084514.20244-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: 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, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org With a gdb build with -fsanitize=thread, and test-case gdb.python/py-inferior.exp I run into: ... (gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)^M ERROR: ThreadSanitizer: requested allocation size 0xffffffffffffffff exceeds \ maximum supported size of 0x10000000000^M ... There's already a workaround for this using ASAN_OPTIONS, and apparently the same is needed for TSAN_OPTIONS. Add the allocator_may_return_null=1 workaround also in TSAN_OPTIONS. Likewise in gdb.dap/memory.exp. Tested on x86_64-linux. --- gdb/testsuite/gdb.dap/memory.exp | 3 ++- gdb/testsuite/gdb.python/py-inferior.exp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) base-commit: d396fcc9d17af551e8bc8543a7676694527893e4 diff --git a/gdb/testsuite/gdb.dap/memory.exp b/gdb/testsuite/gdb.dap/memory.exp index 7082706e11c..c4e4fb3238b 100644 --- a/gdb/testsuite/gdb.dap/memory.exp +++ b/gdb/testsuite/gdb.dap/memory.exp @@ -25,11 +25,12 @@ if {[build_executable ${testfile}.exp $testfile] == -1} { return } -save_vars { env(ASAN_OPTIONS) } { +save_vars { env(ASAN_OPTIONS) env(TSAN_OPTIONS) } { # The request readMemory with count 18446744073709551615 triggers address # sanitizer. Suppress the error, leaving us with just this warning: # WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes set_sanitizer ASAN_OPTIONS allocator_may_return_null 1 + set_sanitizer TSAN_OPTIONS allocator_may_return_null 1 if {[dap_initialize] == ""} { return diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index ee30390e29f..58475bded0f 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -27,12 +27,13 @@ if { [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable } # Start with a fresh gdb. -save_vars { env(ASAN_OPTIONS) } { +save_vars { env(ASAN_OPTIONS) env(TSAN_OPTIONS) } { # The call to gdb.selected_inferior().read_memory (0, 0xffffffffffffffff) # triggers address sanitizer. Suppress the error, leaving us with just # this warning: # WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes set_sanitizer ASAN_OPTIONS allocator_may_return_null 1 + set_sanitizer TSAN_OPTIONS allocator_may_return_null 1 clean_restart ${testfile} }