• Matias Zabaljauregui's avatar
    lguest: fix crash on vmlinux images · 88df781a
    Matias Zabaljauregui authored
    Typical message: 'lguest: unhandled trap 6 at 0x418726 (0x0)'
    
    vmlinux guests were broken by 4cd8b5e2
    '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: default avatarRusty Russell <rusty@rustcorp.com.au>
    Tested-by: default avatarPatrick McHardy <kaber@trash.net>
    88df781a
core.c 24.8 KB