lkml.org 
[lkml]   [2023]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH v12 07/33] KVM: Add KVM_EXIT_MEMORY_FAULT exit to report faults to userspace
From
On Fri, Sep 22, 2023, Sean Christopherson wrote:
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 7c0e38752526..d13b646188e5 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -4184,6 +4184,16 @@ static long kvm_vcpu_ioctl(struct file *filp,
> synchronize_rcu();
> put_pid(oldpid);
> }
> +
> + /*
> + * Reset the exit reason if the previous userspace exit was due
> + * to a memory fault. Not all -EFAULT exits are annotated, and
> + * so leaving exit_reason set to KVM_EXIT_MEMORY_FAULT could
> + * result in feeding userspace stale information.
> + */
> + if (vcpu->run->exit_reason == KVM_EXIT_MEMORY_FAULT)
> + vcpu->run->exit_reason = KVM_EXIT_UNKNOWN

Darn semicolons. Doesn't look like I botched anything else though.

> +
> r = kvm_arch_vcpu_ioctl_run(vcpu);
> trace_kvm_userspace_exit(vcpu->run->exit_reason, r);
> break;
>
> base-commit: 2358793cd9062b068ac25ac9c965c00d685eea92
> --
> 2.42.0.515.g380fc7ccd1-goog
>

\
 
 \ /
  Last update: 2023-09-22 18:37    [W:0.216 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site