native shared library crashes if C++ exceptions are used on Ubuntu 20.04 Wine64 build

Bug #1881293 reported by Marko Klopcic
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
wine (Ubuntu)
New
Undecided
Unassigned

Bug Description

This problem appears only on Ubuntu 20.04 with Wine 5.0 installed from Ubuntu repository. If I build Wine 5.0 myself or install Wine 4.0.4 from WineHQ repository, then there is no problem, so I assume the problem is in Ubuntu 20.04 build of Wine.

I have written a shared library for our application using Winelib project, which calls native Linux API. C++ is used. Crash happens on first C++ exception thrown.
App which shows the problem:

    #include <stdexcept>
    #include <stdio.h>

    int main() {
        printf("start\n");
        try {
            throw std::runtime_error("desc");
        } catch (std::exception &ex) {
            printf("in catch\n");
        }
        printf("end\n");
    }

built with:

    g++ -c -fPIC t.cpp
    ../wine-git_64/tools/winegcc/wineg++ -m64 -B../wine-git_64/tools/winebuild -L ../wine-git_64/dlls/kernel32/ -L ../wine-git_64/dlls/advapi32/ -L ../wine-git_64/dlls/user32/ -L ../wine-git_64/dlls/winecrt0 -L ../wine-git_64/dlls/ntdll/ -L ../wine-git_64/libs/wine -o tt t.o

where '../wine-git_64/' is directory where I cloned and built Wine64 5.0 stable to get wineg++ linker.
Run the application as:

   wine tt.exe.so

It prints 'start', then it crashes. The application crashes in Wine (Wine dialog pops-up), so I think Ubuntu is not aware of this crash. Contents of Wine crash dialog (backtrace.txt):

Unhandled exception: assertion failed, invalid program stack in 64-bit code (0x00007fa3b70d118b).
Register dump:
 rip:00007fa3b70d118b rsp:000000000022f1f0 rbp:000000007da59a00 eflags:00000246 ( - -- I Z- -P- )
 rax:0000000000000000 rbx:00007fa3b7083b80 rcx:00007fa3b70d118b rdx:0000000000000000
 rsi:000000000022f1f0 rdi:0000000000000002 r8:0000000000000000 r9:000000000022f1f0 r10:0000000000000008
 r11:0000000000000246 r12:000000000022f450 r13:0000000000000001 r14:0000000000000000 r15:0000000000000004
Stack dump:
0x000000000022f1f0: 0000000000000000 00007fa3b6f0db45
0x000000000022f200: 0000000000000000 00007fa3b6f0db45
0x000000000022f210: 0000000000000000 000000000022f370
0x000000000022f220: 00007fa3b646a2d4 00007fa3b6f0eae1
0x000000000022f230: 00007fa3b6f11cac 00007fa3b6f0eae1
0x000000000022f240: 00007fa3b6473608 0000000000001265
0x000000000022f250: 0000000000000049 00000000000000d1
0x000000000022f260: 000000000000038b 0000000000000000
0x000000000022f270: fffffffe7fffffff ffffffffffffffff
0x000000000022f280: ffffffffffffffff ffffffffffffffff
0x000000000022f290: ffffffffffffffff ffffffffffffffff
0x000000000022f2a0: ffffffffffffffff ffffffffffffffff
Backtrace:
=>0 0x00007fa3b70d118b execlp+0xffffffffffffffff() in libc.so.6 (0x000000007da59a00)
  1 0x00007fa3b70b0859 execlp+0xffffffffffffffff() in libc.so.6 (0x000000007da59a00)
  2 0x00007fa3b6eff667 __floattisf+0xffffffffffffffff() in libgcc_s.so.1 (0x000000007da59a00)
  3 0x00007fa3b6f0d281 __extendsftf2+0x5590() in libgcc_s.so.1 (0x000000000022f9b0)
0x00007fa3b70d118b execlp+0xffffffffffffffff in libc.so.6: movq 0x0000000000000108(%rsp),%rax
Modules:
Module Address Debug info Name (21 modules)
ELF 7b000000- 7b0e2000 Deferred kernelbase<elf>
  \-PE 7b010000- 7b0e2000 \ kernelbase
ELF 7b400000- 7b68b000 Deferred kernel32<elf>
  \-PE 7b420000- 7b68b000 \ kernel32
ELF 7bc00000- 7befb000 Deferred ntdll<elf>
  \-PE 7bc20000- 7befb000 \ ntdll
ELF 7c000000- 7c005000 Deferred <wine-loader>
ELF 7fa3b6182000- 7fa3b61b2000 Deferred libtinfo.so.6
ELF 7fa3b61b2000- 7fa3b61db000 Deferred libncurses.so.6
ELF 7fa3b64d8000- 7fa3b64ec000 Deferred libnss_files.so.2
ELF 7fa3b6ed5000- 7fa3b6efc000 Deferred liblzma.so.5
ELF 7fa3b6efc000- 7fa3b6f17000 Dwarf libgcc_s.so.1
ELF 7fa3b6f17000- 7fa3b7066000 Deferred libm.so.6
ELF 7fa3b7066000- 7fa3b7083000 Deferred libunwind.so.8
ELF 7fa3b7085000- 7fa3b708b000 Deferred libdl.so.2
ELF 7fa3b708b000- 7fa3b727d000 Dwarf libc.so.6
ELF 7fa3b727d000- 7fa3b72a0000 Deferred libpthread.so.0
ELF 7fa3b72a6000- 7fa3b72bc000 Deferred tt<elf>
  \-PE 7fa3b72b0000- 7fa3b72bc000 \ tt
ELF 7fa3b72bc000- 7fa3b745f000 Dwarf libwine.so.1
ELF 7fa3b7461000- 7fa3b7491000 Deferred ld-linux-x86-64.so.2
Threads:
process tid prio (all id:s are in hex)
0000000e services.exe
 00000023 0
 0000001a 0
 00000013 0
 00000010 0
 0000000f 0
00000011 plugplay.exe
 00000017 0
 00000016 0
 00000012 0
00000018 winedevice.exe
 00000020 0
 0000001d 0
 0000001c 0
 0000001b 0
 00000019 0
0000001e explorer.exe
 00000029 0
 00000028 0
 00000027 0
 0000001f 0
00000021 winedevice.exe
 00000026 0
 00000025 0
 00000024 0
 00000022 0
00000039 (D) Z:\home\markok\tmp\tt.exe
 0000003a 0 <==
System information:
    Wine build: wine-5.0 (Ubuntu 5.0-3ubuntu1)
    Platform: x86_64
    Version: Windows 7
    Host system: Linux
    Host version: 5.4.0-33-generic
==========================================

Output in console:

start
wine: Assertion failed at address 00007FA3B70D118B (thread 003a), starting debugger...
003a:err:seh:call_stack_handlers invalid frame 7fa3b72b821b (0x132000-0x230000)

summary: - native shared library crashes if C++ exceptions are used on Ubuntu 20.05
+ native shared library crashes if C++ exceptions are used on Ubuntu 20.04
Wine64 build
Revision history for this message
Marko Klopcic (markok3-14) wrote :

Maybe the problem is in versions of libgcc used for build and the one distributed with Ubuntu.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.