Re: [PATCH v2 5/6] mm: pull writability check to follow_pfnmap_start()

[email protected] Tue, 04 Aug 2026 12:14:15 +0000
Newsgroups gmane.comp.emulators.kvm.devel,gmane.comp.video.dri.devel
Message-ID <[email protected]>
> All callers of follow_pfnmap_start() except s390_pci_mmio_write()
> are following it, if they are doing a write, with a check that
> args.writable is true; for s390_pci_mmio_write() that's a bug.
> Also, most of them return -EFAULT if it is not.  Pull the check
> directly into follow_pfnmap_start() through another input parameter
> args.write_fault, to eliminate the need to do it in the caller.
>=20
> This also fixes an issue where follow_pfnmap_start() would return
> 0 for a PFN that is mapped read-only, and the caller would not
> attempt to call fixup_user_fault() on it; this can happen with
> vm_ops that set .pfn_mkwrite(), for example.  Instead, now the
> caller (for example hva_to_pfn_remapped()) sees an error,
> does attempt to fix it, and only returns -EFAULT if the
> fixup was fruitless.
>=20
> Reported-by: Sergio Lopez <[email protected]>
> Fixes: 28e3918179aa ("drm/gem-shmem: Track folio accessed/dirty status in=
 mmap")
> Link: https://lore.kernel.org/kvm/CAAiTLFU1ALsDoJoKW3d9bUvv990AozAoX=3DbE=
[email protected]/
> Cc: [email protected]
> Signed-off-by: Paolo Bonzini <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260804120529.1730=
[email protected]?part=3D5