[PATCH 0/1] MR10925: ntdll: Avoid MAP_PRIVATE when recording with rr-debugger.
Followup of 07160a23fa2, 9e006e94c9c, 8fd49c4d8e9, d9d012965de. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58332 rr-debugger-Bug: https://github.com/rr-debugger/rr/issues/3972 Since above commits Wine uses for some mappings at Linux MAP_PRIVATE. Unfortunately this is not fully supported by rr, at least with the flags for the session mapping. And if I understood it correctly, adding support in rr would come with a general performance penalty. Probably we can use the fallback path of non-linux systems for rr, too? This patch should not change behaviour, except for session mapping when running below rr, which is detected by the environment `RUNNING_UNDER_RR`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10925
From: Bernhard Übelacker <bernhardu@mailbox.org> Followup of 07160a23fa2, 9e006e94c9c, 8fd49c4d8e9, d9d012965de. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58332 rr-debugger-Bug: https://github.com/rr-debugger/rr/issues/3972 --- dlls/ntdll/unix/virtual.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index a2ea5244b9f..62f143d6c4f 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2364,7 +2364,16 @@ static NTSTATUS map_file_into_view( struct file_view *view, int fd, size_t start /* changes to the file are not guaranteed to be visible in read-only MAP_PRIVATE mappings, * but they are on Linux so we take advantage of it */ #ifdef __linux__ - flags |= MAP_PRIVATE; + static int use_map_private = -1; + if (use_map_private == -1) + use_map_private = getenv("RUNNING_UNDER_RR") ? FALSE : TRUE; + if (vprot & SEC_FILE || use_map_private) + flags |= MAP_PRIVATE; + else + { + flags |= MAP_SHARED; + prot &= ~PROT_WRITE; + } #else flags |= MAP_SHARED; prot &= ~PROT_WRITE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10925
I don't think we want the mapping behavior to change when running inside a debugger, that can affect the application. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10925#note_142548
participants (3)
-
Alexandre Julliard (@julliard) -
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu)