From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 4E13A3858D1E for ; Thu, 3 Aug 2023 14:04:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E13A3858D1E 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-out2.suse.de (Postfix) with ESMTPS id 837A51F45F; Thu, 3 Aug 2023 14:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691071486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KybTj0JUmuhq3USlZXYfuNTZFtaSBb0lmoNYZVWoMkY=; b=XO+ycbX49r5DWNCu2iRO1MI+wrAokWqAf8OkkyGtrHlvt30efaqTYxY0fTndm54BzkW1EA Kl3UDDD9z6VcHdH1WhfysnJBsZVxzqVBylK7IJymptGlGTBCuOIswAad8VcRlkRko4qYrg /alFZCbDA+5/P78hnBTrg9P63dV8QjI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691071486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KybTj0JUmuhq3USlZXYfuNTZFtaSBb0lmoNYZVWoMkY=; b=nWeika9py1fgRHejLVyiYa9ZrTjKyCAdmw+zVjcHLZVSWNRIYFe1CGAOFAKR4fRrPqO1x1 WObzBNnjjd0f4vAQ== 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 6C98B1333C; Thu, 3 Aug 2023 14:04:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /h/KGP6zy2SrBAAAMHmgww (envelope-from ); Thu, 03 Aug 2023 14:04:46 +0000 Message-ID: Date: Thu, 3 Aug 2023 16:04:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/6] [gdb/symtab] Fix data race on bfd_last_cache Content-Language: en-US To: Tom Tromey , Tom de Vries via Gdb-patches References: <20230802095305.3668-1-tdevries@suse.de> <20230802095305.3668-5-tdevries@suse.de> <87fs51dymz.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87fs51dymz.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: On 8/2/23 21:37, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > > Tom> The race is between: > Tom> - a worker thread calling main_name (), and in the process reading > Tom> bfd_last_cache, and > Tom> - the main thread writing to bfd_last_cache. > > Tom> Fix this by calling main_name () from the main thread. > > It seems to me that index-write.c should not be calling main_name. > > main_name might iterate over objfiles, but writing when writing an index > for a specific objfile, only that objfile's notion of "main" should be > considered. > > Instead maybe this code can just query the cooked index directly. I looked into this, and while investigating came to the conclusion that the use of main_name () is unnecessary. I've submitted a patch ( https://sourceware.org/pipermail/gdb-patches/2023-August/201322.html ) to remove it. Thanks, - Tom