On 9 Dec 2024, at 13:12, Vlastimil Babka wrote:

> On 12/7/24 18:16, Zi Yan wrote:
>> Some architectures have special handling after clearing user folios:
>> architectures, which set cpu_dcache_is_aliasing() to true, require
>> flushing dcache; arc, which sets cpu_icache_is_aliasing() to true, changes
>> folio->flags to make icache coherent to dcache. So __GFP_ZERO using only
>> clear_page() is not enough to zero user folios and clear_user_(high)page()
>> must be used. Otherwise, user data will be corrupted.
>>
>> Fix it by always clearing user folios with clear_user_(high)page() when
>> cpu_dcache_is_aliasing() is true or cpu_icache_is_aliasing() is true.
>> Rename alloc_zeroed() to alloc_need_zeroing() and invert the logic to
>> clarify its intend.
>
> user_alloc_needs_zeroing() would be perhaps more descriptive?

Sounds good. Let me send v5.

>
>> Fixes: 5708d96da20b ("mm: avoid zeroing user movable page twice with 
>> init_on_alloc=1")
>> Reported-by: Geert Uytterhoeven <geert+rene...@glider.be>
>> Closes: 
>> https://lore.kernel.org/linux-mm/CAMuHMdV1hRp_NtR5YnJo=hsfgkqeh91j537gh4gkk3pfzhs...@mail.gmail.com/
>> Tested-by: Geert Uytterhoeven <geert+rene...@glider.be>
>> Signed-off-by: Zi Yan <z...@nvidia.com>
>
> Acked-by: Vlastimil Babka <vba...@suse.cz>

Thanks.


Best Regards,
Yan, Zi

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Reply via email to