Bug 388174 - valgrind with Wine quits with "Assertion 'cfsi_fits' failed"
Summary: valgrind with Wine quits with "Assertion 'cfsi_fits' failed"
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.13.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Josef Weidendorfer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-23 15:05 UTC by Konstantin Kharlamov
Modified: 2018-08-17 07:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
The output of valgrind --trace-children=yes -v -v -v -d -d -d wine ./a.exe (1.97 MB, text/plain)
2017-12-23 15:05 UTC, Konstantin Kharlamov
Details
valgrind --trace-children=yes --trace-symtab=yes --trace-symtab-patt=ntdll --trace-cfi=yes -v -v -v -d -d -d wine ./a.exe &>2 (66.61 KB, application/gzip)
2017-12-24 12:47 UTC, Konstantin Kharlamov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kharlamov 2017-12-23 15:05:07 UTC
Created attachment 109493 [details]
The output of valgrind --trace-children=yes -v -v -v -d -d -d wine ./a.exe

Steps to reproduce in terms of terminal commands:

    $ cat test2.cpp
    #include <cstdio>
    
    int main() {
        puts("hello!");
    }
    $ x86_64-w64-mingw32-g++ test2.cpp -o a.exe -Wall -Wextra -g3 -O3
    $ valgrind --trace-children=yes wine ./a.exe
    ==19314== Memcheck, a memory error detector
    ==19314== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==19314== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==19314== Command: wine ./a.exe
    ==19314== 
    ==19314== Memcheck, a memory error detector
    ==19314== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==19314== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==19314== Command: /usr/bin/wine-preloader /usr/bin/wine ./a.exe
    ==19314== 
    preloader: Warning: failed to reserve range 00110000-68000000
    preloader: Warning: failed to reserve range 7f000000-82000000
    ==19314== Warning: set address range perms: large range [0x8049000, 0x47669000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x47669000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x27b59000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x27b59000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x9faf0000, 0xbf600000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x47669000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x47669000) (noaccess)
    ==19314== Warning: set address range perms: large range [0xbf600000, 0xdf110000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x27b59000) (noaccess)
    ==19314== Warning: set address range perms: large range [0x8049000, 0x27b59000) (noaccess)
    
    valgrind: m_debuginfo/debuginfo.c:551 (check_CFSI_related_invariants): Assertion 'cfsi_fits' failed.
    
    host stacktrace:
    ==19314==    at 0x5803A708: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x5803A83D: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x5803A937: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x5806FDEA: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x5809D366: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x580D8ADA: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x58099856: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x58095D7D: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x58097716: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    ==19314==    by 0x580A884A: ??? (in /usr/lib/valgrind/memcheck-x86-linux)
    
    sched status:
      running_tid=1
    
    Thread 1: status = VgTs_Runnable (lwpid 19314)
    ==19314==    at 0x401A480: mmap (in /usr/lib32/ld-2.26.so)
    ==19314==    by 0x4005F5D: _dl_map_object_from_fd (in /usr/lib32/ld-2.26.so)
    ==19314==    by 0x4008838: _dl_map_object (in /usr/lib32/ld-2.26.so)
    ==19314==    by 0x40138F4: dl_open_worker (in /usr/lib32/ld-2.26.so)
    ==19314==    by 0x4363114: _dl_catch_error (in /usr/lib32/libc-2.26.so)
    ==19314==    by 0x40133F8: _dl_open (in /usr/lib32/ld-2.26.so)
    ==19314==    by 0x4468C64: ??? (in /usr/lib32/libdl-2.26.so)
    ==19314==    by 0x4363114: _dl_catch_error (in /usr/lib32/libc-2.26.so)
    ==19314==    by 0x446936D: ??? (in /usr/lib32/libdl-2.26.so)
    ==19314==    by 0x4468CED: dlopen (in /usr/lib32/libdl-2.26.so)
    ==19314==    by 0x404B014: wine_init (in /usr/lib32/libwine.so.1.0)
    ==19314==    by 0x7C000CDD: main (in /usr/bin/wine)
    
    
    Note: see also the FAQ in the source distribution.
    It contains workarounds to several common problems.
    In particular, if Valgrind aborted or crashed after
    identifying problems in your program, there's a good chance
    that fixing those problems will prevent Valgrind aborting or
    crashing, especially if it happened in m_mallocfree.c.
    
    If that doesn't help, please report this bug to: www.valgrind.org
    
    In the bug report, send all the above text, the valgrind
    version, and what OS and version you are using.  Thanks.

Output of running with -vvv -ddd is too big, so attaching.
Comment 1 Philippe Waroquiers 2017-12-24 12:22:35 UTC
It looks like the problem is related to the debug info of
--20370-- Reading syms from /usr/lib32/wine/ntdll.dll.so

Can you run again with
   --trace-symtab=yes --trace-symtab-patt=ntdll --trace-cfi=yes -v -v -v -d -d -d 
and compress+attach the resulting trace ?

Thanks
Comment 2 Konstantin Kharlamov 2017-12-24 12:47:16 UTC
Created attachment 109501 [details]
valgrind --trace-children=yes --trace-symtab=yes --trace-symtab-patt=ntdll --trace-cfi=yes -v -v -v -d -d -d wine ./a.exe &>2

Sure, I just however found that the bug is not reproducible without --trace-children=yes, i.e. it works without it. So I added the option.
Comment 3 Julian Seward 2018-08-06 07:33:09 UTC
There have been a number of fixes to debuginfo reading in the git trunk
version recently.  Can you try again with that, and see if this still
happens?
Comment 4 Konstantin Kharlamov 2018-08-09 12:25:08 UTC
(In reply to Julian Seward from comment #3)
> There have been a number of fixes to debuginfo reading in the git trunk
> version recently.  Can you try again with that, and see if this still
> happens?

Sorry for delay. Yeah, I just tested with git version, and it fails the same way.
Comment 5 Julian Seward 2018-08-17 07:33:42 UTC
I just pushed another fix, b3fc500a9f881b31fd178d15b604d890fed7cf96,
which I think should fix this.  Please reopen if it is still broken for you.