Hi Aneesh,

On Mon, Aug 03, 2026 at 11:36:33AM +0530, Aneesh Kumar K.V wrote:
> Alexandru Elisei <[email protected]> writes:
> 
> > Hi Jack,
> >
> > On Fri, Jun 12, 2026 at 05:23:50PM +0100, Jack Thomson wrote:
> >> From: Jack Thomson <[email protected]>
> 
> ....
> 
> >> +          if (kvm_is_error_hva(hva)) {
> >> +                  ret = -EFAULT;
> >> +                  goto out;
> >> +          }
> >> +
> >> +          s2fd.hva = hva;
> >> +          ret = user_mem_abort(&s2fd);
> >
> > If is_protected_kvm_enabled(), this function doesn't check if the mapping
> > already exists. user_mem_abort() will call **p**kvm_pgtable_stage2_map()
> > (emphasis is mine) to create the mapping, and pkvm_pgtable_stage2_map() will
> > return -EAGAIN, and keep returning -EAGAIN until the mapping is destroyed, 
> > which
> > might be some time away.
> >
> > Same thing happens **without** pKVM, kvm_pgtable_stage2_map() will return
> > -EAGAIN if the mapping exists. But that's not such a big issue, when the
> > user calls KVM_PRE_FAULT_MEMORY on the remaining range
> > kvm_pgtable_get_leaf() will detect the existing mapping. Which you have
> > already taken into consideration judging by the comment, so all good here.
> >
> 
> But both gmem_abort() and user_mem_abort() handle -EAGAIN internally, don't 
> they?

I think you're right, please ignore my comment about an existing mapping with
is_protected_kvm_enabled().

Thanks,
Alex

Reply via email to