From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 33432385C414; Fri, 28 Jul 2023 09:32:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33432385C414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690536763; bh=LcrLfNS0l0NwvifmC9sWtHXkXbfTaqE90M41IPnO73s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Fv8Lg0Ih0JrWSXep1+dgilaGAW4iUC/ot1U0j1/o4s5FZKwigZTIyRtUvcJ1OLaSp l5KBpjPaK0YYJBPip6sb74yyK56Rq9yCl+H6ouW2KN7vhA8jVmoek2WhHz9H9pOJNj hKWG3R6sWaVqlcQDMakDxqNDxsM5DMMrXHAm5FrA= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/30392] [gdb/symtab] thread sanitizer data race in gdb.base/index-cache.exp Date: Fri, 28 Jul 2023 09:32:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30392 --- Comment #6 from Tom de Vries --- (In reply to Simon Marchi from comment #3) > The first issue we hit (the failure Tom de Vries shows) is an unprotected > access to global_index_cache::m_enabled. That is easily fixed by making > m_enabled an std::atomic (don't know if that's the right way, but it > makes tsan happy). FWIW, AFAIU, the problem is that we have: ... (gdb) set index-cache enabled off (gdb) file $exec (gdb) set index-cache enabled on ... and there's a race on global_index_cache::m_enabled, with: - the "set index-cache enabled on" command writing it, and - the index-cache entry writing scheduled by the file command reading it. If the read happens first, no index-cache entry will be written. If the wr= ite happens first, an index-cache-entry will be written. By making it a std::atomic, we make this non-determinism defined behaviour, so tsan stops complaining, but we want deterministic behaviour instead. --=20 You are receiving this mail because: You are on the CC list for the bug.=