Add upstream fixes to valgrind-3.9.0-timer_create.patch

This commit is contained in:
Mark Wielaard 2014-02-24 16:42:19 +01:00
parent 77a7a40fa3
commit 4714e5a725
2 changed files with 55 additions and 0 deletions

View File

@ -51,3 +51,55 @@ index 14bb8bf..a3c4b3c 100644
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// From elsewhere... // From elsewhere...
//---------------------------------------------------------------------- //----------------------------------------------------------------------
commit 763710cc391c5adc85712606bf9882f49ee43e7c
Author: mjw <mjw@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

View File

@ -323,6 +323,9 @@ echo ===============END TESTING===============
%endif %endif
%changelog %changelog
* Mon Feb 24 2014 Mark Wielaard <mjw@redhat.com>
- Add upstream fixes to valgrind-3.9.0-timer_create.patch
* Fri Feb 21 2014 Mark Wielaard <mjw@redhat.com> - 3.9.0-7 * Fri Feb 21 2014 Mark Wielaard <mjw@redhat.com> - 3.9.0-7
- Add valgrind-3.9.0-glibc-2.19.patch - Add valgrind-3.9.0-glibc-2.19.patch