mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
kvm: validate context for kvm cpu get/put operations
Validate that KVM vcpu state is only read/written from cpu thread itself or that cpu is stopped. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
ced6c05143
commit
dbaa07c404
1 changed files with 4 additions and 0 deletions
|
@ -949,6 +949,8 @@ int kvm_arch_put_registers(CPUState *env, int level)
|
|||
{
|
||||
int ret;
|
||||
|
||||
assert(cpu_is_stopped(env) || qemu_cpu_self(env));
|
||||
|
||||
ret = kvm_getput_regs(env, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -991,6 +993,8 @@ int kvm_arch_get_registers(CPUState *env)
|
|||
{
|
||||
int ret;
|
||||
|
||||
assert(cpu_is_stopped(env) || qemu_cpu_self(env));
|
||||
|
||||
ret = kvm_getput_regs(env, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue