Fortunately, some other people have the same problem, among them is a guy named Linus Torvalds, who adds: "I see this as well. Sounds like clipping or some really bad sample rate frequency conversion". They tracked it down to a combination of Fedora 14 and 64-bit flash plugin. Then they tracked it down to glibc (old verions works fine, new one causes that "strange sounds"), and also found out (using valgrind) that flash plugin is doing
memcpy() for the overlapping regions. In such case, memmove() should be used instead, as memcpy() behavior is undefined.Anyway, to make a long story short, recent glibc version (the one shipped in F14) includes an optimization from Intel guys that speeds up
memcpy() for Core 2 Duo, Atom and Core i7 CPUs. Apparently the part of optimization is that memory copying is now done backwards (from upper addresses to lower addresses) which manifestates the bug.Now what is the solution? Fix Adobe Flash to use
memmove(). It should take quite a lot of time, given the fact that the bug report to Adobe was only filed 4 days ago, i.e. this Monday.What is the workaround? To use own implementation of
memcpy() for the browser (and thus the flash plugin) by LD_PRELOADing it. A simple memcpy() implementation and details come from the same Torvalds guy.Here are cut-n-paste instructions for Fedora 14/x86_64/Firefox users, tested on two F14 boxes by me.
cat << EOF > 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;
}
EOF
# Compile and link
gcc -O2 -c mymemcpy.c
ld -G mymemcpy.o -o mymemcpy.so
# Install
sudo cp mymemcpy.so /usr/local/lib64/
# chcon is for SELinux users
sudo chcon --reference=/lib64/libc.so.6 /usr/local/lib64/mymemcpy.so
# Patch the script that runs Firefox
sudo sed -i 's,\(^[[:space:]]*\)\("$prog" ${1+"$@"}\),\1LD_PRELOAD=/usr/local/lib6 4/mymemcpy.so \2,' /usr/lib64/firefox-3.6/run-mozilla.sh
# Same for newer Firefox versions
sudo sed -i 's,\(^[[:space:]]*\)\(exec "$prog" ${1+"$@"}\),\1LD_PRELOAD=/usr/local/lib6 4/mymemcpy.so \2,' /usr/lib64/firefox-3.6/run-mozilla.sh
# Same for Firefox 5:
sudo sed -i 's,\(^[[:space:]]*\)\(exec "$prog" ${1+"$@"}\),\1LD_PRELOAD=/usr/local/lib6 4/mymemcpy.so \2,' /usr/lib64/firefox-5/run-mozilla.sh
2010-11-11 12:55 pm (UTC)
2010-11-11 01:16 pm (UTC)
part 1: http://lj.rossia.org/users/k001/683
part 2: http://lj.rossia.org/users/k001/688
part 3: http://lj.rossia.org/users/k001/688
2010-11-11 01:28 pm (UTC)
2010-11-11 01:44 pm (UTC)
clocksource=[hpet|pit|tsc|acpi_pm|cyclon
2010-11-11 01:45 pm (UTC)
2010-11-11 01:46 pm (UTC)
2010-11-11 01:47 pm (UTC)
2010-11-11 01:56 pm (UTC)
2010-11-11 02:09 pm (UTC)
2010-11-11 01:08 pm (UTC)
2010-11-11 01:16 pm (UTC)
2010-11-11 01:29 pm (UTC)
2010-11-11 04:30 pm (UTC)
2010-11-12 09:21 am (UTC)
2010-11-12 09:28 am (UTC)
2010-11-11 05:55 pm (UTC)
love - все можно сделать/починить, разобраться
hate - очень часто приходится этим заниматся :)
2010-11-12 09:34 am (UTC)
Другой пример — http://lj.rossia.org/users/k001/711
Сам Ульрих негодует, что gcc подменяет printf("%s\n", str) на puts(str), и требует чинить это в gcc, но сам не хочет поправить в glibc, чтобы обе функции одинаково работали, когда str=NULL.
2010-11-13 08:33 pm (UTC)
2010-12-08 07:27 pm (UTC)
Script C++ Terminal, Code?
2011-02-08 03:33 am (UTC)
Re: Script C++ Terminal, Code?
2011-02-08 07:36 am (UTC)
Success
2011-02-08 05:44 pm (UTC)
-Nathan
Thanks
2011-04-22 09:27 am (UTC)