diff --git a/valgrind-3.16.1-open-proc-self-exe.patch b/valgrind-3.16.1-open-proc-self-exe.patch index 7525f8a..343f759 100644 --- a/valgrind-3.16.1-open-proc-self-exe.patch +++ b/valgrind-3.16.1-open-proc-self-exe.patch @@ -69,3 +69,30 @@ index 7d4b385a3..3810f7474 100644 return; #endif // defined(VGO_linux) +diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c +index 52074149d..fcc534454 100644 +--- a/coregrind/m_syswrap/syswrap-linux.c ++++ b/coregrind/m_syswrap/syswrap-linux.c +@@ -5745,6 +5745,22 @@ PRE(sys_openat) + return; + } + ++ /* And for /proc/self/exe or /proc//exe case. */ ++ ++ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); ++ if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) ++ && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 ++ || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) { ++ 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; ++ } ++ + /* Otherwise handle normally */ + *flags |= SfMayBlock; + } diff --git a/valgrind.spec b/valgrind.spec index 957665f..8afdc29 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind Version: 3.16.1 -Release: 17%{?dist} +Release: 18%{?dist} Epoch: 1 License: GPLv2+ URL: http://www.valgrind.org/ @@ -528,6 +528,9 @@ fi %endif %changelog +* Sat Feb 6 2021 Mark Wielaard - 3.16.1-18 +- Update valgrind-3.16.1-open-proc-self-exe.patch to handle openat + * Sat Feb 6 2021 Mark Wielaard - 3.16.1-17 - Add valgrind-3.16.1-open-proc-self-exe.patch