public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/48126] New: arm_output_sync_loop: misplaced memory barrier, missing clrex / dummy strex
@ 2011-03-14 23:12 m.k.edwards at gmail dot com
  2011-03-17 16:17 ` [Bug target/48126] " marcus.shawcroft at arm dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: m.k.edwards at gmail dot com @ 2011-03-14 23:12 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-06-19  3:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-14 23:12 [Bug target/48126] New: arm_output_sync_loop: misplaced memory barrier, missing clrex / dummy strex m.k.edwards at gmail dot com
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

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).