[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd609361-bf39-45c6-a01f-f88362a15847@redhat.com>
Date: Thu, 23 May 2024 21:03:23 +0200
From: David Hildenbrand <david@...hat.com>
To: Peter Xu <peterx@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Pavel Tatashin <pasha.tatashin@...een.com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Gavin Shan <gshan@...hat.com>, Anshuman Khandual
<anshuman.khandual@....com>, Mikhail Gavrilov <mikhail.v.gavrilov@...il.com>
Subject: Re: [PATCH] mm/debug_vm_pgtable: Drop RANDOM_ORVALUE trick
On 23.05.24 15:21, Peter Xu wrote:
> Macro RANDOM_ORVALUE was used to make sure the pgtable entry will be
> populated with !none data in clear tests.
>
> The RANDOM_ORVALUE tried to cover mostly all the bits in a pgtable entry,
> even if there's no discussion on whether all the bits will be vaild. Both
> S390 and PPC64 have their own masks to avoid touching some bits. Now it's
> the turn for x86_64.
>
> The issue is there's a recent report from Mikhail Gavrilov showing that
> this can cause a warning with the newly added pte set check in commit
> 8430557fc5 on writable v.s. userfaultfd-wp bit, even though the check
> itself was valid, the random pte is not. We can choose to mask more bits
> out.
>
> However the need to have such random bits setup is questionable, as now
> it's already guaranteed to be true on below:
>
> - For pte level, the pgtable entry will be installed with value from
> pfn_pte(), where pfn points to a valid page. Hence the pte will be
> !none already if populated with pfn_pte().
>
> - For upper-than-pte level, the pgtable entry should contain a directory
> entry always, which is also !none.
>
> All the cases look like good enough to test a pxx_clear() helper. Instead
> of extending the bitmask, drop the "set random bits" trick completely. Add
> some warning guards to make sure the entries will be !none before clear().
>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Pavel Tatashin <pasha.tatashin@...een.com>
> Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.ibm.com>
> Cc: Gavin Shan <gshan@...hat.com>
> Cc: Anshuman Khandual <anshuman.khandual@....com>
> Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@...il.com>
> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@...il.com>
> Link: https://lore.kernel.org/r/CABXGCsMB9A8-X+Np_Q+fWLURYL_0t3Y-MdoNabDM-Lzk58-DGA@mail.gmail.com
> Signed-off-by: Peter Xu <peterx@...hat.com>
Acked-by: David Hildenbrand <david@...hat.com>
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists