[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B40D6646-9914-4E14-B20A-C31CC77E4F79@nvidia.com>
Date: Wed, 16 Oct 2024 09:30:31 -0400
From: Zi Yan <ziy@...dia.com>
To: Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, 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@...el.com>,
Ryan Roberts <ryan.roberts@....com>, Alexander Potapenko <glider@...gle.com>,
Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: avoid zeroing user movable page twice with
init_on_alloc=1
On 16 Oct 2024, at 8:53, Vlastimil Babka wrote:
> On 10/11/24 17:03, Zi Yan wrote:
>> Commit 6471384af2a6 ("mm: security: introduce init_on_alloc=1 and
>> init_on_free=1 boot options") forces allocated page to be zeroed in
>> post_alloc_hook() when init_on_alloc=1.
>>
>> For order-0 folios, if arch does not define
>> vma_alloc_zeroed_movable_folio(), the default implementation again zeros
>> the page return from the buddy allocator. So the page is zeroed twice.
>> Fix it by passing __GFP_ZERO instead to avoid double page zeroing.
>> At the moment, s390,arm64,x86,alpha,m68k are not impacted since they
>> define their own vma_alloc_zeroed_movable_folio().
>>
>> For >0 order folios (mTHP and PMD THP), folio_zero_user() is called to
>> zero the folio again. Fix it by calling folio_zero_user() only if
>> init_on_alloc is set. All arch are impacted.
>
> ^ not set?
You are right. The sentence should be:
"Fix it by calling folio_zero_user() only if init_on_alloc is not set."
Hi Andrew,
Do you want me to resend this with fixed commit log?
>
>>
>> Added alloc_zeroed() helper to encapsulate the init_on_alloc check.
>>
>> Signed-off-by: Zi Yan <ziy@...dia.com>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
Thanks.
--
Best Regards,
Yan, Zi
Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)
Powered by blists - more mailing lists