Blame SOURCES/valgrind-3.14.0-ppc64-unaligned-words.patch

560544
commit c5a5bea00af75f6ac50da10967d956f117b956f1
560544
Author: Mark Wielaard <mark@klomp.org>
560544
Date:   Sat Dec 8 13:47:43 2018 -0500
560544
560544
    memcheck: Allow unaligned loads of words on ppc64[le].
560544
    
560544
    On powerpc partial unaligned loads of words from partially invalid
560544
    addresses are OK and could be generated by our translation of ldbrx.
560544
    
560544
    Adjust partial_load memcheck tests to allow partial loads of words
560544
    on powerpc64.
560544
    
560544
    Part of resolving bug #386945.
560544
560544
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
560544
index 3ef7cb9..737f79d 100644
560544
--- a/memcheck/mc_main.c
560544
+++ b/memcheck/mc_main.c
560544
@@ -1508,6 +1508,9 @@ ULong mc_LOADVn_slow ( Addr a, SizeT nBits, Bool bigendian )
560544
 #  if defined(VGA_mips64) && defined(VGABI_N32)
560544
    if (szB == VG_WORDSIZE * 2 && VG_IS_WORD_ALIGNED(a)
560544
        && n_addrs_bad < VG_WORDSIZE * 2)
560544
+#  elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
560544
+   /* On power unaligned loads of words are OK. */
560544
+   if (szB == VG_WORDSIZE && n_addrs_bad < VG_WORDSIZE)
560544
 #  else
560544
    if (szB == VG_WORDSIZE && VG_IS_WORD_ALIGNED(a)
560544
        && n_addrs_bad < VG_WORDSIZE)
560544
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
560544
index 2af4dd1..70b8ada 100644
560544
--- a/memcheck/tests/Makefile.am
560544
+++ b/memcheck/tests/Makefile.am
560544
@@ -235,8 +235,10 @@ EXTRA_DIST = \
560544
 	partiallydefinedeq.stdout.exp \
560544
 	partial_load_ok.vgtest partial_load_ok.stderr.exp \
560544
 		partial_load_ok.stderr.exp64 \
560544
+		partial_load_ok.stderr.exp-ppc64 \
560544
 	partial_load_dflt.vgtest partial_load_dflt.stderr.exp \
560544
 		partial_load_dflt.stderr.exp64 \
560544
+		partial_load_dflt.stderr.exp-ppc64 \
560544
 	partial_load_dflt.stderr.expr-s390x-mvc \
560544
 	pdb-realloc.stderr.exp pdb-realloc.vgtest \
560544
 	pdb-realloc2.stderr.exp pdb-realloc2.stdout.exp pdb-realloc2.vgtest \
560544
diff --git a/memcheck/tests/partial_load.c b/memcheck/tests/partial_load.c
560544
index 0b2f10b..685ca8d 100644
560544
--- a/memcheck/tests/partial_load.c
560544
+++ b/memcheck/tests/partial_load.c
560544
@@ -1,14 +1,14 @@
560544
-
560544
+#include <stdio.h>
560544
 #include <stdlib.h>
560544
 #include <assert.h>
560544
 
560544
 int main ( void )
560544
 {
560544
-  long  w;
560544
-  int   i;
560544
-  char* p;
560544
-
560544
+  long  w; int   i; char* p;
560544
   assert(sizeof(long) == sizeof(void*));
560544
+#if defined(__powerpc64__)
560544
+  fprintf (stderr, "powerpc64\n"); /* Used to select correct .exp file.  */
560544
+#endif
560544
 
560544
   /* partial load, which --partial-loads-ok=yes should suppress */
560544
   p = calloc( sizeof(long)-1, 1 );
560544
@@ -16,7 +16,7 @@ int main ( void )
560544
   w = *(long*)p;
560544
   free(p);
560544
 
560544
-  /* partial but misaligned, cannot be suppressed */
560544
+  /* partial but misaligned, ppc64[le] ok, but otherwise cannot be suppressed */
560544
   p = calloc( sizeof(long), 1 );
560544
   assert(p);
560544
   p++;
560544
diff --git a/memcheck/tests/partial_load_dflt.stderr.exp-ppc64 b/memcheck/tests/partial_load_dflt.stderr.exp-ppc64
560544
new file mode 100644
560544
index 0000000..cf32bcf
560544
--- /dev/null
560544
+++ b/memcheck/tests/partial_load_dflt.stderr.exp-ppc64
560544
@@ -0,0 +1,23 @@
560544
+
560544
+powerpc64
560544
+Invalid read of size 2
560544
+   at 0x........: main (partial_load.c:30)
560544
+ Address 0x........ is 0 bytes inside a block of size 1 alloc'd
560544
+   at 0x........: calloc (vg_replace_malloc.c:...)
560544
+   by 0x........: main (partial_load.c:28)
560544
+
560544
+Invalid read of size 8
560544
+   at 0x........: main (partial_load.c:37)
560544
+ Address 0x........ is 0 bytes inside a block of size 8 free'd
560544
+   at 0x........: free (vg_replace_malloc.c:...)
560544
+   by 0x........: main (partial_load.c:36)
560544
+
560544
+
560544
+HEAP SUMMARY:
560544
+    in use at exit: ... bytes in ... blocks
560544
+  total heap usage: ... allocs, ... frees, ... bytes allocated
560544
+
560544
+For a detailed leak analysis, rerun with: --leak-check=full
560544
+
560544
+For counts of detected and suppressed errors, rerun with: -v
560544
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
560544
diff --git a/memcheck/tests/partial_load_ok.stderr.exp-ppc64 b/memcheck/tests/partial_load_ok.stderr.exp-ppc64
560544
new file mode 100644
560544
index 0000000..cf32bcf
560544
--- /dev/null
560544
+++ b/memcheck/tests/partial_load_ok.stderr.exp-ppc64
560544
@@ -0,0 +1,23 @@
560544
+
560544
+powerpc64
560544
+Invalid read of size 2
560544
+   at 0x........: main (partial_load.c:30)
560544
+ Address 0x........ is 0 bytes inside a block of size 1 alloc'd
560544
+   at 0x........: calloc (vg_replace_malloc.c:...)
560544
+   by 0x........: main (partial_load.c:28)
560544
+
560544
+Invalid read of size 8
560544
+   at 0x........: main (partial_load.c:37)
560544
+ Address 0x........ is 0 bytes inside a block of size 8 free'd
560544
+   at 0x........: free (vg_replace_malloc.c:...)
560544
+   by 0x........: main (partial_load.c:36)
560544
+
560544
+
560544
+HEAP SUMMARY:
560544
+    in use at exit: ... bytes in ... blocks
560544
+  total heap usage: ... allocs, ... frees, ... bytes allocated
560544
+
560544
+For a detailed leak analysis, rerun with: --leak-check=full
560544
+
560544
+For counts of detected and suppressed errors, rerun with: -v
560544
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
560544
diff -ur valgrind-3.14.0.orig/memcheck/tests/Makefile.in valgrind-3.14.0/memcheck/tests/Makefile.in
560544
--- valgrind-3.14.0.orig/memcheck/tests/Makefile.in	2018-12-12 23:17:07.525501080 +0100
560544
+++ valgrind-3.14.0/memcheck/tests/Makefile.in	2018-12-12 23:18:13.404014757 +0100
560544
@@ -1546,8 +1546,10 @@
560544
 	partiallydefinedeq.stdout.exp \
560544
 	partial_load_ok.vgtest partial_load_ok.stderr.exp \
560544
 		partial_load_ok.stderr.exp64 \
560544
+		partial_load_ok.stderr.exp-ppc64 \
560544
 	partial_load_dflt.vgtest partial_load_dflt.stderr.exp \
560544
 		partial_load_dflt.stderr.exp64 \
560544
+		partial_load_dflt.stderr.exp-ppc64 \
560544
 	partial_load_dflt.stderr.expr-s390x-mvc \
560544
 	pdb-realloc.stderr.exp pdb-realloc.vgtest \
560544
 	pdb-realloc2.stderr.exp pdb-realloc2.stdout.exp pdb-realloc2.vgtest \