[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALzav=d=LaVCFTLxzJD8C_=6+fxjsoLxdKOnxKBgn_QdNDOoXw@mail.gmail.com>
Date: Thu, 11 Jul 2024 16:52:38 -0700
From: David Matlack <dmatlack@...gle.com>
To: James Houghton <jthoughton@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>, Zenghui Yu <yuzenghui@...wei.com>,
Sean Christopherson <seanjc@...gle.com>, Shuah Khan <shuah@...nel.org>, Peter Xu <peterx@...hat.org>,
Axel Rasmussen <axelrasmussen@...gle.com>, kvm@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev
Subject: Re: [RFC PATCH 14/18] KVM: Add asynchronous userfaults, KVM_READ_USERFAULT
On Wed, Jul 10, 2024 at 4:42 PM James Houghton <jthoughton@...gle.com> wrote:
>
> + case KVM_READ_USERFAULT: {
> + struct kvm_fault fault;
> + gfn_t gfn;
> +
> + r = kvm_vm_ioctl_read_userfault(kvm, &gfn);
> + if (r)
> + goto out;
> +
> + fault.address = gfn;
> +
> + /* TODO: if this fails, this gfn is lost. */
> + r = -EFAULT;
> + if (copy_to_user(&fault, argp, sizeof(fault)))
You could do the copy under the spin_lock() with
copy_to_user_nofault() to avoid losing gfn.
Powered by blists - more mailing lists