public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m.k.edwards at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/48126] New: arm_output_sync_loop: misplaced memory barrier, missing clrex / dummy strex Date: Mon, 14 Mar 2011 23:12:00 -0000 [thread overview] Message-ID: <bug-48126-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48126 Summary: arm_output_sync_loop: misplaced memory barrier, missing clrex / dummy strex Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: m.k.edwards@gmail.com Created attachment 23656 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23656 Patch alters DMB placement and adds CLREXNE The ARMv6+ implementation of __sync_*_compare_and_swap branches on a failed compare. There are two (theoretical, as I understand it) flaws in this branch path. One, it skips past the memory barrier at the end of the critical region, which could cause memory accesses to get speculated in. Two, it doesn't perform a clrex (or, for older armv6, a dummy strex) to clear the local monitor. This may not be a practical problem in most userland code, but it's at least not technically correct according to ARM docs, and it interferes with auditing locking code using valgrind/qemu/etc. The attached patch fixes these two issues for ARMv7-a / Thumb2 targets. However, the "clrexne" part of it is not correct for older ARMv6 variants which lack clrex or the ability to add a conditional on it (or for assemblers which can't handle the Thumb2 "it" opcode when assembling for ARM).
next reply other threads:[~2011-03-14 23:12 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-03-14 23:12 m.k.edwards at gmail dot com [this message] 2011-03-17 16:17 ` [Bug target/48126] " marcus.shawcroft at arm dot com 2011-03-17 18:38 ` m.k.edwards at gmail dot com 2011-05-24 14:46 ` marcus.shawcroft at arm dot com 2011-05-24 17:05 ` m.k.edwards at gmail dot com 2011-06-22 16:40 ` david.gilbert at linaro dot org 2011-06-22 19:01 ` m.k.edwards at gmail dot com 2011-06-23 9:33 ` marcus.shawcroft at arm dot com 2011-06-24 11:29 ` m.k.edwards at gmail dot com 2011-06-24 13:57 ` ramana at gcc dot gnu.org 2011-10-14 14:40 ` [Bug target/48126] arm_output_sync_loop: misplaced memory barrier rsandifo at gcc dot gnu.org 2011-10-14 14:46 ` rsandifo at gcc dot gnu.org 2012-06-08 6:59 ` jye2 at gcc dot gnu.org 2012-06-19 3:01 ` jye2 at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-48126-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).