[Bug 217065] Memmove / bcopy optimization bug

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Feb 13 10:51:06 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217065

            Bug ID: 217065
           Summary: Memmove / bcopy optimization bug
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm at FreeBSD.org
          Reporter: alexandre.martins at stormshield.eu

Hello,

During the optimization phase of our project on an Armada 380, I have see that
an optimization on bcopy/memmove is broken.

https://svnweb.freebsd.org/base/head/sys/arm/arm/support.S?view=annotate#l403

The condition on the following line are reserved:

> subcc r3, r0, r1 /* if (dst > src) r3 = dst - src */
> subcs r3, r1, r0 /* if (src > dsr) r3 = src - dst */
> cmp r3, r2 /* if (r3 < len) we have an overlap */
> bcc PIC_SYM(_C_LABEL(memcpy), PLT)

Should be:

> subcs r3, r0, r1 /* if (dst > src) r3 = dst - src */
> subcc r3, r1, r0 /* if (src > dsr) r3 = src - dst */
> cmp r3, r2 /* if (r3 < len) we have an overlap */
> bcs PIC_SYM(_C_LABEL(memcpy), PLT)

This code may produce bugs if an unlikely copy of more that 2Gb is done (I
don't see how).

I have already reported that on the mailling list:

https://docs.freebsd.org/cgi/getmsg.cgi?fetch=462567+0+archive/2017/freebsd-arm/20170212.freebsd-arm

Best regards,

Alexandre Martins

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-arm mailing list