All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Matteo Frigo <athena@fftw.org>
Cc: kvm@vger.kernel.org
Subject: Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM
Date: Sat, 14 Feb 2009 00:32:54 +0200	[thread overview]
Message-ID: <4995F516.6080603@redhat.com> (raw)
In-Reply-To: <4995EEB4.4010602@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2278 bytes --]

Avi Kivity wrote:
> Matteo Frigo wrote:
>> Matteo Frigo <athena@fftw.org> writes:
>>
>>  
>>> Avi Kivity <avi@redhat.com> writes:
>>>
>>>    
>>>> Can you run the slightly modified gs.c (attached) and rerun on AMD?
>>>> The is to see if the runtime somehow restores gs.
>>>>       
>>> Crashes as follows:
>>>
>>> w2k3-64:~$ ./a.exe gs: 2b
>>> gs:0x30: 7efdb000
>>> Segmentation fault (core dumped)
>>>     
>>
>> A little bit more information:
>>
>> w2k3-64:~$ gdb a.exe
>> GNU gdb 6.8.0.20080328-cvs (cygwin-special)
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later 
>> <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.  Type "show 
>> copying"
>> and "show warranty" for details.
>> This GDB was configured as "i686-pc-cygwin"...
>> (no debugging symbols found)
>> (gdb) r
>> Starting program: /home/athena/a.exe [New thread 1620.0x6dc]
>> Error: dll starting at 0x77d40000 not found.
>> Error: dll starting at 0x77d40000 not found.
>> Error: dll starting at 0x77c20000 not found.
>> Error while mapping shared library sections:
>> /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory.
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>> [New thread 1620.0x74c]
>> (no debugging symbols found)
>> (no debugging symbols found)
>> (no debugging symbols found)
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0040109d in main ()
>> (gdb) x/i $pc
>> 0x40109d <main+77>:    mov    %gs:0x30,%esi
>> (gdb) p/x $gs
>> $1 = 0x2b
>> (gdb)   
>
> Okay, at least this makes some little bit of sense.  On both Intel and 
> AMD, 'mov gs' clobbers gs.base as expected.  On AMD, something further 
> down the line (some syscall likely) restores gs.base, but on Intel it 
> doesn't.  When we avoid the syscall, we get a crash on AMD as well.
>

The attached patch fixes it for me.  Without this, rdmsr(KERNEL_GS_BASE) 
reads a stale value, which presumably Windows later writes back.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


[-- Attachment #2: cygwin-fix.patch --]
[-- Type: text/x-patch, Size: 397 bytes --]

diff --git a/kernel/x86/vmx.c b/kernel/x86/vmx.c
index 7507ce2..048460d 100644
--- a/kernel/x86/vmx.c
+++ b/kernel/x86/vmx.c
@@ -910,6 +910,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
 		data = vmcs_readl(GUEST_SYSENTER_ESP);
 		break;
 	default:
+		vmx_load_host_state(vcpu);
 		msr = find_msr_entry(to_vmx(vcpu), msr_index);
 		if (msr) {
 			data = msr->data;

  reply	other threads:[~2009-02-13 22:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <40ddf2480901050654y268213d1jbf34f9d81d6faeb0@mail.gmail.com>
2009-01-05 16:22 ` Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM Jamie Kirkpatrick
2009-01-22 15:02   ` Avi Kivity
2009-02-06  1:28     ` Matteo Frigo
2009-02-13 20:01       ` Avi Kivity
2009-02-13 20:18         ` Matteo Frigo
2009-02-13 20:27           ` Avi Kivity
2009-02-13 20:28           ` Avi Kivity
2009-02-13 20:39             ` Matteo Frigo
2009-02-13 21:02               ` Avi Kivity
2009-02-13 21:23                 ` Matteo Frigo
2009-02-13 21:46                   ` Avi Kivity
2009-02-13 21:46                   ` Avi Kivity
2009-02-13 21:49                     ` Matteo Frigo
2009-02-13 21:52                       ` Matteo Frigo
2009-02-13 22:05                         ` Avi Kivity
2009-02-13 22:32                           ` Avi Kivity [this message]
2009-02-13 22:46                             ` Matteo Frigo
2009-02-13 22:52                               ` Avi Kivity
2009-02-13 22:06                         ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4995F516.6080603@redhat.com \
    --to=avi@redhat.com \
    --cc=athena@fftw.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.