To reproduce:
- `unshare -Upf ./wine cmd`
- (in another terminal) `unshare -Upf ./wine not-a-command`
The first terminal will now go completely unresponsive, until you kill -9 the relevant start.exe from the second terminal.
Root cause analysis: In the first Wine, wineserver gets Unix pid 3 in its namespace. (And a different pid in the root namespace, but no relevant process sees that.)
In the second Wine, cmd.exe gets Unix pid 3 in its namespace, and sends it to wineserver.
When the second cmd exits, wineserver checks if pid 3 did indeed exit, and SIGKILLs it if not. But since that pid is from wrong namespace, wineserver ends up killing itself instead.
While this only happens in badly configured sandboxes, such things do exist in the wild. https://github.com/flathub/org.winehq.Wine/issues/41
The real solution would be either fixing the sandbox config, or making Wine use pidfds instead of pids, but former is out of our control, and latter would be a lot of effort and ifdefs.
The second commit only blocks cases where wineserver exists in ntdll's namespace, but not the other way round. It's a much rarer case than having the processes in mutually-inaccessible sibling namespaces, it's a much bigger patch than the ntdll side, and the error is detected at wrong side (meaning it can't print a friendly error). I'm not sure if it's worth keeping.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9553
If this realloc is reached and cur is zero, the realloc is called
with a size of zero, which behaves like a free.
And returns NULL, because of which the `fail:` label is reached,
where the memory, strs is still pointing to, is freed the second time.
I did not notice any difference in the tests when `enumerate_strings` is left via the `fail:` label or via the return. I am assuming the case when cur is zero is not intended to reach the `fail:` label.
[This is a testbot run with this patch](https://testbot.winehq.org/JobDetails.pl?Key=161003)
[ASan details from gitlab](https://gitlab.winehq.org/bernhardu/wine/-/jobs/210107#L2772)
<details>
<summary>ASan details</summary>
```
=================================================================
==392==ERROR: AddressSanitizer: attempting double-free on 0x7fa7ca514900 in thread T0:
#0 0x6ffffe8cd721 in free /home/runner/work/llvm-mingw/llvm-mingw/llvm-project/compiler-rt\lib/asan/asan_malloc_win.cpp:71:3
#1 0x6ffffba8fa24 in enumerate_strings .../wine/dlls/shell32/autocomplete.c:245
#2 0x6ffffba8ea26 in autocomplete_text .../wine/dlls/shell32/autocomplete.c:637
#3 0x6ffffba8cf86 in ACEditSubclassProc .../wine/dlls/shell32/autocomplete.c:796
#4 0x6ffffd4a8bb0 in WINPROC_wrapper .../wine/dlls/user32/winproc.c:86
#5 0x6ffffd4a775c in call_window_proc .../wine/dlls/user32/winproc.c:111
#6 0x6ffffd4a78be in dispatch_win_proc_params .../wine/dlls/user32/winproc.c
#7 0x6ffffd492022 in dispatch_send_message .../wine/dlls/user32/message.c:568
#8 0x6ffffd491fa6 in SendMessageW .../wine/dlls/user32/message.c:587
#9 0x0001400107b9 in test_string_enumerator .../wine/dlls/shell32/tests/autocomplete.c:731
#10 0x00014000cb22 in test_custom_source .../wine/dlls/shell32/tests/autocomplete.c:904
#11 0x00014000a6bf in func_autocomplete .../wine/dlls/shell32/tests/autocomplete.c:938
#12 0x0001400d6c62 in run_test .../wine/include/wine/test.h:780
#13 0x0001400d666b in main .../wine/include/wine/test.h:900
#14 0x0001400d88fa in mainCRTStartup .../wine/dlls/msvcrt/crt_main.c:62
#15 0x6fffffc67a54 in BaseThreadInitThunk (C:\windows\system32\kernel32.dll+0x178027a54)
#16 0x6fffffde06e6 in signal_start_thread (C:\windows\system32\ntdll.dll+0x1700506e6)
0x7fa7ca514900 is located 0 bytes inside of 8192-byte region [0x7fa7ca514900,0x7fa7ca516900)
freed by thread T0 here:
#0 0x6ffffe8cda76 in realloc /home/runner/work/llvm-mingw/llvm-mingw/llvm-project/compiler-rt\lib/asan/asan_malloc_win.cpp:110:3
#1 0x6ffffba8f964 in enumerate_strings .../wine/dlls/shell32/autocomplete.c:231
#2 0x6ffffba8ea26 in autocomplete_text .../wine/dlls/shell32/autocomplete.c:637
#3 0x6ffffba8cf86 in ACEditSubclassProc .../wine/dlls/shell32/autocomplete.c:796
#4 0x6ffffd4a8bb0 in WINPROC_wrapper .../wine/dlls/user32/winproc.c:86
#5 0x6ffffd4a775c in call_window_proc .../wine/dlls/user32/winproc.c:111
#6 0x6ffffd4a78be in dispatch_win_proc_params .../wine/dlls/user32/winproc.c
#7 0x6ffffd492022 in dispatch_send_message .../wine/dlls/user32/message.c:568
#8 0x6ffffd491fa6 in SendMessageW .../wine/dlls/user32/message.c:587
#9 0x0001400107b9 in test_string_enumerator .../wine/dlls/shell32/tests/autocomplete.c:731
#10 0x00014000cb22 in test_custom_source .../wine/dlls/shell32/tests/autocomplete.c:904
#11 0x00014000a6bf in func_autocomplete .../wine/dlls/shell32/tests/autocomplete.c:938
#12 0x0001400d6c62 in run_test .../wine/include/wine/test.h:780
#13 0x0001400d666b in main .../wine/include/wine/test.h:900
#14 0x0001400d88fa in mainCRTStartup .../wine/dlls/msvcrt/crt_main.c:62
#15 0x6fffffc67a54 in BaseThreadInitThunk (C:\windows\system32\kernel32.dll+0x178027a54)
#16 0x6fffffde06e6 in signal_start_thread (C:\windows\system32\ntdll.dll+0x1700506e6)
previously allocated by thread T0 here:
#0 0x6ffffe8cda76 in realloc /home/runner/work/llvm-mingw/llvm-mingw/llvm-project/compiler-rt\lib/asan/asan_malloc_win.cpp:110:3
#1 0x6ffffba8f8ee in enumerate_strings .../wine/dlls/shell32/autocomplete.c:212
#2 0x6ffffba8ea26 in autocomplete_text .../wine/dlls/shell32/autocomplete.c:637
#3 0x6ffffba8cf86 in ACEditSubclassProc .../wine/dlls/shell32/autocomplete.c:796
#4 0x6ffffd4a8bb0 in WINPROC_wrapper .../wine/dlls/user32/winproc.c:86
#5 0x6ffffd4a775c in call_window_proc .../wine/dlls/user32/winproc.c:111
#6 0x6ffffd4a78be in dispatch_win_proc_params .../wine/dlls/user32/winproc.c
#7 0x6ffffd492022 in dispatch_send_message .../wine/dlls/user32/message.c:568
#8 0x6ffffd491fa6 in SendMessageW .../wine/dlls/user32/message.c:587
#9 0x0001400107b9 in test_string_enumerator .../wine/dlls/shell32/tests/autocomplete.c:731
#10 0x00014000cb22 in test_custom_source .../wine/dlls/shell32/tests/autocomplete.c:904
#11 0x00014000a6bf in func_autocomplete .../wine/dlls/shell32/tests/autocomplete.c:938
#12 0x0001400d6c62 in run_test .../wine/include/wine/test.h:780
#13 0x0001400d666b in main .../wine/include/wine/test.h:900
#14 0x0001400d88fa in mainCRTStartup .../wine/dlls/msvcrt/crt_main.c:62
#15 0x6fffffc67a54 in BaseThreadInitThunk (C:\windows\system32\kernel32.dll+0x178027a54)
#16 0x6fffffde06e6 in signal_start_thread (C:\windows\system32\ntdll.dll+0x1700506e6)
```
</details>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9551
Simplified this a bit, got rid of having to store list of GeckoBrowsers, now just iterating through the window map we already have to possibly dispatch minimize events. I thought of some ways to try simplify or get rid the refcounting for the hook, but couldn't figure out something better, if you have any ideas let me know.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5861#note_123288
Current code attempts to copy a file to itself. File is not actually copied; instead, a file sharing error is received. This result is ugly and differs from native. Behavior now appears to be the same as native with changes in this MR .
--
v14: xcopy: Don't attempt to copy a file to itself.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9112
Signed-off-by: Bernhard Kölbl <bkoelbl(a)codeweavers.com>
--
v2: dwrite: Add an alternative name for the Noto Sans Symbols font.
dwrite: Add the Supplemental Arrows-C range to the fallback data.
dwrite: Add the Cyrillic range to the fallback data.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9550