diff --git a/valgrind-3.6.1-x86_64-memcpy-memmove.patch b/valgrind-3.6.1-x86_64-memcpy-memmove.patch new file mode 100644 index 0000000..39bc1cf --- /dev/null +++ b/valgrind-3.6.1-x86_64-memcpy-memmove.patch @@ -0,0 +1,92 @@ +--- valgrind/memcheck/mc_replace_strmem.c.jj 2011-06-08 17:26:29.000000000 +0200 ++++ valgrind/memcheck/mc_replace_strmem.c 2011-06-09 14:49:11.000000000 +0200 +@@ -558,11 +558,7 @@ MEMCHR(VG_Z_DYLD, memchr) + #endif + + +-#define MEMCPY(soname, fnname) \ +- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ +- ( void *dst, const void *src, SizeT len ); \ +- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ +- ( void *dst, const void *src, SizeT len ) \ ++#define MEMCPY_BODY \ + { \ + if (is_overlap(dst, src, len, len)) \ + RECORD_OVERLAP_ERROR("memcpy", dst, src, len); \ +@@ -628,6 +624,18 @@ MEMCHR(VG_Z_DYLD, memchr) + \ + return dst; \ + } ++#define MEMCPY(soname, fnname) \ ++ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ++ ( void *dst, const void *src, SizeT len ); \ ++ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ++ ( void *dst, const void *src, SizeT len ) \ ++ MEMCPY_BODY ++#define MEMCPY_ZZ(soname, fnname) \ ++ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \ ++ ( void *dst, const void *src, SizeT len ); \ ++ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \ ++ ( void *dst, const void *src, SizeT len ) \ ++ MEMCPY_BODY + + MEMCPY(VG_Z_LIBC_SONAME, memcpy) + #if defined(VGO_linux) +@@ -636,6 +644,11 @@ MEMCPY(VG_Z_LD64_SO_1, memcpy) /* ld64 + #elif defined(VGO_darwin) + MEMCPY(VG_Z_DYLD, memcpy) + #endif ++#if defined(VGP_amd64_linux) ++/* In glibc 2.14+, memcpy@GLIBC_2.2.5 is an alias to memmove and only ++ memcpy@@GLIBC_2.14 is a real memcpy. */ ++MEMCPY_ZZ(VG_Z_LIBC_SONAME, memcpyZAZAGLIBCZu2Zd14) /* memcpy@@GLIBC_2.14 */ ++#endif + /* icc9 blats these around all over the place. Not only in the main + executable but various .so's. They are highly tuned and read + memory beyond the source boundary (although work correctly and +@@ -738,11 +751,7 @@ MEMSET(VG_Z_DYLD, memset) + #endif + + +-#define MEMMOVE(soname, fnname) \ +- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ +- (void *dstV, const void *srcV, SizeT n); \ +- void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ +- (void *dstV, const void *srcV, SizeT n) \ ++#define MEMMOVE_BODY \ + { \ + SizeT i; \ + Char* dst = (Char*)dstV; \ +@@ -758,12 +767,31 @@ MEMSET(VG_Z_DYLD, memset) + } \ + return dst; \ + } ++#define MEMMOVE(soname, fnname) \ ++ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ++ (void *dstV, const void *srcV, SizeT n); \ ++ void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \ ++ (void *dstV, const void *srcV, SizeT n) \ ++ MEMMOVE_BODY ++#define MEMMOVE_ZZ(soname, fnname) \ ++ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \ ++ (void *dstV, const void *srcV, SizeT n); \ ++ void* VG_REPLACE_FUNCTION_ZZ(soname,fnname) \ ++ (void *dstV, const void *srcV, SizeT n) \ ++ MEMMOVE_BODY + + MEMMOVE(VG_Z_LIBC_SONAME, memmove) + #if defined(VGO_darwin) + MEMMOVE(VG_Z_DYLD, memmove) + #endif +- ++#if defined(VGP_amd64_linux) ++/* In glibc 2.14+, memcpy@GLIBC_2.2.5 is an alias to memmove and only ++ memcpy@@GLIBC_2.14 is a real memcpy. It would be nice for ++ memcpy@GLIBC_2.2.5 to differentiate based on whether the caller ++ was calling memmove or memcpy@GLIBC_2.2.5, for now just treat ++ all such calls as memmove. */ ++MEMMOVE_ZZ(VG_Z_LIBC_SONAME, memcpyZAGLIBCZu2Zd2Zd5) /* memcpy@GLIBC_2.2.5 */ ++#endif + + #define BCOPY(soname, fnname) \ + void VG_REPLACE_FUNCTION_ZU(soname,fnname) \ diff --git a/valgrind.spec b/valgrind.spec index d1ef115..8ea3de9 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -1,7 +1,7 @@ Summary: Tool for finding memory management bugs in programs Name: valgrind Version: 3.6.1 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2 Patch1: valgrind-3.6.1-cachegrind-improvements.patch @@ -24,6 +24,7 @@ Patch17: valgrind-3.6.1-gen_insn_test.patch Patch18: valgrind-3.6.1-x86-ldso-strlen.patch Patch19: valgrind-3.6.1-ppc64-build.patch Patch20: valgrind-3.6.1-tests-_GNU_SOURCE.patch +Patch21: valgrind-3.6.1-x86_64-memcpy-memmove.patch License: GPLv2 URL: http://www.valgrind.org/ Group: Development/Debuggers @@ -118,6 +119,7 @@ for details. %patch18 -p1 %patch19 -p1 %patch20 -p1 +%patch21 -p1 chmod 755 none/tests/s390x/filter_stderr || : @@ -219,6 +221,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Mon Jun 13 2011 Jakub Jelinek 3.6.1-4 +- fix memcpy/memmove redirection on x86_64 (#705790) + * Wed Jun 8 2011 Jakub Jelinek 3.6.1-3 - fix testing against glibc 2.14