[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+CK2bDhAOto1A+TAvGSuNzNTTUd9FZ4m3wV_3rou6AfXJzXzA@mail.gmail.com>
Date: Thu, 23 May 2024 19:23:19 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Peter Xu <peterx@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>, David Hildenbrand <david@...hat.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 Thu, May 23, 2024 at 9:21 AM Peter Xu <peterx@...hat.com> 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>
> ---
> mm/debug_vm_pgtable.c | 31 +++++--------------------------
> 1 file changed, 5 insertions(+), 26 deletions(-)
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.com>
Powered by blists - more mailing lists