Re: [PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-09 Thread Paolo Bonzini
On 09/02/21 09:14, Christoph Hellwig wrote: On Mon, Feb 08, 2021 at 07:18:56PM +0100, Paolo Bonzini wrote: Fair enough. I would expect that pretty much everyone using follow_pfn will at least want to switch to this one (as it's less bad and not impossible to use correctly), but I'll squash

Re: [PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-09 Thread Christoph Hellwig
On Mon, Feb 08, 2021 at 07:18:56PM +0100, Paolo Bonzini wrote: > Fair enough. I would expect that pretty much everyone using follow_pfn will > at least want to switch to this one (as it's less bad and not impossible to > use correctly), but I'll squash this in: Daniel looked into them, so he

Re: [PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-08 Thread Paolo Bonzini
On 08/02/21 18:39, Christoph Hellwig wrote: +int follow_pte(struct mm_struct *mm, unsigned long address, + pte_t **ptepp, spinlock_t **ptlp) +{ + return follow_invalidate_pte(mm, address, NULL, ptepp, NULL, ptlp); +} +EXPORT_SYMBOL_GPL(follow_pte); I still don't think this

Re: [PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-08 Thread Christoph Hellwig
> +int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, > + struct mmu_notifier_range *range, pte_t **ptepp, > pmd_t **pmdpp, > + spinlock_t **ptlp); This adds a very pointless overy long line. > +/** > + * follow_pte - look up PTE

Re: [PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-05 Thread Jason Gunthorpe
On Fri, Feb 05, 2021 at 05:32:58AM -0500, Paolo Bonzini wrote: > Currently, the follow_pfn function is exported for modules but > follow_pte is not. However, follow_pfn is very easy to misuse, > because it does not provide protections (so most of its callers > assume the page is writable!) and

[PATCH 1/2] mm: provide a sane PTE walking API for modules

2021-02-05 Thread Paolo Bonzini
Currently, the follow_pfn function is exported for modules but follow_pte is not. However, follow_pfn is very easy to misuse, because it does not provide protections (so most of its callers assume the page is writable!) and because it returns after having already unlocked the page table lock.