Staging
v0.5.1
https://github.com/torvalds/linux
Revision 33f9c505ed5c83bd8a07877e5b4628308f4cc099 authored by Avi Kivity on 27 February 2008, 14:06:57 UTC, committed by Avi Kivity on 04 March 2008, 13:19:50 UTC
KVM tries to run as much as possible with the guest msrs loaded instead of
host msrs, since switching msrs is very expensive.  It also tries to minimize
the number of msrs switched according to the guest mode; for example,
MSR_LSTAR is needed only by long mode guests.  This optimization is done by
setup_msrs().

However, we must not change which msrs are switched while we are running with
guest msr state:

 - switch to guest msr state
 - call setup_msrs(), removing some msrs from the list
 - switch to host msr state, leaving a few guest msrs loaded

An easy way to trigger this is to kexec an x86_64 linux guest.  Early during
setup, the guest will switch EFER to not include SCE.  KVM will stop saving
MSR_LSTAR, and on the next msr switch it will leave the guest LSTAR loaded.
The next host syscall will end up in a random location in the kernel.

Fix by reloading the host msrs before changing the msr list.

Signed-off-by: Avi Kivity <avi@qumranet.com>
1 parent f7d9c7b
Raw File
Tip revision: 33f9c505ed5c83bd8a07877e5b4628308f4cc099 authored by Avi Kivity on 27 February 2008, 14:06:57 UTC
KVM: VMX: Avoid rearranging switched guest msrs while they are loaded
Tip revision: 33f9c50
.gitignore
#
# NOTE! Don't add files that are generated in specific
# subdirectories here. Add them in the ".gitignore" file
# in that subdirectory instead.
#
# Normal rules
#
.*
*.o
*.o.*
*.a
*.s
*.ko
*.so
*.so.dbg
*.mod.c
*.i
*.lst
*.symtypes
*.order

#
# Top-level generic files
#
tags
TAGS
vmlinux*
!vmlinux.lds.S
System.map
Module.symvers
!.gitignore

#
# Generated include files
#
include/asm
include/asm-*/asm-offsets.h
include/config
include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h
include/linux/utsrelease.h

# stgit generated dirs
patches-*

# quilt's files
patches
series

# cscope files
cscope.*

*.orig
*.rej
back to top