Bug 211701

Summary: stack mismarked after rmdir() in wine's ntdll?!
Product: [Developer tools] valgrind Reporter: Dan Kegel <dank>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dan Kegel 2009-10-24 22:09:16 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

This is on Ubuntu Jaunty 64 bit, running 32 bit wine.

Running wine's test suite under valgrind generally
works ok, but there is a very squirrelly error
in test_FindFirstChangeNotification:

 Invalid write of size 4
    at  RtlFreeAnsiString (rtlstr.c:170)
    by  RemoveDirectoryW (path.c:1350)
    by  RemoveDirectoryA (path.c:1364)
    by  test_FindFirstChangeNotification (change.c:182)
    by  func_change (change.c:883)
    by  run_test (test.h:535)
    by  main (test.h:585)
  Address 0x7f21eeac is on thread 1's stack

Inserting a function call in RemoveDirectoryW()
(anywhere) sometimes makes the warning go away.

It seems that the first function call after the unix 
rmdir() at
http://source.winehq.org/source/dlls/kernel32/path.c#L1349
triggers this warning...
even if the function call is just a print statement.

To reproduce:
 install valgrind (after applying the workaround
for the regression that keeps wine from working,
https://bugs.kde.org/show_bug.cgi?id=205541#c1 )
 build wine
 cd ~/wine-git/dlls/kernel32/tests
 ~/wine-git/wine winemine &
 valgrind --trace-children=yes ~/wine-git/wine kernel32_test.exe.so change.c

It still happens if I comment out all but
test_FindFirstChangeNotification()
at the bottom of change.c.
Comment 1 Dan Kegel 2009-10-24 22:33:45 UTC
BTW I'm not convinced this is a valgrind bug; 
could be a really strange wine one, too.
Finding a minimal test case will help narrow it down.