http://bugs.winehq.org/show_bug.cgi?id=58332
Bug ID: 58332 Summary: ntdll: Session shared memory gets mapped with MAP_PRIVATE, which causes rr-debugger to fail. Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: bernhardu@mailbox.org Distribution: ---
Debugging Wine with rr-debugger allows to record whole wine process trees, and debug later different processes, e.g. wineserver and the .exe process, debug early startup or exception code, debug in reverse and multiple times.
Therefore I asked for inclusion of [1] "spurious short writes", which got accepted at 2025-04-25. Thank you very much for it.
Unfortunately short after it I found there is still an issue, which was a few months not there.
So I started bisecting and arrived at [2] d9d012965de, "ntdll: Always map files as writable and adjust permissions.", committed at 2025-03-25. Unfortuntately this can not be cleanly reverted at current git, but with three more commits reverted it makes a wine tree, which can be used with rr-debugger [2].
I could reduce the changes of this 4 commits to a few lines which, are also able to produce a wine tree usable with rr-debugger [3].
This patch is only changing behaviour once for each .exe process, when the session shared memory gets mapped in via the fd received from wineserver.
With unmodified Wine this is currently done with a MAP_PRIVATE flag, which turns out is currently just mapping the file content into the process, but does not receive the updates from wineserver.
To investigate if this can be fixed in rr I opened [4]. Unfortunately this would be expected to create a overall slowdown for rr.
Therefore I wonder if this change was intentional, to map the session shared memory with mmap(MAP_PRIVATE)? When looking at virtual_map_user_shared_data the shared memory gets mapped with mmap(MAP_SHARED).
Would something like [3] be acceptable for inclusion?
Kind regards, Bernhard
[1] https://gitlab.winehq.org/wine/wine/-/commit/cd197f8588b
[2] https://gitlab.winehq.org/wine/wine/-/commit/07160a23fa2 https://gitlab.winehq.org/wine/wine/-/commit/9e006e94c9c https://gitlab.winehq.org/wine/wine/-/commit/8fd49c4d8e9 https://gitlab.winehq.org/wine/wine/-/commit/d9d012965de
[3] https://gitlab.winehq.org/bernhardu/wine/-/commit/658e56801a7
[4] https://github.com/rr-debugger/rr/issues/3972
http://bugs.winehq.org/show_bug.cgi?id=58332
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |Debian Version|unspecified |10.4 Keywords| |source