From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH] x86/PV: properly populate descriptor tables
Date: Mon, 26 Oct 2015 14:43:23 +0000 [thread overview]
Message-ID: <562E3C0B.5040908@citrix.com> (raw)
In-Reply-To: <5602E29802000078000A4EAF@prv-mh.provo.novell.com>
On 23/09/15 16:34, Jan Beulich wrote:
> Us extending the GDT limit past the Xen descriptors so far meant that
> guests (including user mode programs) accessing any descriptor table
> slot above the original OS'es limit but below the first Xen descriptor
> caused a #PF, converted to a #GP in our #PF handler. Which is quite
> different from the native behavior, where some of such accesses (LAR
> and LSL) don't fault. Mimic that behavior by mapping a blank page into
> unused slots.
>
> While not strictly required, treat the LDT the same for consistency.
This change causes a 32-bit userspace process running in a 32-bit PV
guest to segfault.
The process is a Go program and it is using the modify_ldt() system call
(which is successful) but loading %gs with the new descriptor causes a
fault. Even a minimal (empty main()) go program faults.
# strace ./go-crash
execve("./go-crash", ["./go-crash"], [/* 21 vars */]) = 0
modify_ldt(1, {entry_number:7, base_addr:0x80a0b28, limit:1048575,
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1,
seg_not_present:0, useable:1}, 16) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
# gdb ./go-crash
...
(gdb) run
Starting program: /root/go-crash
Program received signal SIGSEGV, Segmentation fault.
runtime.setldt () at /usr/local/go/src/runtime/sys_linux_386.s:426
426 /usr/local/go/src/runtime/sys_linux_386.s: No such file or directory.
in /usr/local/go/src/runtime/sys_linux_386.s
(gdb) info registers
eax 0x3f 63
ecx 0xbfffe4f8 -1073748744
edx 0x10 16
ebx 0x1 1
esp 0xbfffe4e8 0xbfffe4e8
ebp 0x809b180 0x809b180
esi 0x0 0
edi 0x0 0
eip 0x80700a1 0x80700a1 <runtime.setldt+81>
eflags 0x10206 [ PF IF RF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x0 0
(gdb) disassem
Dump of assembler code for function runtime.setldt:
...
0x08070060 <runtime.setldt+16>: lea 0x10(%esp),%eax
0x08070064 <runtime.setldt+20>: mov %ebx,(%eax)
0x08070066 <runtime.setldt+22>: mov %ecx,0x4(%eax)
0x08070069 <runtime.setldt+25>: movl $0xfffff,0x8(%eax)
0x08070070 <runtime.setldt+32>: movl $0x51,0xc(%eax)
0x08070077 <runtime.setldt+39>: mov $0x1,%ebx
0x0807007c <runtime.setldt+44>: mov %eax,%ecx
0x0807007e <runtime.setldt+46>: mov $0x10,%edx
0x08070083 <runtime.setldt+51>: mov $0x7b,%eax
0x08070088 <runtime.setldt+56>: call *0x809800c
0x0807008e <runtime.setldt+62>: cmp $0xfffff001,%eax
0x08070093 <runtime.setldt+67>: jbe 0x8070097 <runtime.setldt+71>
0x08070095 <runtime.setldt+69>: int $0x3
0x08070097 <runtime.setldt+71>: mov 0x24(%esp),%eax
0x0807009b <runtime.setldt+75>: shl $0x3,%eax
0x0807009e <runtime.setldt+78>: add $0x7,%eax
0x080700a1 <runtime.setldt+81>: mov %eax,%gs <-- FAULT
0x080700a3 <runtime.setldt+83>: add $0x20,%esp
0x080700a6 <runtime.setldt+86>: ret
David
next prev parent reply other threads:[~2015-10-26 14:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 15:34 [PATCH] x86/PV: properly populate descriptor tables Jan Beulich
2015-09-23 15:47 ` Andrew Cooper
2015-09-24 16:18 ` Wei Liu
2015-10-26 14:43 ` David Vrabel [this message]
2015-10-26 14:55 ` Andrew Cooper
2015-10-26 14:58 ` Andrew Cooper
2015-10-26 15:08 ` Jan Beulich
2015-10-26 15:41 ` David Vrabel
2015-10-26 15:58 ` Jan Beulich
2015-10-26 16:02 ` David Vrabel
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=562E3C0B.5040908@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=keir@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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.