[valgrind] Add upstream fixes to valgrind-3.9.0-timer_create.patch

Mark Wielaard mjw at fedoraproject.org
Mon Feb 24 15:41:41 UTC 2014


commit 4714e5a725c11880ba0773d059f842c78cd83e44
Author: Mark Wielaard <mjw at redhat.com>
Date:   Mon Feb 24 16:42:19 2014 +0100

    Add upstream fixes to valgrind-3.9.0-timer_create.patch

 valgrind-3.9.0-timer_create.patch |   52 +++++++++++++++++++++++++++++++++++++
 valgrind.spec                     |    3 ++
 2 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/valgrind-3.9.0-timer_create.patch b/valgrind-3.9.0-timer_create.patch
index 769b355..7b07b63 100644
--- a/valgrind-3.9.0-timer_create.patch
+++ b/valgrind-3.9.0-timer_create.patch
@@ -51,3 +51,55 @@ index 14bb8bf..a3c4b3c 100644
  //----------------------------------------------------------------------
  // From elsewhere...
  //----------------------------------------------------------------------
+commit 763710cc391c5adc85712606bf9882f49ee43e7c
+Author: mjw <mjw at a5019735-40e9-0310-863c-91ae7b9d1cf9>
+Date:   Mon Feb 24 15:09:21 2014 +0000
+
+    BZ#331380 cont. Don't crash if evp->sigev_notify is invalid. Fix scalar test.
+    
+    We check evp.sigev_notify_thread_id only if evp->sigev_notify has
+    SIGEV_THREAD_ID set. But before checking we need to make sure accessing
+    evp->sigev_notify is valid.
+    
+    Fix memcheck/tests/x86-linux/scalar.stderr.exp output.
+    We now produce separate warnings for the 3 different fields.
+    
+    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13837 a5019735-40e9-0310-863c-91ae7b9d1cf9
+
+diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
+index 1a7fa6b..1b1e65e 100644
+--- a/coregrind/m_syswrap/syswrap-linux.c
++++ b/coregrind/m_syswrap/syswrap-linux.c
+@@ -2183,7 +2183,8 @@ PRE(sys_timer_create)
+                     sizeof(int) );
+       PRE_MEM_READ( "timer_create(evp.sigev_notify)", (Addr)&evp->sigev_notify,
+                     sizeof(int) );
+-      if ((evp->sigev_notify & VKI_SIGEV_THREAD_ID) != 0)
++      if (ML_(safe_to_deref)(&evp->sigev_notify, sizeof(int))
++          && (evp->sigev_notify & VKI_SIGEV_THREAD_ID) != 0)
+          PRE_MEM_READ( "timer_create(evp.sigev_notify_thread_id)",
+                        (Addr)&evp->vki_sigev_notify_thread_id, sizeof(int) );
+    }
+diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp
+index e1a2bf2..2114db9 100644
+--- a/memcheck/tests/x86-linux/scalar.stderr.exp
++++ b/memcheck/tests/x86-linux/scalar.stderr.exp
+@@ -3602,7 +3602,17 @@ Syscall param timer_create(timerid) contains uninitialised byte(s)
+    ...
+    by 0x........: main (scalar.c:1158)
+ 
+-Syscall param timer_create(evp) points to unaddressable byte(s)
++Syscall param timer_create(evp.sigev_value) points to unaddressable byte(s)
++   ...
++   by 0x........: main (scalar.c:1158)
++ Address 0x........ is not stack'd, malloc'd or (recently) free'd
++
++Syscall param timer_create(evp.sigev_signo) points to unaddressable byte(s)
++   ...
++   by 0x........: main (scalar.c:1158)
++ Address 0x........ is not stack'd, malloc'd or (recently) free'd
++
++Syscall param timer_create(evp.sigev_notify) points to unaddressable byte(s)
+    ...
+    by 0x........: main (scalar.c:1158)
+  Address 0x........ is not stack'd, malloc'd or (recently) free'd
diff --git a/valgrind.spec b/valgrind.spec
index 42aa81a..48898e6 100644
--- a/valgrind.spec
+++ b/valgrind.spec
@@ -323,6 +323,9 @@ echo ===============END TESTING===============
 %endif
 
 %changelog
+* Mon Feb 24 2014 Mark Wielaard <mjw at redhat.com>
+- Add upstream fixes to valgrind-3.9.0-timer_create.patch
+
 * Fri Feb 21 2014 Mark Wielaard <mjw at redhat.com> - 3.9.0-7
 - Add valgrind-3.9.0-glibc-2.19.patch
 


More information about the scm-commits mailing list