Re: [PATCH v2] mm/swapfile: unuse_pte can map random data if swap read fails

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

 



On 2022/4/20 21:32, Peter Xu wrote:
> On Wed, Apr 20, 2022 at 02:21:27PM +0800, Miaohe Lin wrote:
>> On 2022/4/20 5:36, Peter Xu wrote:
>>> On Sat, Apr 16, 2022 at 11:05:49AM +0800, Miaohe Lin wrote:
>>>> @@ -1797,6 +1797,17 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
>>>>  		goto out;
>>>>  	}
>>>>  
>>>> +	if (unlikely(!PageUptodate(page))) {
>>>> +		pte_t pteval;
>>>> +
>>>> +		dec_mm_counter(vma->vm_mm, MM_SWAPENTS);
>>>> +		pteval = swp_entry_to_pte(make_swapin_error_entry(page));
>>>> +		set_pte_at(vma->vm_mm, addr, pte, pteval);
>>>> +		swap_free(entry);
>>>> +		ret = 0;
>>>> +		goto out;
>>>> +	}
>>>> +
>>>>  	/* See do_swap_page() */
>>>>  	BUG_ON(!PageAnon(page) && PageMappedToDisk(page));
>>>>  	BUG_ON(PageAnon(page) && PageAnonExclusive(page));
>>>
>>> Totally off-topic, but.. today when I was looking at the unuse path I just
>>> found that the swp bits could have got lost for either soft-dirty and
>>> uffd-wp here?  A quick patch attached.
>>
>> Am I supposed to test-and-send this patch? The patch looks good to me except the
>> build error pointed out by kernel test robot.
> 
> I was planning to post a patch after yours since they're touching the same
> function, but yeah it'll be great if you could also take that over, thanks!

Sure, I will take this in next version. Thanks a lot! :)

> 





[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