3.13.0-28 - Add valgrind-3.13.0-utime.patch

This commit is contained in:
Mark Wielaard 2018-08-10 21:14:31 +02:00
parent a865c8858a
commit 7f4edd4554
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,47 @@
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 2336c29..0f8e07a 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -5277,8 +5277,25 @@ PRE(sys_utimensat)
int, dfd, char *, filename, struct timespec *, utimes, int, flags);
if (ARG2 != 0)
PRE_MEM_RASCIIZ( "utimensat(filename)", ARG2 );
- if (ARG3 != 0)
- PRE_MEM_READ( "utimensat(tvp)", ARG3, 2 * sizeof(struct vki_timespec) );
+ if (ARG3 != 0) {
+ /* If timespec.tv_nsec has the special value UTIME_NOW or UTIME_OMIT
+ then the tv_sec field is ignored. */
+ struct vki_timespec *times = (struct vki_timespec *)(Addr)ARG3;
+ PRE_MEM_READ( "utimensat(times[0].tv_nsec)",
+ (Addr)&times[0].tv_nsec, sizeof(times[0].tv_nsec));
+ PRE_MEM_READ( "utimensat(times[1].tv_nsec)",
+ (Addr)&times[1].tv_nsec, sizeof(times[1].tv_nsec));
+ if (ML_(safe_to_deref)(times, 2 * sizeof(struct vki_timespec))) {
+ if (times[0].tv_nsec != VKI_UTIME_NOW
+ && times[0].tv_nsec != VKI_UTIME_OMIT)
+ PRE_MEM_READ( "utimensat(times[0].tv_sec)",
+ (Addr)&times[0].tv_sec, sizeof(times[0].tv_sec));
+ if (times[1].tv_nsec != VKI_UTIME_NOW
+ && times[1].tv_nsec != VKI_UTIME_OMIT)
+ PRE_MEM_READ( "utimensat(times[1].tv_sec)",
+ (Addr)&times[1].tv_sec, sizeof(times[1].tv_sec));
+ }
+ }
}
PRE(sys_newfstatat)
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 7072080..bf0c1aa 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -283,6 +283,10 @@ struct vki_timespec {
long tv_nsec; /* nanoseconds */
};
+/* Special values for vki_timespec.tv_nsec when used with utimensat. */
+#define VKI_UTIME_NOW ((1l << 30) - 1l)
+#define VKI_UTIME_OMIT ((1l << 30) - 2l)
+
struct vki_timeval {
vki_time_t tv_sec; /* seconds */
vki_suseconds_t tv_usec; /* microseconds */

View File

@ -3,7 +3,7 @@
Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind
Version: 3.13.0
Release: 27%{?dist}
Release: 28%{?dist}
Epoch: 1
License: GPLv2+
URL: http://www.valgrind.org/
@ -195,6 +195,9 @@ Patch25: valgrind-3.13.0-x86-arch_prctl.patch
# bug fixes for xsmincdp, lxssp, stxssp and stxvl instructions.
Patch26: valgrind-3.13.0-ppc64-xsmaxcdp.patch
# KDE#397354 utimensat should ignore tv_sec for UTIME_NOW or UTIME_OMIT.
Patch27: valgrind-3.13.0-utime.patch
%if %{build_multilib}
# Ensure glibc{,-devel} is installed for both multilib arches
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -353,6 +356,7 @@ Valgrind User Manual for details.
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%build
CC=gcc
@ -587,6 +591,9 @@ fi
%endif
%changelog
* Fri Aug 10 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-28
- Add valgrind-3.13.0-utime.patch
* Fri Aug 3 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-27
- Add valgrind-3.13.0-ppc64-xsmaxcdp.patch