Re: [RFC PATCH 4/5] mm: add do_set_pte_entry()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/30/2023 9:53 PM, Matthew Wilcox wrote:
> On Mon, Jan 30, 2023 at 08:55:03PM +0800, Yin Fengwei wrote:
>> +++ b/include/linux/mm.h
>> @@ -1061,6 +1061,8 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
>>  
>>  vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page);
>>  void do_set_pte(struct vm_fault *vmf, struct page *page, unsigned long addr);
>> +void do_set_pte_entry(struct vm_fault *vmf, struct page *page,
>> +	 unsigned long addr);
> 
> indentation
> 
>> -void do_set_pte(struct vm_fault *vmf, struct page *page, unsigned long addr)
>> +void do_set_pte_entry(struct vm_fault *vmf, struct page *page,
>> +	unsigned long addr)
> 
> ditto
> 
>>  {
>>  	struct vm_area_struct *vma = vmf->vma;
>>  	bool uffd_wp = pte_marker_uffd_wp(vmf->orig_pte);
>> @@ -4276,6 +4277,16 @@ void do_set_pte(struct vm_fault *vmf, struct page *page, unsigned long addr)
>>  		entry = maybe_mkwrite(pte_mkdirty(entry), vma);
>>  	if (unlikely(uffd_wp))
>>  		entry = pte_mkuffd_wp(entry);
>> +	set_pte_at(vma->vm_mm, addr, vmf->pte, entry);
> 
> I'm not sure this is safe.  As soon as you call set_pte_at(), the page
> can be found by GUP.  If it is, and it doesn't have rmap set up, aren't
> things going to go horribly wrong?
Thanks a lot for pointing this out. I was not aware of the connection of
the sequence here with GUP. Will take care of this in next version by
putting rmap set up before set_pte_at().

Regards
Yin, Fengwei

> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux