public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bug report: 64-bit cygwin setup crashes under Wine
@ 2013-09-04  5:09 Austin English
  2013-09-04  5:46 ` Christopher Faylor
  2013-09-04 15:36 ` Jim Garrison
  0 siblings, 2 replies; 10+ messages in thread
From: Austin English @ 2013-09-04  5:09 UTC (permalink / raw)
  To: cygwin

Howdy,

I recently noticed the 64-bit cygwin installer crashes under wine.
After further debugging, it appears that the issue is that cygwin is
misaligning the stack, causing a crash. I've copy/pasted the analysis
below:

Hello folks,

confirming.

Reminded me of bug 27680 (violation of the Windows 64-bit ABI, stack pointer
(RSP) must be 16-byte aligned when making a call to Win64 API)...

Similarly the gcc generated prologue code for MSABI (SSE2 callee save) causes a
crash due to misaligned stack (needs to be 16-byte aligned).

--- snip ---
...
0027:Starting process L"Z:\\home\\focht\\Downloads\\setup-x86_64.exe"
(entryproc=0x691616)
0027:Call KERNEL32.GetModuleHandleA(0057ce81 "KERNEL32") ret=0057ce90
0027:Ret  KERNEL32.GetModuleHandleA() retval=7b820000 ret=0057ce90
0027:Call KERNEL32.GetProcAddress(7b820000,0057ce9a "VirtualProtect")
ret=0057ceb1
0027:Ret  KERNEL32.GetProcAddress() retval=7b83007c ret=0057ceb1
0027:trace:seh:raise_exception code=c0000005 flags=0 addr=0x7fb738137842
ip=7fb738137842 tid=0027
0027:trace:seh:raise_exception  rax=000000007b83007c rbx=000000007b83007c
rcx=000000007bae33d0 rdx=00000000000403dc
0027:trace:seh:raise_exception  rsi=0000000000690000 rdi=000000000040016f
rbp=000000000033fc08 rsp=000000000033fb18
0027:trace:seh:raise_exception   r8=000000000033fc80  r9=000000000033fc88
r10=0000000000000000 r11=0000003629581400
0027:trace:seh:raise_exception  r12=000000007bf00c50 r13=00007fffb49477a0
r14=0000000000000000 r15=0000000000000000
...
--- snip ---

Winedbg isn't useful here because it doesn't support SSE2 instructions.
Running winedbg --gdb yields more useful results.

Debug session:

--- snip ---
...
Dump of assembler code for function NtProtectVirtualMemory:
=> 0x00007f8e5e51703a <+0>:    push   %rbp
   0x00007f8e5e51703b <+1>:    mov    %rsp,%rbp
   0x00007f8e5e51703e <+4>:    push   %rdi
   0x00007f8e5e51703f <+5>:    push   %rsi
   0x00007f8e5e517040 <+6>:    sub    $0x1d0,%rsp
   0x00007f8e5e517047 <+13>:    movaps %xmm6,-0xb0(%rbp)
   0x00007f8e5e51704e <+20>:    movaps %xmm7,-0xa0(%rbp)
   0x00007f8e5e517055 <+27>:    movaps %xmm8,-0x90(%rbp)
   0x00007f8e5e51705d <+35>:    movaps %xmm9,-0x80(%rbp)
   0x00007f8e5e517062 <+40>:    movaps %xmm10,-0x70(%rbp)
   0x00007f8e5e517067 <+45>:    movaps %xmm11,-0x60(%rbp)
   0x00007f8e5e51706c <+50>:    movaps %xmm12,-0x50(%rbp)
   0x00007f8e5e517071 <+55>:    movaps %xmm13,-0x40(%rbp)
   0x00007f8e5e517076 <+60>:    movaps %xmm14,-0x30(%rbp)
   0x00007f8e5e51707b <+65>:    movaps %xmm15,-0x20(%rbp)
   0x00007f8e5e517080 <+70>:    mov    %rcx,0x10(%rbp)
   0x00007f8e5e517084 <+74>:    mov    %rdx,0x18(%rbp)
   0x00007f8e5e517088 <+78>:    mov    %r8,0x20(%rbp)
   0x00007f8e5e51708c <+82>:    mov    %r9d,0x28(%rbp)
   0x00007f8e5e517090 <+86>:    movl   $0x0,-0xb4(%rbp)
   0x00007f8e5e51709a <+96>:    mov    0x20(%rbp),%rax
   0x00007f8e5e51709e <+100>:    mov    (%rax),%rax
...
--- snip ---

Reg dump before faulting instruction (xmm6 save):

--- snip ---
Wine-gdb> info reg
rax            0x33fc50    3406928
rbx            0x7b89f360    2072638304
rcx            0xffffffffffffffff    -1
rdx            0x33fc50    3406928
rsi            0x690000    6881280
rdi            0x40016f    4194671
rbp            0x33fbe8    0x33fbe8
rsp            0x33fa08    0x33fa08
r8             0x33fc58    3406936
r9             0x4    4
r10            0x3629532710    232621549328
r11            0x0    0
r12            0x7bf00c50    2079329360
r13            0x7fff237e6030    140733788872752
r14            0x0    0
r15            0x0    0
rip            0x7f8e5e517047    0x7f8e5e517047 <NtProtectVirtualMemory+13>
eflags         0x202    [ IF ]
cs             0x33    51
ss             0x2b    43
ds             0x0    0
es             0x0    0
fs             0x0    0
gs             0x0    0

Program received signal SIGSEGV, Segmentation fault.
...
0x00007f8e5e517047 in NtProtectVirtualMemory (process=0x0, addr_ptr=0x0,
size_ptr=0x0, new_prot=6881280, old_prot=0x33fc88)
    at /home/focht/projects/wine/wine-git/dlls/ntdll/virtual.c:2120
2120    {

--- snip ---

Windows x86_64 ABI specifies that registers xmm6-xmm15 be callee saved.
Gcc generates the MSABI prologue accordingly (see previous disassembly).

At the entry point of VirtualProtect() the stack is 16-byte aligned ...

--- snip ---
Stopped on breakpoint 1 at 0x000000007b89f360 VirtualProtect
[/home/focht/projects/wine/wine-git/dlls/kernel32/virtual.c:214] in kernel32
VirtualProtect () at
/home/focht/projects/wine/wine-git/dlls/kernel32/virtual.c:214
214    {
Wine-dbg>info reg
Register dump:
 rip:000000007b89f360 rsp:000000000033fc80 rbp:000000000033fd20 eflags:00000206
(   - --  I   - -P- )
 rax:000000007b89f360 rbx:000000007b89f360 rcx:000000000040016f
rdx:0000000000000078
 rsi:0000000000690000 rdi:000000000040016f  r8:0000000000000004
r9:000000000033fc88 r10:0000003629532710
 r11:0000000000000000 r12:000000007bf00c50 r13:00007fffff7bdb10
r14:0000000000000000 r15:0000000000000000
Wine-dbg>
--- snip ---

*dingding*

At time of performing the call instruction the stack has to be 16-byte aligned!
Hence the callee messed this up.

The tested wine version was 1.6 (recent stable release).

See http://bugs.winehq.org/show_bug.cgi?id=34258 for more info.

Note: I'm not subscribed, please CC me on reply.

-Austin

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04  5:09 bug report: 64-bit cygwin setup crashes under Wine Austin English
@ 2013-09-04  5:46 ` Christopher Faylor
  2013-09-04 15:36 ` Jim Garrison
  1 sibling, 0 replies; 10+ messages in thread
From: Christopher Faylor @ 2013-09-04  5:46 UTC (permalink / raw)
  To: cygwin

On Tue, Sep 03, 2013 at 10:08:44PM -0700, Austin English wrote:
>I recently noticed the 64-bit cygwin installer crashes under wine.
>After further debugging, it appears that the issue is that cygwin is
>misaligning the stack, causing a crash. I've copy/pasted the analysis
>below:
>
>Hello folks,
>
>confirming.
>
>Reminded me of bug 27680 (violation of the Windows 64-bit ABI, stack pointer
>(RSP) must be 16-byte aligned when making a call to Win64 API)...
>
>Similarly the gcc generated prologue code for MSABI (SSE2 callee save) causes a
>crash due to misaligned stack (needs to be 16-byte aligned).

If you'd like to submit a patch to get setup working in Wine it would be
thoughtfully considered.  Otherwise, I can say with a fair amount of
certainty that no one is going to be interested in installing Wine to
debug issues running (in this case non-cygwin!) programs there.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04  5:09 bug report: 64-bit cygwin setup crashes under Wine Austin English
  2013-09-04  5:46 ` Christopher Faylor
@ 2013-09-04 15:36 ` Jim Garrison
  2013-09-04 18:20   ` Christopher Faylor
  2013-09-04 21:26   ` Warren Young
  1 sibling, 2 replies; 10+ messages in thread
From: Jim Garrison @ 2013-09-04 15:36 UTC (permalink / raw)
  To: cygwin

Am I missing something, or is there a reason one would want to run a Linux emulator under a Windows emulator on Linux?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 15:36 ` Jim Garrison
@ 2013-09-04 18:20   ` Christopher Faylor
  2013-09-04 21:26   ` Warren Young
  1 sibling, 0 replies; 10+ messages in thread
From: Christopher Faylor @ 2013-09-04 18:20 UTC (permalink / raw)
  To: cygwin

On Wed, Sep 04, 2013 at 03:36:46PM +0000, Jim Garrison wrote:
>Am I missing something, or is there a reason one would want to run a
>Linux emulator under a Windows emulator on Linux?

That is the question I've been asking for years.  Someone always has an
answer but I'm never been convinced that it is worth my time to
investigate Wine issues in Cygwin when Cygwin works on a number of
different true Windows platforms, even under a VM.

I'm happy to accept patches which fix real Cygwin problems (which we
actually have done recently) but I'm pretty sure that neither Corinna
nor I nor anyone else who works on setup.exe is going to track down
Wine issues - especially in setup.exe.

But your question often engenders some sort of passionate response so,
be ready.

Welcome to the WJM club!

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 15:36 ` Jim Garrison
  2013-09-04 18:20   ` Christopher Faylor
@ 2013-09-04 21:26   ` Warren Young
  2013-09-04 21:54     ` Earnie Boyd
  2013-09-04 23:09     ` Christopher Faylor
  1 sibling, 2 replies; 10+ messages in thread
From: Warren Young @ 2013-09-04 21:26 UTC (permalink / raw)
  To: Cygwin-L

On 9/4/2013 09:36, Jim Garrison wrote:
> Am I missing something, or is there a reason one would want to run a
> Linux emulator under a Windows emulator on Linux?

For myself, it is occasionally nice to have a Cygwin sandbox environment 
to play with when I'm on one of my Macs, away from a Windows box.  Wine 
is cheaper than a VM in terms of hardware requirements and licensing.

Unfortunately, Wine is still a bag of fail, so I continue to put up with 
the problems of running Windows in a VM.

This bug could well be Wine's, rather than Cygwin's.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 21:26   ` Warren Young
@ 2013-09-04 21:54     ` Earnie Boyd
  2013-09-05  2:28       ` Warren Young
  2013-09-04 23:09     ` Christopher Faylor
  1 sibling, 1 reply; 10+ messages in thread
From: Earnie Boyd @ 2013-09-04 21:54 UTC (permalink / raw)
  To: Andrey Repin

On Wed, Sep 4, 2013 at 5:26 PM, Warren Young wrote:
> On 9/4/2013 09:36, Jim Garrison wrote:
>>
>> Am I missing something, or is there a reason one would want to run a
>> Linux emulator under a Windows emulator on Linux?
>
>
> For myself, it is occasionally nice to have a Cygwin sandbox environment to
> play with when I'm on one of my Macs, away from a Windows box.  Wine is
> cheaper than a VM in terms of hardware requirements and licensing.
>

You must have some very expensive hardware.  I'm running VirtualBox
VMs on my laptop; which has a Windows 7 OS and two of those VM are
different versions of Windows.  The problem I have with my VM on my
laptop is that when I'm away from the external drives I have the
virtual disks stored on they don't work; but that is a seldom
occurrence.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 21:26   ` Warren Young
  2013-09-04 21:54     ` Earnie Boyd
@ 2013-09-04 23:09     ` Christopher Faylor
  2013-09-05 12:13       ` Ryan Johnson
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2013-09-04 23:09 UTC (permalink / raw)
  To: cygwin

On Wed, Sep 04, 2013 at 03:26:10PM -0600, Warren Young wrote:
>This bug could well be Wine's, rather than Cygwin's.

Wine can always play the "It's not documented to work that way card" but
the bottom line is still that it is not a "platform" that we are interested
in devoting time to.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 21:54     ` Earnie Boyd
@ 2013-09-05  2:28       ` Warren Young
  2013-09-05  9:48         ` fernando
  0 siblings, 1 reply; 10+ messages in thread
From: Warren Young @ 2013-09-05  2:28 UTC (permalink / raw)
  To: Cygwin-L

On 9/4/2013 15:54, Earnie Boyd wrote:
> On Wed, Sep 4, 2013 at 5:26 PM, Warren Young wrote:
>>
>> Wine is
>> cheaper than a VM in terms of hardware requirements and licensing.
>
> You must have some very expensive hardware.

I figure a VM costs me $25-50 in RAM and SSD space.  Because it's not a 
full OS, Wine's slice of SSD and RAM is more like $10, and a lot of it 
is shared among Wine instances if you have more than one running.

I purposefully said "and licensing" though, because the Windows license 
swamps the hardware costs.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-05  2:28       ` Warren Young
@ 2013-09-05  9:48         ` fernando
  0 siblings, 0 replies; 10+ messages in thread
From: fernando @ 2013-09-05  9:48 UTC (permalink / raw)
  To: Cygwin-L

On Thursday, September 05, 2013 at 4:28 AM, Warren Young wrote:
> I purposefully said "and licensing" though, because the Windows license 
> swamps the hardware costs.

It can be true about the SSD and RAM costs but it's not the same kind of 
sandbox too (Wine vs VM). But about the licensing costs I can't understand 
it. Unless you are a cygwin developer that needs to use cygwin mandatory I 
can't see the purpose on using a solution that involves a Virtual Machine 
running a Cygwin installation inside a Windows Guest in a Mac as Host 
Machine. Doesn't it has a lot more sense to install linux on the Virtual 
Machine? No licensing costs at all. Unless I'm missing something and cygwin 
includes something that is not available on linux. 


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: bug report: 64-bit cygwin setup crashes under Wine
  2013-09-04 23:09     ` Christopher Faylor
@ 2013-09-05 12:13       ` Ryan Johnson
  0 siblings, 0 replies; 10+ messages in thread
From: Ryan Johnson @ 2013-09-05 12:13 UTC (permalink / raw)
  To: cygwin

On 04/09/2013 7:09 PM, Christopher Faylor wrote:
> On Wed, Sep 04, 2013 at 03:26:10PM -0600, Warren Young wrote:
>> This bug could well be Wine's, rather than Cygwin's.
> Wine can always play the "It's not documented to work that way card" but
> the bottom line is still that it is not a "platform" that we are interested
> in devoting time to.
One wonders what stack alignment would be found if a breakpoint were set 
at the same place under a native windows setup... if it's not 16-byte 
aligned then this is a Cygwin bug that flew under the radar. Aligned 
stack? Chalk it up to Wine.

Ryan



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-05 12:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04  5:09 bug report: 64-bit cygwin setup crashes under Wine Austin English
2013-09-04  5:46 ` Christopher Faylor
2013-09-04 15:36 ` Jim Garrison
2013-09-04 18:20   ` Christopher Faylor
2013-09-04 21:26   ` Warren Young
2013-09-04 21:54     ` Earnie Boyd
2013-09-05  2:28       ` Warren Young
2013-09-05  9:48         ` fernando
2013-09-04 23:09     ` Christopher Faylor
2013-09-05 12:13       ` Ryan Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).