]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin mmap: use ARG5 for VG_(di_notify_mmap)
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 23 Dec 2025 20:22:17 +0000 (21:22 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 23 Dec 2025 20:22:17 +0000 (21:22 +0100)
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.

coregrind/m_syswrap/syswrap-darwin.c

index 25ac11eac3888bcd342db3f5734629f1379882a7..1fa1de5429b5ac09fb6c22eba38207ad48a0c444 100644 (file)
@@ -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);
    }
 }