linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>,
	David Rientjes <rientjes@google.com>,
	Paul Turner <pjt@google.com>,
	weixugc@google.com, Greg Thelen <gthelen@google.com>,
	Ingo Molnar <mingo@redhat.com>, Jonathan Corbet <corbet@lwn.net>,
	Will Deacon <will@kernel.org>, Mike Rapoport <rppt@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	masahiroy@kernel.org, Sami Tolvanen <samitolvanen@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	frederic@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Muchun Song <songmuchun@bytedance.com>,
	Fusion Future <qydwhotmail@gmail.com>
Subject: Re: [PATCH v2 3/4] mm: page table check
Date: Wed, 8 Dec 2021 12:35:02 -0500	[thread overview]
Message-ID: <CA+CK2bBanZtit4Ck3wy_9bPha-Frw-SsV4UV4+GneTrcp4qN1A@mail.gmail.com> (raw)
In-Reply-To: <20211207160508.6ef48f273c1ae14c0d02c6ac@linux-foundation.org>

On Tue, Dec 7, 2021 at 7:05 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Sat,  4 Dec 2021 18:23:13 +0000 Pasha Tatashin <pasha.tatashin@soleen.com> wrote:
>
> > Check user page table entries at the time they are added and removed.
> >
> > Allows to synchronously catch memory corruption issues related to double
> > mapping.
> >
> > When a pte for an anonymous page is added into page table, we verify that
> > this pte does not already point to a file backed page, and vice versa if
> > this is a file backed page that is being added we verify that this page
> > does not have an anonymous mapping
> >
> > We also enforce that read-only sharing for anonymous pages is allowed
> > (i.e.  cow after fork).  All other sharing must be for file pages.
> >
> > Page table check allows to protect and debug cases where "struct page"
> > metadata became corrupted for some reason.  For example, when refcnt or
> > mapcount become invalid.
> >
> > ...
> >
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -1307,6 +1307,9 @@ config HAVE_ARCH_PFN_VALID
> >  config ARCH_SUPPORTS_DEBUG_PAGEALLOC
> >       bool
> >
> > +config ARCH_SUPPORTS_PAGE_TABLE_CHECK
> > +     bool
> > +
>
> I guess a dependency on CONFIG_DEBUG_VM would be appropriate?

I do not think CONFIG_DEBUG_VM is needed here. We would like to have
page table check enabled on some production machines to ensure there
are no double mappings. With CONFIG_DEBUG_VM enabled that would not be
possible. For example, CONFIG_PAGE_OWNER, also uses extended struct
page entries and does not depend on CONFIG_DEBUG_VM

Pasha

  reply	other threads:[~2021-12-08 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 18:23 [PATCH v2 0/4] page table check Pasha Tatashin
2021-12-04 18:23 ` [PATCH v2 1/4] mm: change page type prior to adding page table entry Pasha Tatashin
2021-12-04 18:23 ` [PATCH v2 2/4] mm: ptep_clear() page table helper Pasha Tatashin
2021-12-04 18:23 ` [PATCH v2 3/4] mm: page table check Pasha Tatashin
2021-12-08  0:05   ` Andrew Morton
2021-12-08 17:35     ` Pasha Tatashin [this message]
2021-12-04 18:23 ` [PATCH v2 4/4] x86: mm: add x86_64 support for " Pasha Tatashin
2021-12-21 13:09 ` [PATCH v2 0/4] " Fusion Future
2021-12-21 14:48   ` 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=CA+CK2bBanZtit4Ck3wy_9bPha-Frw-SsV4UV4+GneTrcp4qN1A@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=frederic@kernel.org \
    --cc=gthelen@google.com \
    --cc=hpa@zytor.com \
    --cc=jirislaby@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=qydwhotmail@gmail.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=tglx@linutronix.de \
    --cc=weixugc@google.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).