[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9D9A6A63-8B74-47FA-B50E-C4A993258944@nvidia.com>
Date: Tue, 15 Oct 2024 11:45:14 -0400
From: Zi Yan <ziy@...dia.com>
To: Jann Horn <jannh@...gle.com>
Cc: David Hildenbrand <david@...hat.com>,
"Kirill A. Shutemov" <kirill@...temov.name>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, syzbot+7d917f67c05066cec295@...kaller.appspotmail.com,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v1] mm/pagewalk: fix usage of pmd_leaf()/pud_leaf()
without present check
On 15 Oct 2024, at 10:43, Jann Horn wrote:
> On Tue, Oct 15, 2024 at 4:40 PM David Hildenbrand <david@...hat.com> wrote:
>> On 15.10.24 16:32, Kirill A. Shutemov wrote:
>>> On Tue, Oct 15, 2024 at 01:12:36PM +0200, David Hildenbrand wrote:
>>>> pmd_leaf()/pud_leaf() only implies a pmd_present()/pud_present() check on
>>>> some architectures.
>>>
>>> Should we clarify what behaviour we actually want from arch code?
>>
>> We probably should document somewhere that things like pmd_special(),
>> pmd_leaf() ... should only be used when we know that the PMD is present.
>>
>> I wonder if we should even add ways to detect mis-use
>>
>> Jann also raised that recently in a private message, that it is rather
>> unclear (well, and repeatedly leads to issues) when pmd_leaf() is valid
>> to be called.
>
> I think one place where that should probably be addressed is in
> Documentation/mm/arch_pgtable_helpers.rst - that is supposed to be an
> overview of these helper functions and what they mean, but the only
> thing it currently says about pmd_leaf() is "Tests a leaf mapped PMD",
> which doesn't really tell you much more than the function name. It
> would be nice if that table contained information about the conditions
> under which these helpers may be used.
I find the related documentation in include/linux/pgtable.h [1], but it is
not an easy find.
[1] https://elixir.bootlin.com/linux/v6.11.3/source/include/linux/pgtable.h#L1865
Best Regards,
Yan, Zi
Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)
Powered by blists - more mailing lists