Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/valgrind.git#694bfef4aa9f24859dcf6c1c4a6b68c9a242ddf0
This commit is contained in:
DistroBaker 2021-02-07 02:44:47 +00:00
parent 13964be68c
commit 46ceca4835
2 changed files with 31 additions and 1 deletions

View File

@ -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/<pid>/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;
}

View File

@ -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 <mjw@fedoraproject.org> - 3.16.1-18
- Update valgrind-3.16.1-open-proc-self-exe.patch to handle openat
* Sat Feb 6 2021 Mark Wielaard <mjw@fedoraproject.org> - 3.16.1-17
- Add valgrind-3.16.1-open-proc-self-exe.patch