linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mike Rapoport <rppt@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Axel Rasmussen <axelrasmussen@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Ives van Hoorne <ives@codesandbox.io>
Subject: Re: [PATCH 2/2] mm/uffd: Sanity check write bit for uffd-wp protected ptes
Date: Thu, 10 Nov 2022 15:28:30 -0500	[thread overview]
Message-ID: <Y21e7vvP54JrtkAp@x1n> (raw)
In-Reply-To: <58FFF1A3-DC37-4D9F-ABF0-3C5DA519BFFB@gmail.com>

On Thu, Nov 10, 2022 at 10:43:25AM -0800, Nadav Amit wrote:
> On Nov 10, 2022, at 7:17 AM, Peter Xu <peterx@redhat.com> wrote:
> 
> > +#ifdef CONFIG_DEBUG_VM
> > +	/*
> > +	 * Having write bit for wr-protect-marked present ptes is fatal,
> > +	 * because it means the uffd-wp bit will be ignored and write will
> > +	 * just go through.
> > +	 *
> > +	 * Use any chance of pgtable walking to verify this (e.g., when
> > +	 * page swapped out or being migrated for all purposes). It means
> > +	 * something is already wrong.  Tell the admin even before the
> > +	 * process crashes. We also nail it with wrong pgtable setup.
> > +	 */
> > +	WARN_ON_ONCE(wp && pte_write(pte));
> 
> How about VM_WARN_ON_ONCE() and no ifdef?

Oops.. Will quickly respin, thanks.

-- 
Peter Xu



      reply	other threads:[~2022-11-10 20:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 15:17 [PATCH 0/2] mm/migrate: Fix writable pte for read migration entry Peter Xu
2022-11-10 15:17 ` [PATCH 1/2] mm/migrate: Fix read-only page got writable when recover pte Peter Xu
2022-11-10 15:17 ` [PATCH 2/2] mm/uffd: Sanity check write bit for uffd-wp protected ptes Peter Xu
2022-11-10 18:43   ` Nadav Amit
2022-11-10 20:28     ` Peter Xu [this message]

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=Y21e7vvP54JrtkAp@x1n \
    --to=peterx@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=ives@codesandbox.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nadav.amit@gmail.com \
    --cc=rppt@linux.vnet.ibm.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