Comment 85 for bug 727064

Revision history for this message
In , torvalds (torvalds-redhat-bugs) wrote :

So in the kernel we have a pretty strict "no regressions" rule, and that if people depend on interfaces we exported having side effects that weren't intentional, we try to fix things so that they still work unless there is a major reason not to.

So I'm disappointed glibc just closes this as NOTABUG. There's no real reason to do the copy backwards that I can see, so doing it that way is just stupid.

But whatever. You can do a LD_PRELOAD trick to get a sane memcpy(), and it does indeed fix the sound for me. Just do something like this:

    prompt$ cat > mymemcpy.c
    #include <sys/types.h>

    void *memcpy(void *dst, const void *src, size_t size)
    {
 void *orig = dst;
 asm volatile("rep ; movsq"
  :"=D" (dst), "=S" (src)
  :"0" (dst), "1" (src), "c" (size >> 3)
  :"memory");
 asm volatile("rep ; movsb"
  :"=D" (dst), "=S" (src)
  :"0" (dst), "1" (src), "c" (size & 7)
  :"memory");
 return orig;
    }
    ^D
    prompt$ gcc -O2 -c mymemcpy.c
    prompt$ ld -G mymemcpy.o -o mymemcpy.so
    prompt$ LD_PRELOAD mymemcpy.so /opt/google/chrome/google-chrome &

and it does seem to work. Not a lot of testing, but at least TED-talks work for me again (and I tested the Daughtry thing too, although I am not convinced it sounds all that much better without the sound corruption).