[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AA1E2DF9-ED7C-4304-8BC5-5555167B1330@nvidia.com>
Date: Mon, 09 Dec 2024 13:14:19 -0500
From: Zi Yan <ziy@...dia.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
David Hildenbrand <david@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Miaohe Lin <linmiaohe@...wei.com>, Kefeng Wang <wangkefeng.wang@...wei.com>,
John Hubbard <jhubbard@...dia.com>,
"Huang, Ying" <ying.huang@...ux.alibaba.com>,
Ryan Roberts <ryan.roberts@....com>, Alexander Potapenko <glider@...gle.com>,
Kees Cook <keescook@...omium.org>, Vineet Gupta <vgupta@...nel.org>,
linux-kernel@...r.kernel.org, linux-snps-arc@...ts.infradead.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: Re: [PATCH v4 2/2] mm: use clear_user_(high)page() for arch with
special user folio handling
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+renesas@...der.be>
>> Closes: https://lore.kernel.org/linux-mm/CAMuHMdV1hRp_NtR5YnJo=HsfgKQeH91J537Gh4gKk3PFZhSkbA@mail.gmail.com/
>> Tested-by: Geert Uytterhoeven <geert+renesas@...der.be>
>> Signed-off-by: Zi Yan <ziy@...dia.com>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
Thanks.
Best Regards,
Yan, Zi
Powered by blists - more mailing lists