From: Zi Yan <ziy@nvidia.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
David Hildenbrand <david@redhat.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
John Hubbard <jhubbard@nvidia.com>,
"Huang, Ying" <ying.huang@linux.alibaba.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Alexander Potapenko <glider@google.com>,
Kees Cook <keescook@chromium.org>,
Vineet Gupta <vgupta@kernel.org>,
linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH v4 2/2] mm: use clear_user_(high)page() for arch with special user folio handling
Date: Mon, 09 Dec 2024 13:14:19 -0500 [thread overview]
Message-ID: <AA1E2DF9-ED7C-4304-8BC5-5555167B1330@nvidia.com> (raw)
In-Reply-To: <673d05d5-276d-4b65-941c-6c9295e276b1@suse.cz>
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@glider.be>
>> Closes: https://lore.kernel.org/linux-mm/CAMuHMdV1hRp_NtR5YnJo=HsfgKQeH91J537Gh4gKk3PFZhSkbA@mail.gmail.com/
>> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
Thanks.
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2024-12-09 18:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-07 17:16 [PATCH v4 1/2] Introduce cpu_icache_is_aliasing() across all architectures Zi Yan
2024-12-07 17:16 ` [PATCH v4 2/2] mm: use clear_user_(high)page() for arch with special user folio handling Zi Yan
2024-12-09 18:12 ` Vlastimil Babka
2024-12-09 18:14 ` Zi Yan [this message]
2024-12-09 18:07 ` [PATCH v4 1/2] Introduce cpu_icache_is_aliasing() across all architectures Vlastimil Babka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AA1E2DF9-ED7C-4304-8BC5-5555167B1330@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=glider@google.com \
--cc=jhubbard@nvidia.com \
--cc=keescook@chromium.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=ryan.roberts@arm.com \
--cc=vbabka@suse.cz \
--cc=vgupta@kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox