3.16.1-17 - Add valgrind-3.16.1-open-proc-self-exe.patch
This commit is contained in:
parent
511be3b3d2
commit
4d61a87974
71
valgrind-3.16.1-open-proc-self-exe.patch
Normal file
71
valgrind-3.16.1-open-proc-self-exe.patch
Normal file
@ -0,0 +1,71 @@
|
||||
diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h
|
||||
index 4717abac6..c50b31399 100644
|
||||
--- a/coregrind/m_syswrap/priv_syswrap-generic.h
|
||||
+++ b/coregrind/m_syswrap/priv_syswrap-generic.h
|
||||
@@ -106,6 +106,10 @@ extern Bool
|
||||
ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename,
|
||||
int flags);
|
||||
|
||||
+extern Bool
|
||||
+ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename,
|
||||
+ int flags);
|
||||
+
|
||||
/* Helper function for generic mprotect and linux pkey_mprotect. */
|
||||
extern void handle_sys_mprotect (ThreadId tid, SyscallStatus *status,
|
||||
Addr *addr, SizeT *len, Int *prot);
|
||||
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
|
||||
index 7d4b385a3..3810f7474 100644
|
||||
--- a/coregrind/m_syswrap/syswrap-generic.c
|
||||
+++ b/coregrind/m_syswrap/syswrap-generic.c
|
||||
@@ -4078,6 +4078,38 @@ Bool ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename,
|
||||
}
|
||||
#endif // defined(VGO_linux) || defined(VGO_solaris)
|
||||
|
||||
+#if defined(VGO_linux)
|
||||
+Bool ML_(handle_self_exe_open)(SyscallStatus *status, const HChar *filename,
|
||||
+ int flags)
|
||||
+{
|
||||
+ HChar name[30]; // large enough for /proc/<int>/exe
|
||||
+
|
||||
+ if (!ML_(safe_to_deref)((const void *) filename, 1))
|
||||
+ return False;
|
||||
+
|
||||
+ /* Opening /proc/<pid>/exe or /proc/self/exe? */
|
||||
+ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
|
||||
+ if (!VG_STREQ(filename, name) && !VG_STREQ(filename, "/proc/self/exe"))
|
||||
+ return False;
|
||||
+
|
||||
+ /* Allow to open the file only for reading. */
|
||||
+ if (flags & (VKI_O_WRONLY | VKI_O_RDWR)) {
|
||||
+ SET_STATUS_Failure(VKI_EACCES);
|
||||
+ return True;
|
||||
+ }
|
||||
+
|
||||
+ SysRes sres = VG_(dup)(VG_(cl_exec_fd));
|
||||
+ SET_STATUS_from_SysRes(sres);
|
||||
+ if (!sr_isError(sres)) {
|
||||
+ OffT off = VG_(lseek)(sr_Res(sres), 0, VKI_SEEK_SET);
|
||||
+ if (off < 0)
|
||||
+ SET_STATUS_Failure(VKI_EMFILE);
|
||||
+ }
|
||||
+
|
||||
+ return True;
|
||||
+}
|
||||
+#endif // defined(VGO_linux)
|
||||
+
|
||||
PRE(sys_open)
|
||||
{
|
||||
if (ARG2 & VKI_O_CREAT) {
|
||||
@@ -4119,8 +4151,10 @@ PRE(sys_open)
|
||||
}
|
||||
}
|
||||
|
||||
- /* Handle also the case of /proc/self/auxv or /proc/<pid>/auxv. */
|
||||
- if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2))
|
||||
+ /* Handle also the case of /proc/self/auxv or /proc/<pid>/auxv
|
||||
+ or /proc/self/exe or /proc/<pid>/exe. */
|
||||
+ if (ML_(handle_auxv_open)(status, (const HChar *)(Addr)ARG1, ARG2)
|
||||
+ || ML_(handle_self_exe_open)(status, (const HChar *)(Addr)ARG1, ARG2))
|
||||
return;
|
||||
#endif // defined(VGO_linux)
|
||||
|
@ -3,7 +3,7 @@
|
||||
Summary: Tool for finding memory management bugs in programs
|
||||
Name: %{?scl_prefix}valgrind
|
||||
Version: 3.16.1
|
||||
Release: 16%{?dist}
|
||||
Release: 17%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
URL: http://www.valgrind.org/
|
||||
@ -147,6 +147,10 @@ Patch22: valgrind-3.16.1-dwarf5.patch
|
||||
# RHBZ#1909548 shmctl(IPC_STAT) doesn't set shm_nattch on aarch64
|
||||
Patch23: valgrind-3.16.0-shmctl.patch
|
||||
|
||||
# KDE#140178 open("/proc/self/exe", ...); doesn't quite work
|
||||
# RHBZ#1925786 valgrind appears to only interject readlink on /proc/self/exe
|
||||
Patch24: valgrind-3.16.1-open-proc-self-exe.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: glibc-devel
|
||||
|
||||
@ -299,6 +303,7 @@ Valgrind User Manual for details.
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
|
||||
%build
|
||||
# LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto
|
||||
@ -523,6 +528,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sat Feb 6 2021 Mark Wielaard <mjw@fedoraproject.org> - 3.16.1-17
|
||||
- Add valgrind-3.16.1-open-proc-self-exe.patch
|
||||
|
||||
* Wed Feb 3 2021 Mark Wielaard <mjw@fedoraproject.org> - 3.16.1-16
|
||||
- Add valgrind-3.16.0-shmctl.patch
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user