On 1/14/06, <b class="gmail_sendername">James Trotter</b> &lt;<a href="mailto:james.trotter@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">james.trotter@gmail.com</a>&gt; wrote:<div><span class="gmail_quote">
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><span><span class="gmail_quote"></span>On 1/14/06, <b class="gmail_sendername">Robert Shearman</b> &lt;<a href="mailto:rob@codeweavers.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rob@codeweavers.com
</a>&gt; wrote:<div><span><div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Dan Kegel wrote:<br><br>&gt;Rob wrote:<br>&gt;<br>&gt;<br>&gt;&gt;This very much looks like a use-after-free bug. The first two<br>&gt;&gt;instructions are probably a COM *_Release call. Judging by the fact that<br>&gt;&gt;this is a regression I would also guess that it is a Wine object.
<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt;This sounds like a job for valgrind!<br>&gt;<br>&gt;But, er, does valgrind still work with wine?&nbsp;&nbsp;Rob said it did in March:<br>&gt;<a href="http://www.winehq.com/hypermail/wine-devel/2005/03/0397.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">



http://www.winehq.com/hypermail/wine-devel/2005/03/0397.html</a><br>&gt;It was too hard for one guy back in July:<br>&gt;<a href="http://www.winehq.com/hypermail/wine-devel/2005/07/0401.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">


http://www.winehq.com/hypermail/wine-devel/2005/07/0401.html
</a><br>&gt;but that was probably because he didn't see Rob's message from March.<br>&gt;Maybe we need to put better instructions on how to use<br>&gt;Valgrind with Wine on winehq.org... or, dare I suggest it,<br>&gt;bundle valgrind with Wine so anybody could easily use it
<br>&gt;be setting WINEDEBUG=+valgrind or something like that...<br>&gt;<br><br>Valgrind 3.1.0 works with Wine with no Wine modifications needed.<br>However, one patch to valgrind is required to generate meaningful<br>backtraces and I've attached it to this message - I guess I should
<br>report this to the valgrind developers.<br><br>--<br>Rob Shearman<br><br><br><br><br><br><br><br></blockquote></div><br></span></div>
I was really just considering using valgrind! I already have it
installed, but I wasn't sure it would work very nicely, though. I was
afraid there would be too much pointless output to wade through, but
I'll try it tomorrow sometime.<br>
<br>
Cheers,<br><span>
James<br>

</span>

</span></div></blockquote></div><br>
Well, it took a little longer than I thought it might.<br>
<br>
I compiled valgrind 3.1.0 with the above patch applied. I ran Icewind
Dale II with valgrind '--trace-children=yes wine IWD2.exe'. It goes on
for a short while outputting various errors until it freezes. It locks
and I have to reboot the machine. I've tried to output it to a log as
well, but the file is empty once I've rebooted, (perhaps the stream
doesn't get flushed or whatever).<br>
<br>
This didn't prove particularly useful... Any suggestions?<br>
<br>
In case anyone is interested running 'valgrind --trace-children=yes wine' produces the following output:<br>
<br>
==7379== Memcheck, a memory error detector.<br>
==7379== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.<br>
==7379== Using LibVEX rev 1471, a library for dynamic binary translation.<br>
==7379== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.<br>
==7379== Using valgrind-3.1.0, a dynamic binary instrumentation framework.<br>
==7379== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.<br>
==7379== For more details, rerun with: -v<br>
==7379== <br>
==7379== My PID = 7379, parent PID = 7342.&nbsp; Prog and args are:<br>
==7379==&nbsp;&nbsp;&nbsp; /home/james/development/wine/regression_testing/cvs/wine/loader/wine-preloader<br>
==7379==&nbsp;&nbsp;&nbsp; /home/james/development/wine/regression_testing/cvs/wine/loader/wine-pthread<br>
==7379== <br>
==7379== Warning: set address range perms: large range 535756800, a 0, v 0<br>
==7379== Warning: set address range perms: large range 1031864320, a 0, v 0<br>
==7379== Warning: set address range perms: large range 1031864320, a 1, v 1<br>
==7379== Warning: set address range perms: large range 515899392, a 0, v 0<br>
==7379== Warning: set address range perms: large range 515964928, a 0, v 0<br>
==7379== Warning: set address range perms: large range 515964928, a 1, v 1<br>
==7379== Warning: set address range perms: large range 257949696, a 0, v 0<br>
==7379== Warning: set address range perms: large range 258015232, a 0, v 0<br>
==7379== Warning: set address range perms: large range 258015232, a 1, v 1<br>
==7379== Warning: set address range perms: large range 128974848, a 0, v 0<br>
==7379== Warning: set address range perms: large range 128974848, a 1, v 1<br>
==7379== Warning: set address range perms: large range 129040384, a 0, v 0<br>
==7379== Warning: set address range perms: large range 549322752, a 0, v 0<br>
==7379== Warning: set address range perms: large range 549322752, a 1, v 1<br>
==7379== Warning: set address range perms: large range 274661376, a 0, v 0<br>
==7379== Warning: set address range perms: large range 274661376, a 1, v 1<br>
==7379== Warning: set address range perms: large range 137297920, a 0, v 0<br>
==7379== Warning: set address range perms: large range 137297920, a 1, v 1<br>
==7379== Invalid read of size 4<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x20010CA8: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000624D: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152A75: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CEF: wine_init (loader.c:550)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379==&nbsp; Address 0x2018935C is 76 bytes inside a block of size 79 alloc'd<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x2001B45A: malloc (vg_replace_malloc.c:149)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022983: first_dll_path (loader.c:162)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CCC: wine_init (loader.c:548)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Conditional jump or move depends on uninitialised value(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x200086F7: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152BE9: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CEF: wine_init (loader.c:550)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Conditional jump or move depends on uninitialised value(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x20008700: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152BE9: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CEF: wine_init (loader.c:550)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Conditional jump or move depends on uninitialised value(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x2000882D: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152BE9: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CEF: wine_init (loader.c:550)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Conditional jump or move depends on uninitialised value(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x20008852: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152BE9: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022CEF: wine_init (loader.c:550)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Conditional jump or move depends on uninitialised value(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x7BF00F5A: init_current_teb (../include/wine/library.h:127)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202DB7AA: thread_init (thread.c:149)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202BF6A8: __wine_process_init (loader.c:2163)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022D31: wine_init (loader.c:561)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== <br>
==7379== Invalid read of size 4<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x20010CD7: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000624D: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20152A75: (within /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20153737: _dl_open (in /lib/tls/i686/cmov/libc-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185CE7: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x2000B105: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x201862EA: (within /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20185D40: dlopen (in /lib/tls/i686/cmov/libdl-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x200229F9: wine_dlopen (loader.c:588)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20023556: dlopen_dll (loader.c:193)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202BF451: load_builtin_dll (loader.c:1422)<br>
==7379==&nbsp; Address 0x2018CCB0 is 80 bytes inside a block of size 82 alloc'd<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x2001B45A: malloc (vg_replace_malloc.c:149)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022983: first_dll_path (loader.c:162)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20023536: dlopen_dll (loader.c:191)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202BF451: load_builtin_dll (loader.c:1422)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202BF6DF: __wine_process_init (loader.c:2172)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022D31: wine_init (loader.c:561)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379== Warning: noted but unhandled ioctl 0x30B with no size/direction hints<br>
==7379==&nbsp;&nbsp;&nbsp; This could cause spurious value errors to appear.<br>
==7379==&nbsp;&nbsp;&nbsp; See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.<br>
==7379== <br>
==7379== Syscall param writev(vector[...]) points to uninitialised byte(s)<br>
==7379==&nbsp;&nbsp;&nbsp; at 0x20000772: (within /lib/ld-<a href="http://2.3.5.so">2.3.5.so</a>)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202D54D5: wine_server_call (server.c:238)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202C9B95: NtSetValueKey (reg.c:755)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x205D460C: create_scsi_entry (oldconfig.c:171)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x205D4DE6: convert_old_config (oldconfig.c:401)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x205DD38C: process_init (process.c:957)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x205DD68B: __wine_kernel_init (process.c:1050)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x202BF738: __wine_process_init (loader.c:2184)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x20022D31: wine_init (loader.c:561)<br>
==7379==&nbsp;&nbsp;&nbsp; by 0x7BF0103F: main (main.c:45)<br>
==7379==&nbsp; Address 0xBE82E590 is on thread 1's stack<br>
==7379== <br>
==7379== ERROR SUMMARY: 28 errors from 8 contexts (suppressed: 17 from 1)<br>
==7379== malloc/free: in use at exit: 5,068 bytes in 51 blocks.<br>
==7379== malloc/free: 133 allocs, 82 frees, 17,323 bytes allocated.<br>
==7379== For counts of detected errors, rerun with: -v<br>
==7379== searching for pointers to 51 not-freed blocks.<br>
==7379== checked 643,360 bytes.<br>
==7379== <br>
==7379== LEAK SUMMARY:<br>
==7379==&nbsp;&nbsp;&nbsp; definitely lost: 156 bytes in 11 blocks.<br>
==7379==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; possibly lost: 0 bytes in 0 blocks.<br>
==7379==&nbsp;&nbsp;&nbsp; still reachable: 4,912 bytes in 40 blocks.<br>
==7379==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suppressed: 0 bytes in 0 blocks.<br>
==7379== Use --leak-check=full to see details of leaked memory.<br>