linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	Gavin Shan <gshan@redhat.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Subject: Re: [PATCH] mm/debug_vm_pgtable: Drop RANDOM_ORVALUE trick
Date: Thu, 23 May 2024 21:03:23 +0200	[thread overview]
Message-ID: <cd609361-bf39-45c6-a01f-f88362a15847@redhat.com> (raw)
In-Reply-To: <20240523132139.289719-1-peterx@redhat.com>

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@redhat.com>
> Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Gavin Shan <gshan@redhat.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.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@redhat.com>

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-05-23 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 13:21 Peter Xu
2024-05-23 19:03 ` David Hildenbrand [this message]
2024-05-23 23:23 ` Pasha Tatashin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd609361-bf39-45c6-a01f-f88362a15847@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=gshan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterx@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox