Re: [PATCH] mm/debug_vm_pgtable: Drop RANDOM_ORVALUE trick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 23, 2024 at 9:21 AM Peter Xu <peterx@xxxxxxxxxx> 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@xxxxxxxxxx>
> Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>
> Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx>
> Cc: Gavin Shan <gshan@xxxxxxxxxx>
> Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@xxxxxxxxx>
> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@xxxxxxxxx>
> Link: https://lore.kernel.org/r/CABXGCsMB9A8-X+Np_Q+fWLURYL_0t3Y-MdoNabDM-Lzk58-DGA@xxxxxxxxxxxxxx
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
>  mm/debug_vm_pgtable.c | 31 +++++--------------------------
>  1 file changed, 5 insertions(+), 26 deletions(-)

Reviewed-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux