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

[email protected]
Newsgroups org.kernel.vger.linux-s390,org.freedesktop.lists.dri-devel,org.kernel.vger.kvm
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.
> 
> 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.
> 
> 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=bEHmfnG54qyBAHFg@mail.gmail.com/
> Cc: [email protected]
> Signed-off-by: Paolo Bonzini <[email protected]>

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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.