lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhSdy1j4HZ86V6VsSF80LuNoxB3L3fmYYtvT7LU93fhbgCuug@mail.gmail.com>
Date: Fri, 24 Oct 2025 13:01:57 +0530
From: Anup Patel <anup@...infault.org>
To: Guo Ren <guoren@...nel.org>
Cc: fangyu.yu@...ux.alibaba.com, atish.patra@...ux.dev, pjw@...nel.org, 
	palmer@...belt.com, aou@...s.berkeley.edu, alex@...ti.fr, pbonzini@...hat.com, 
	jiangyifei@...wei.com, kvm@...r.kernel.org, kvm-riscv@...ts.infradead.org, 
	linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org, jgg@...dia.com, 
	alex.williamson@...hat.com
Subject: Re: [PATCH] RISC-V: KVM: Remove automatic I/O mapping for VM_PFNMAP

On Tue, Oct 21, 2025 at 8:58 PM Guo Ren <guoren@...nel.org> wrote:
>
> On Mon, Oct 20, 2025 at 6:08 AM <fangyu.yu@...ux.alibaba.com> wrote:
> >
> > From: Fangyu Yu <fangyu.yu@...ux.alibaba.com>
> >
> > As of commit aac6db75a9fc ("vfio/pci: Use unmap_mapping_range()"),
> > vm_pgoff may no longer guaranteed to hold the PFN for VM_PFNMAP
> > regions. Using vma->vm_pgoff to derive the HPA here may therefore
> > produce incorrect mappings.
> >
> > Instead, I/O mappings for such regions can be established on-demand
> > during g-stage page faults, making the upfront ioremap in this path
> > is unnecessary.
> >
> > Fixes: 9d05c1fee837 ("RISC-V: KVM: Implement stage2 page table programming")
> The Fixes tag should be 'commit aac6db75a9fc ("vfio/pci: Use
> unmap_mapping_range()")'.
>
> A stable tree necessitates minimizing the "Fixes tag" interference.
>
> We also need to
> Cc: Jason Gunthorpe <jgg@...dia.com>
> Cc: Alex Williamson <alex.williamson@...hat.com>
> For review.
>
> > Signed-off-by: Fangyu Yu <fangyu.yu@...ux.alibaba.com>
> > ---
> >  arch/riscv/kvm/mmu.c | 20 +-------------------
> >  1 file changed, 1 insertion(+), 19 deletions(-)
> >
> > diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> > index 525fb5a330c0..84c04c8f0892 100644
> > --- a/arch/riscv/kvm/mmu.c
> > +++ b/arch/riscv/kvm/mmu.c
> > @@ -197,8 +197,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
> >
> >         /*
> >          * A memory region could potentially cover multiple VMAs, and
> > -        * any holes between them, so iterate over all of them to find
> > -        * out if we can map any of them right now.
> > +        * any holes between them, so iterate over all of them.
> >          *
> >          *     +--------------------------------------------+
> >          * +---------------+----------------+   +----------------+
> > @@ -229,32 +228,15 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
> >                 vm_end = min(reg_end, vma->vm_end);
> >
> >                 if (vma->vm_flags & VM_PFNMAP) {
> > -                       gpa_t gpa = base_gpa + (vm_start - hva);
> > -                       phys_addr_t pa;
> > -
> > -                       pa = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
> > -                       pa += vm_start - vma->vm_start;
> > -
> >                         /* IO region dirty page logging not allowed */
> >                         if (new->flags & KVM_MEM_LOG_DIRTY_PAGES) {
> >                                 ret = -EINVAL;
> >                                 goto out;
> >                         }
> > -
> > -                       ret = kvm_riscv_mmu_ioremap(kvm, gpa, pa, vm_end - vm_start,
> > -                                                   writable, false);
> > -                       if (ret)
> > -                               break;
> Defering the ioremap to the g-stage page fault looks good to me, as it
> simplifies the implementation here.
>
> Acked-by: Guo Ren <guoren@...nel.org>

I think you meant Reviewed-by and not Acked-by.

I have updated the Fixes tag at the time of merging.

Regards,
Anup

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ