• Nadav Amit's avatar
    KVM: x86: Handle errors when RIP is set during far jumps · 48dfdb0c
    Nadav Amit authored
    commit d1442d85 upstream.
    
    Far jmp/call/ret may fault while loading a new RIP.  Currently KVM does not
    handle this case, and may result in failed vm-entry once the assignment is
    done.  The tricky part of doing so is that loading the new CS affects the
    VMCS/VMCB state, so if we fail during loading the new RIP, we are left in
    unconsistent state.  Therefore, this patch saves on 64-bit the old CS
    descriptor and restores it if loading RIP failed.
    
    This fixes CVE-2014-3647.
    Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    [lizf: Backported to 3.4:
     - adjust context
     - __load_segment_descriptor() doesn't take in_task_switch parameter]
    Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
    48dfdb0c
emulate.c 114 KB