]> git.baikalelectronics.ru Git - kernel.git/commit
lguest: fix crash on vmlinux images
authorMatias Zabaljauregui <zabaljauregui@gmail.com>
Wed, 8 Apr 2009 20:58:39 +0000 (17:58 -0300)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 19 Apr 2009 13:44:00 +0000 (23:14 +0930)
commit9a77b3177ad764b50ab6a19132f208b55c23520a
treeb73e2b470a959e60fb5332737c1fca04bb629ba7
parentfcabf658ff6d56431cebc1a53aa13d5cabccf214
lguest: fix crash on vmlinux images

Typical message: 'lguest: unhandled trap 6 at 0x418726 (0x0)'

vmlinux guests were broken by 445311b22043711eefebb602a64c047166deb028
'lguest: use KVM hypercalls', which rewrites guest text from kvm hypercalls
to trap 31.

The Launcher mmaps the kernel image.  The Guest executes and
immediately faults in the first text page (read-only).  Then it hits a
hypercall, and we rewrite that hypercall, causing a copy-on-write.
But the Guest pagetables still refer to the old page: we fault again,
but as Host we see the hypercall already rewritten, and pass the fault
back to the Guest.  The Guest hasn't set up an IDT yet, so we kill it.

This doesn't happen with bzImages: they unpack themselves and so the
text pages are already read-write.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Tested-by: Patrick McHardy <kaber@trash.net>
drivers/lguest/x86/core.c