https://bugs.winehq.org/show_bug.cgi?id=39606
Bug ID: 39606 Summary: Infinite loop in StackWalk Product: Wine Version: 1.7.54 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: dbghelp Assignee: wine-bugs@winehq.org Reporter: ralf.habacker@freenet.de Distribution: ---
While working on x86_64 fixes of the dbus backtrace generator for windows https://bugs.freedesktop.org/show_bug.cgi?id=92721, I recognized an infinite loop while calling StackWalk on x86_64 systems.
start /home/ralf.habacker/src/dbus-2-cmake-cross-x86_64-build/bin/manual-backtrace.exe... Backtrace: 0 0xe3b17b7b in libpthread.so.0 1 wait_select_reply+0x49 [/usr/src/debug/wine-snapshot/dlls/ntdll/server.c:349] in ntdll 2 server_select+0x1f8 [/usr/src/debug/wine-snapshot/dlls/ntdll/server.c:614] in ntdll 3 wait_objects+0x7e [/usr/src/debug/wine-snapshot/dlls/ntdll/sync.c:1006] in ntdll 4 NtWaitForMultipleObjects+0x62 [/usr/src/debug/wine-snapshot/dlls/ntdll/sync.c:1017] in ntdll 5 0x7b887a8b in kernel32 6 WaitForSingleObject+0x26 [/usr/src/debug/wine-snapshot/dlls/kernel32/sync.c:127] in kernel32 7 dump_backtrace+0xa7 [/home/ralf.habacker/src/dbus-2/dbus/dbus-sysdeps-win.c:2553] in libdbus-1-3 8 _dbus_print_backtrace+0xd [/home/ralf.habacker/src/dbus-2/dbus/dbus-sysdeps-win.c:2563] in libdbus-1-3 9 test2+0x11 [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:34] in manual-backtrace 10 test1+0xd [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:39] in manual-backtrace 11 test+0xd [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:44] in manual-backtrace 12 main+0x4f [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:58] in manual-backtrace 13 0x4013ed in manual-backtrace 14 0x40152b in manual-backtrace 15 start_process+0x91 [/usr/src/debug/wine-snapshot/dlls/kernel32/process.c:1105] in kernel32 16 call_thread_func+0x6e [/usr/src/debug/wine-snapshot/dlls/ntdll/signal_x86_64.c:3675] in ntdll 17 RtlRaiseException+0x7e in ntdll 18 0xe32aa016 in ntdll 19 wine_call_on_stack+0x13 in libwine.so.1 20 wine_switch_to_stack+0x9 [/usr/src/debug/wine-snapshot/libs/wine/port.c:60] in libwine.so.1 21 LdrInitializeThunk+0x2a4 [/usr/src/debug/wine-snapshot/dlls/ntdll/loader.c:3094] in ntdll 22 __wine_kernel_init+0x941 [/usr/src/debug/wine-snapshot/dlls/kernel32/process.c:1276] in kernel32 23 __wine_process_init+0x154 [/usr/src/debug/wine-snapshot/dlls/ntdll/loader.c:3303] in ntdll 24 wine_init+0x2ce [/usr/src/debug/wine-snapshot/libs/wine/loader.c:961] in libwine.so.1 25 main+0x82 [/usr/src/debug/wine-snapshot/loader/main.c:248] in <wine-loader> 26 __libc_start_main+0xf5 in libc.so.6 27 _start+0x29 in <wine-loader> 28 _start+0x29 in <wine-loader> 29 _start+0x29 in <wine-loader> 30 _start+0x29 in <wine-loader> 31 _start+0x29 in <wine-loader> 32 _start+0x29 in <wine-loader> ....
https://bugs.winehq.org/show_bug.cgi?id=39606
--- Comment #1 from Ralf Habacker ralf.habacker@freenet.de --- It may be for interest that the same backtrace on x86 looks like this:
Backtrace: 0 __kernel_vsyscall+0xe in [vdso].so 1 0xf751702b in libpthread.so.0 2 0x7bc81c28 in ntdll 3 0x7bc83293 in ntdll 4 0x7bc8aa4a in ntdll 5 NtWaitForMultipleObjects+0x2a in ntdll 6 InterlockedDecrement+0x146 in kernel32 7 WaitForMultipleObjectsEx+0x60 in kernel32 8 WaitForSingleObject+0x44 in kernel32 9 dump_backtrace+0xa6 [/home/ralf.habacker/src/dbus-2/dbus/dbus-sysdeps-win.c:2551] in libdbus-1-3 10 _dbus_print_backtrace+0xb [/home/ralf.habacker/src/dbus-2/dbus/dbus-sysdeps-win.c:2562] in libdbus-1-3 11 test2+0xd [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:34] in manual-backtrace 12 test1+0xb [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:39] in manual-backtrace 13 test+0xb [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:44] in manual-backtrace 14 main+0x48 [/home/ralf.habacker/src/dbus-2/test/manual-backtrace.c:58] in manual-backtrace 15 0x4013e2 in manual-backtrace 16 call_process_entry+0xc in kernel32 17 0x7b865023 in kernel32 18 call_thread_func_wrapper+0xc in ntdll 19 call_thread_func+0x7d in ntdll 20 RtlRaiseException+0x22 in ntdll 21 call_dll_entry_point+0x3fe in ntdll 22 wine_call_on_stack+0x1d in libwine.so.1 23 wine_switch_to_stack+0x2b [/usr/src/debug/wine-snapshot/libs/wine/port.c:60] in libwine.so.1 24 LdrInitializeThunk+0x239 in ntdll 25 __wine_kernel_init+0xa13 in kernel32 26 __wine_process_init+0x193 in ntdll 27 wine_init+0x2c8 [/usr/src/debug/wine-snapshot/libs/wine/loader.c:961] in libwine.so.1 28 main+0x8c in <wine-loader> 29 __libc_start_main+0xf3 in libc.so.6
It starts with
Backtrace: 0 __kernel_vsyscall+0xe in [vdso].so 1 0xf751702b in libpthread.so.0
and ends with
28 main+0x8c in <wine-loader> 29 __libc_start_main+0xf3 in libc.so.6
while the x86_64 backtrace starts at
Backtrace: 0 0xe3b17b7b in libpthread.so.0
and goes beyond the x86 end
26 __libc_start_main+0xf5 in libc.so.6 27 _start+0x29 in <wine-loader> ...
https://bugs.winehq.org/show_bug.cgi?id=39606
--- Comment #2 from Ralf Habacker ralf.habacker@freenet.de --- Created attachment 52777 --> https://bugs.winehq.org/attachment.cgi?id=52777 testcase binary
https://bugs.winehq.org/show_bug.cgi?id=39606
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase
https://bugs.winehq.org/show_bug.cgi?id=39606
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=39606
--- Comment #3 from Ralf Habacker ralf.habacker@freenet.de --- Created attachment 52906 --> https://bugs.winehq.org/attachment.cgi?id=52906 trace log (32bit)
Generated with WINEDEBUG=trace+dbghelp
https://bugs.winehq.org/show_bug.cgi?id=39606
--- Comment #4 from Ralf Habacker ralf.habacker@freenet.de --- Created attachment 52907 --> https://bugs.winehq.org/attachment.cgi?id=52907 trace log (64bit)
generated with WINEDEBUG=trace+dbghelp
https://bugs.winehq.org/show_bug.cgi?id=39606
--- Comment #5 from Ralf Habacker ralf.habacker@freenet.de --- Comparing both trace logs
32bit trace trace:dbghelp:i386_stack_walk Enter: PC=flat<7bf00ebc> Frame=flat<ffdd2b18> Return=flat<f73be9d3> Stack=flat<ffdd26d0> Mode=32bit Count=1d cSwitch=(nil) nSwitch=(nil) trace:dbghelp:i386_stack_walk Leave: PC=flat<f73be9d3> Frame=flat<0> Return=flat<7bf010c9> Stack=flat<ffdd2b20> Mode=32bit Count=1e cSwitch=(nil) nSwitch=(nil) FuncTable=(nil) trace:dbghelp:i386_stack_walk Enter: PC=flat<f73be9d3> Frame=flat<0> Return=flat<7bf010c9> Stack=flat<ffdd2b20> Mode=32bit Count=1e cSwitch=(nil) nSwitch=(nil) -> end
64 bit trace trace:dbghelp:x86_64_stack_walk Enter: PC=flat<7bf00df2> Frame=flat<7ffd162c87a8> Return=flat<7ff449a98be5> Stack=flat<7ffd162c82a0> Mode=64bit Count=1a trace:dbghelp:x86_64_stack_walk Leave: PC=flat<7ff449a98be5> Frame=flat<0> Return=flat<7bf00eed> Stack=flat<7ffd162c86d0> Mode=64bit Count=1b FuncTable=(nil) ... trace:dbghelp:x86_64_stack_walk Enter: PC=flat<7ff449a98be5> Frame=flat<0> Return=flat<7bf00eed> Stack=flat<7ffd162c86d0> Mode=64bit Count=1b trace:dbghelp:x86_64_stack_walk Leave: PC=flat<7bf00eed> Frame=flat<0> Return=flat<7bf00eed> Stack=flat<7ffd162c8790> Mode=64bit Count=1c FuncTable=(nil) ... trace:dbghelp:x86_64_stack_walk Enter: PC=flat<7ff449a98be5> Frame=flat<0> Return=flat<7bf00eed> Stack=flat<7ffd162c86d0> Mode=64bit Count=1c trace:dbghelp:x86_64_stack_walk Leave: PC=flat<7bf00eed> Frame=flat<0> Return=flat<7bf00eed> Stack=flat<7ffd162c8790> Mode=64bit Count=1c FuncTable=(nil) ...
indicates that StackWalk64 does not detect on enter the case "Frame=flat<0>".
https://bugs.winehq.org/show_bug.cgi?id=39606
Ralf Habacker ralf.habacker@freenet.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Infinite loop in StackWalk |Infinite loop in | |StackWalk64
https://bugs.winehq.org/show_bug.cgi?id=39606
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=39606
Ralf Habacker ralf.habacker@freenet.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #6 from Ralf Habacker ralf.habacker@freenet.de --- The issue could not be reproduced with wine 3.21:
$ wine --version wine-3.21
$ WINEPREFIX=~/.wine64/ wine64 manual-backtrace.exe Backtrace: 0 0x9e9d2e2b in libpthread.so.0 1 0x7bc92a29 in ntdll 2 0x7bc93e98 in ntdll 3 0x7bca11be in ntdll 4 NtWaitForMultipleObjects+0x62 in ntdll 5 0x7b48f202 in kernel32 6 WaitForSingleObject+0x26 in kernel32 7 dump_backtrace+0xa7 [/home/xxx/src/dbus-2/dbus/dbus-sysdeps-win.c:2552] in libdbus-1-3 8 _dbus_print_backtrace+0xd [/home/xxx/src/dbus-2/dbus/dbus-sysdeps-win.c:2562] in libdbus-1-3 9 test2+0x11 [/home/xxx/src/dbus-2/test/manual-backtrace.c:34] in manual-backtrace 10 test1+0xd [/home/xxx/src/dbus-2/test/manual-backtrace.c:39] in manual-backtrace 11 test+0xd [/home/xxx/src/dbus-2/test/manual-backtrace.c:44] in manual-backtrace 12 main+0x4f [/home/xxx/src/dbus-2/test/manual-backtrace.c:58] in manual-backtrace 13 0x4013ed in manual-backtrace 14 0x40152b in manual-backtrace 15 0x7b47b1f0 in kernel32
It seems to be fixed in the meantime.
https://bugs.winehq.org/show_bug.cgi?id=39606
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.4.