From: Jeremy Fitzhardinge <jeremy@goop.org>
To: M A Young <m.a.young@durham.ac.uk>
Cc: Xen-devel <xen-devel@lists.xensource.com>
Subject: Re: pvops dom0 work roadmap
Date: Thu, 20 Aug 2009 16:39:49 -0700 [thread overview]
Message-ID: <4A8DDEC5.9090109@goop.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0908210012150.2445@vega1.dur.ac.uk>
On 08/20/09 16:17, M A Young wrote:
> On Thu, 20 Aug 2009, Jeremy Fitzhardinge wrote:
>
>> On i386, if %gs hasn't been loaded properly then using it as a base for
>> a memory access will GP.
>>
>> Try this:
>>
>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
>> index 2e58099..3ebcbb2 100644
>> --- a/arch/x86/xen/enlighten.c
>> +++ b/arch/x86/xen/enlighten.c
>> @@ -51,6 +51,7 @@
>> #include <asm/pgtable.h>
>> #include <asm/tlbflush.h>
>> #include <asm/reboot.h>
>> +#include <asm/stackprotector.h>
>>
>> #include "xen-ops.h"
>> #include "mmu.h"
>> @@ -1013,13 +1014,8 @@ asmlinkage void __init xen_start_kernel(void)
>> pv_apic_ops = xen_apic_ops;
>> pv_mmu_ops = xen_mmu_ops;
>>
>> -#ifdef CONFIG_X86_64
>> - /*
>> - * Setup percpu state. We only need to do this for 64-bit
>> - * because 32-bit already has %fs set properly.
>> - */
>> - load_percpu_segment(0);
>> -#endif
>> + setup_stack_canary_segment(0);
>> + switch_to_new_gdt(0);
>>
>> xen_init_irq_ops();
>> xen_init_cpuid_mask();
>
> It crashes with this patch (x86_64 also crashes) as follows
Yeah that was a bit of a shot in the dark; I'd been avoiding setting the
GDT that early because its all a bit fragile, and aside from
stack-protector we can get away with Xen's GDT for quite a while.
Hm, its pretty fiddly... Let me see what I can come up with.
>
> (XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch
> input to Xen)
> (XEN) Freed 116kB init memory.
> (XEN) d0:v0: unhandled page fault (ec=0000)
> (XEN) Pagetable walk from 00000014:
> (XEN) L3[0x000] = 000000003a032001 00002032
> (XEN) L2[0x000] = 0000000000000000 ffffffff
> (XEN) domain_crash_sync called from entry.S (ff1b221e)
> (XEN) Domain 0 (vcpu#0) crashed on cpu#0:
> (XEN) ----[ Xen-3.4.1 x86_32p debug=n Not tainted ]----
> (XEN) CPU: 0
> (XEN) EIP: e019:[<c04064cc>]
> (XEN) EFLAGS: 00000282 EM: 1 CONTEXT: pv guest
> (XEN) eax: c0b1c0e0 ebx: c0b1c0e0 ecx: 00000010 edx: 0000001c
> (XEN) esi: c0aa3fd8 edi: c0a1592c ebp: c0aa3fb8 esp: c0aa3f94
> (XEN) cr0: 8005003b cr4: 000006f0 cr3: 3a031000 cr2: 00000014
> (XEN) ds: e021 es: e021 fs: e021 gs: e021 ss: e021 cs: e019
> (XEN) Guest stack trace from esp=c0aa3f94:
> (XEN) 00000000 c04064cc 0001e019 00010082 00000000 00000000
> 00000010 c0aa3fd8
>
> (XEN) c0a1592c c0aa3fcc c0403e3f 00000010 c0ae93f4 c0a1592c
> c0aa3ffc c0aab798
>
> (XEN) 00000010 e0f00018 c04090b1 00000000 00000000 00000000
> 00000000 00000000
>
> (XEN) c2030000 00000000 00000000
> (XEN) Domain 0 crashed: rebooting machine in 5 seconds.
>
> The instruction and context is
> (gdb) x/i 0xc04064cc
> 0xc04064cc <arbitrary_virt_to_machine+16>: mov %gs:0x14,%eax
> (gdb) x/15i arbitrary_virt_to_machine
> 0xc04064bc <arbitrary_virt_to_machine>: push %ebp
> 0xc04064bd <arbitrary_virt_to_machine+1>: mov %esp,%ebp
> 0xc04064bf <arbitrary_virt_to_machine+3>: push %edi
> 0xc04064c0 <arbitrary_virt_to_machine+4>: push %esi
> 0xc04064c1 <arbitrary_virt_to_machine+5>: push %ebx
> 0xc04064c2 <arbitrary_virt_to_machine+6>: sub $0x8,%esp
> 0xc04064c5 <arbitrary_virt_to_machine+9>: call 0xc040bc14 <mcount>
> 0xc04064ca <arbitrary_virt_to_machine+14>: mov %eax,%ebx
> 0xc04064cc <arbitrary_virt_to_machine+16>: mov %gs:0x14,%eax
> 0xc04064d2 <arbitrary_virt_to_machine+22>: mov %eax,-0x10(%ebp)
> 0xc04064d5 <arbitrary_virt_to_machine+25>: xor %eax,%eax
> 0xc04064d7 <arbitrary_virt_to_machine+27>: mov %ebx,%eax
> 0xc04064d9 <arbitrary_virt_to_machine+29>:
> call 0xc042f95c <__virt_addr_valid>
> 0xc04064de <arbitrary_virt_to_machine+34>: test %al,%al
> 0xc04064e0 <arbitrary_virt_to_machine+36>:
> je 0xc040650e <arbitrary_virt_to_machine+82>
>
> Michael Young
>
Thanks,
J
next prev parent reply other threads:[~2009-08-20 23:39 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 18:43 pvops dom0 work roadmap Jeremy Fitzhardinge
2009-08-18 20:07 ` Pasi Kärkkäinen
2009-08-18 20:12 ` Jeremy Fitzhardinge
2009-08-18 22:41 ` Pasi Kärkkäinen
2009-08-19 4:16 ` Boris Derzhavets
2009-08-19 7:09 ` pvops dom0 work roadmap / Fedora 11 libvirt problems with Xen 3.4 Pasi Kärkkäinen
2009-08-19 7:27 ` Boris Derzhavets
2009-08-19 9:54 ` Boris Derzhavets
2009-08-19 10:14 ` Boris Derzhavets
2009-08-19 10:27 ` Pasi Kärkkäinen
2009-08-19 12:21 ` Boris Derzhavets
2009-08-19 12:37 ` Pasi Kärkkäinen
2009-08-19 13:05 ` Boris Derzhavets
2009-08-19 13:26 ` Boris Derzhavets
2009-08-19 13:35 ` Boris Derzhavets
2009-08-19 14:32 ` Pasi Kärkkäinen
2009-08-19 15:40 ` Boris Derzhavets
2009-08-19 15:49 ` Boris Derzhavets
2009-08-19 17:00 ` pvops dom0 work roadmap / Fedora 11 domU/guest pygrub grub.conf timeout=0 problem Pasi Kärkkäinen
2009-08-19 17:23 ` Pasi Kärkkäinen
2009-08-19 13:26 ` pvops dom0 work roadmap Konrad Rzeszutek Wilk
2009-08-19 16:19 ` Jeremy Fitzhardinge
2009-08-19 16:54 ` Pasi Kärkkäinen
2009-08-19 17:04 ` Jeremy Fitzhardinge
2009-08-20 10:10 ` Jan Beulich
2009-08-20 16:43 ` Jeremy Fitzhardinge
2009-08-21 6:58 ` Jan Beulich
2009-08-19 17:17 ` Jeremy Fitzhardinge
2009-08-19 17:45 ` Konrad Rzeszutek Wilk
2009-08-19 19:06 ` Jeremy Fitzhardinge
2009-08-19 19:14 ` Konrad Rzeszutek Wilk
2009-08-20 15:49 ` Gianluca Guida
2009-08-20 16:39 ` Konrad Rzeszutek Wilk
2009-08-20 16:36 ` Gianluca Guida
2009-08-20 17:11 ` Konrad Rzeszutek Wilk
2009-08-19 15:27 ` M A Young
2009-08-19 16:21 ` Jeremy Fitzhardinge
2009-08-19 17:35 ` M A Young
2009-08-19 19:08 ` Jeremy Fitzhardinge
2009-08-20 10:43 ` M A Young
2009-08-20 16:22 ` Jeremy Fitzhardinge
2009-08-20 23:17 ` M A Young
2009-08-20 23:39 ` Jeremy Fitzhardinge [this message]
2009-08-20 0:25 ` Daniel Schroeder
2009-08-20 0:42 ` Jeremy Fitzhardinge
2009-08-20 0:46 ` Jeremy Fitzhardinge
2009-08-20 1:56 ` Yu, Ke
2009-09-02 6:47 ` Boris Derzhavets
2009-09-02 13:43 ` Konrad Rzeszutek Wilk
2009-09-02 14:02 ` Boris Derzhavets
-- strict thread matches above, loose matches on Subject: below --
2009-09-02 13:50 Boris Derzhavets
2009-09-02 17:23 Boris Derzhavets
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=4A8DDEC5.9090109@goop.org \
--to=jeremy@goop.org \
--cc=m.a.young@durham.ac.uk \
--cc=xen-devel@lists.xensource.com \
/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.