From: Paul Floyd Date: Tue, 23 Dec 2025 20:22:17 +0000 (+0100) Subject: Darwin mmap: use ARG5 for VG_(di_notify_mmap) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49c4a70bb2f67c5bdc1268843c9ff70eff747779;p=thirdparty%2Fvalgrind.git Darwin mmap: use ARG5 for VG_(di_notify_mmap) The fix for bug280965 (a long long time ago) changed VG_(di_notify_mmap) so that instead of opening a new fd to peek at the ELF header it would reuse the same mmap fd with pread() to avoid resetting fcntl flags. Except that the patch was applied to mmap in syswrap-generic but not to the mmap in syswrap-darwin. So the problem remained there on Darwin for 14 years. --- diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 25ac11eac..1fa1de542 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -4682,7 +4682,7 @@ POST(mmap) ML_(notify_core_and_tool_of_mmap)(RES, ARG2, ARG3, ARG4, ARG5, ARG6); // Try to load symbols from the region VG_(di_notify_mmap)( (Addr)RES, False/*allow_SkFileV*/, - -1/*don't use_fd*/ ); + ARG5 ); ML_(sync_mappings)("after", "mmap", 0); } }