http://bugs.winehq.org/show_bug.cgi?id=16834
Summary: SetFormat() doesn't remap unmapped sound buffers on failure Product: Wine Version: 1.1.10 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: directx-dsound AssignedTo: wine-bugs@winehq.org ReportedBy: next_ghost@quick.cz
Railroad Tycoon 2 Platinum segfaults on startup because SetFormat() function in dlls/winealsa.drv/dsoutput.c does the following on my system:
- snd_pcm_open() - failure because already open (line 395) - snd_pcm_drop() (line 403) - snd_pcm_close() - existing sound buffer is now unmapped (line 404) - snd_pcm_open() - success (line 406) - snd_pcm_hw_params_set_channels(1) - failure because device has minimum of 2 channels (line 416) - goto err; (line 417) - return DSERR_BADFORMAT; (line 479)
The call to DSDB_CreateMMAP() on line 464 is skipped by goto err; so the already unmapped sound buffer is left in This. When DSOUND_PerformMix() tries to ZeroMemory this buffer, Wine segfaults.
http://bugs.winehq.org/show_bug.cgi?id=16834
--- Comment #1 from Martin Doucha next_ghost@quick.cz 2009-01-06 17:08:47 --- Created an attachment (id=18542) --> (http://bugs.winehq.org/attachment.cgi?id=18542) strace log of Wine during Railroad Tycoon 2 startup
WINEDEBUG=trace,+dsalsa,+dsound
notice munmap() of 0x7c89c000 on line 15897 and open("/dev/snd/pcmC0D0p") on line 15893.
http://bugs.winehq.org/show_bug.cgi?id=16834
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal
--- Comment #2 from Jeff Zaroyko jeffz@jeffz.name 2009-01-06 19:25:26 --- http://bugs.winehq.org/page.cgi?id=fields.html#bug_severity
http://bugs.winehq.org/show_bug.cgi?id=16834
--- Comment #3 from Austin English austinenglish@gmail.com 2009-07-08 15:12:34 --- Is this still an issue in current (1.1.25 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=16834
--- Comment #4 from Martin Doucha next_ghost@quick.cz 2009-07-09 05:53:07 --- RT2 crashes before it initializes sound in wine 1.1.25. I'll need some time to work around the problem and I'll submit another bugreport later.
http://bugs.winehq.org/show_bug.cgi?id=16834
--- Comment #5 from Martin Doucha next_ghost@quick.cz 2009-12-11 11:45:30 --- Hi, sorry for not responding for so long but another issue was preventing me from testing this problem. That issue was resolved as of 1.1.34 so I could finally test this bug.
The problem is still there.
The exact path of execution taken during Railroad Tycoon 2 startup which causes the problem is described in the initial bug description. Since nobody even touched the code in question since I've reported this issue (yes, I went through the relevant git history of dlls/winealsa.drv/dsoutput.c), it simply can't be fixed.
http://bugs.winehq.org/show_bug.cgi?id=16834
Raymond superquad.vortex2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |superquad.vortex2@gmail.com
--- Comment #6 from Raymond superquad.vortex2@gmail.com 2010-07-31 07:09:55 --- (In reply to comment #1)
Created an attachment (id=18542)
--> (http://bugs.winehq.org/attachment.cgi?id=18542) [details]
strace log of Wine during Railroad Tycoon 2 startup
WINEDEBUG=trace,+dsalsa,+dsound
notice munmap() of 0x7c89c000 on line 15897 and open("/dev/snd/pcmC0D0p") on line 15893.
The point is ioctl(23, 0xc0684113, 0x132ad0) = -1 EINVAL (Invalid argument)
this error occur between line 203 and 227 but wine seem ignore the error and continue
write(2, "trace:dsalsa:SetFormat Period siz"..., 43trace:dsalsa:SetFormat Period size is: 512 ) = 43 ioctl(23, 0x4140, 0x33ec7c) = 0 write(2, "trace:dsalsa:DSDB_CreateMMAP mmap"..., 72trace:dsalsa:DSDB_CreateMMAP mmap'd buffer is a direct hardware buffer. ) = 72 write(2, "trace:dsalsa:DSDB_CreateMMAP form"..., 108trace:dsalsa:DSDB_CreateMMAP format=S16_LE frames=16384 channels=2 bits_per_sample=16 bits_per_frame=32 ) = 108 ioctl(23, 0xc0684113, 0x132ad0) = -1 EINVAL (Invalid argument) write(2, "trace:dsalsa:DSDB_CreateMMAP crea"..., 93trace:dsalsa:DSDB_CreateMMAP created mmap buffer of 16384 frames (65536 bytes) at 0x7c89c000
http://bugs.winehq.org/show_bug.cgi?id=16834
butraxz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |butraxz@gmail.com
--- Comment #7 from butraxz@gmail.com 2012-05-20 10:59:42 CDT --- This bug has not been updated for two years. Is this still an issue in current (1.5.4 or newer) wine?
https://bugs.winehq.org/show_bug.cgi?id=16834
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |ABANDONED
--- Comment #8 from Austin English austinenglish@gmail.com --- No reply in 2 years, marking abandoned. If still an issue in current (1.7.19 or newer) wine, and you can provide the needed information, feel free to reopen.
https://bugs.winehq.org/show_bug.cgi?id=16834
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Austin English austinenglish@gmail.com --- Closing.