From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5752B3858016; Tue, 24 May 2022 00:22:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5752B3858016 From: "keno at juliacomputing dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcc/105708] libgcc: aarch64: init_lse_atomics can race with user-defined constructors Date: Tue, 24 May 2022 00:22:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgcc X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: keno at juliacomputing dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.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://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 00:22:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105708 --- Comment #5 from Keno Fischer --- Yes, rr cannot record ll/sc. I'm happy to go into depth here, but this is n= ot really an aarch64 issue. rr doesn't work on ppc64le either for this reason.= The introduction of lse has made rr feasible on aarch64, and there has been a substantial effort to get to this point where rr is working on the architecture. We're now working through the distribution issues, where this cropped up (as mentioned, we didn't notice earlier, because the initializat= ion is not deterministic). For the moment, we're telling downstream users to av= oid manual use of ll/sc in programs that they want to record under rr. Obviously this is a significant effort, but for many people it's worth it, because rr= is a critical tool. Perhaps in future hardware iterations, we'll get the abili= ty to fault on stxr abort or similar, which would allow rr to support ll/sc, b= ut until then we need to make due with what we have. The issue here is that `-moutline-atomics` now introduces extra ll/sc instructions even in software where the implementer was careful to avoid ma= nual uses of ll/sc and in particular also in system libraries like libc and rtld that the user may have little control over. Of course we can keep telling people to build their distribution images with `-march=3Darmv8.3-a -mno-outline-atomics` and avoid this issue or have them patch libgcc downstream, but that really seems to defeat the point of `-moutline-atomics= `, which was exactly to avoid this kind of split.=