[PATCH v3 04/15] KVM: Add common infrastructure for KVM Userfaults
Sean Christopherson
seanjc at google.com
Wed Jun 18 18:27:15 PDT 2025
On Wed, Jun 18, 2025, Oliver Upton wrote:
> On Wed, Jun 18, 2025 at 01:33:17PM -0700, Sean Christopherson wrote:
> > On Wed, Jun 18, 2025, Oliver Upton wrote:
> > And this path is other motiviation for returning a boolean. To me, return "success"
> > when a uaccess fails looks all kinds of wrong:
> >
> > if (__get_user(chunk, user_chunk))
> > return 0;
>
> Yeah, that's gross. Although I would imagine we want to express
> "failure" here, game over, out to userspace for resolution. So maybe:
>
> if (__get_user(chunk, user_chunk))
> return -EFAULT;
I toyed with that idea too, but if kvm_do_userfault() returns a value, that it
bugs me to no end that the callers blindly convert all failures to -EFAULT. To
avoid that, callers would have to be:
r = kvm_do_userfault(vcpu, &fault);
if (r)
return r;
And that just annoyed me. :-) But I'm a-ok with that direction if that's
preferrable to the boolean return.
More information about the linux-arm-kernel
mailing list