[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e8b659e180d5f5848844e3d3506d216718e8ee9.camel@intel.com>
Date: Thu, 2 Mar 2023 17:01:25 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "bp@...en8.de" <bp@...en8.de>
CC: "david@...hat.com" <david@...hat.com>,
"bsingharora@...il.com" <bsingharora@...il.com>,
"hpa@...or.com" <hpa@...or.com>,
"Syromiatnikov, Eugene" <esyr@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"keescook@...omium.org" <keescook@...omium.org>,
"Yu, Yu-cheng" <yu-cheng.yu@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Eranian, Stephane" <eranian@...gle.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"fweimer@...hat.com" <fweimer@...hat.com>,
"nadav.amit@...il.com" <nadav.amit@...il.com>,
"jannh@...gle.com" <jannh@...gle.com>,
"dethoma@...rosoft.com" <dethoma@...rosoft.com>,
"kcc@...gle.com" <kcc@...gle.com>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"pavel@....cz" <pavel@....cz>, "oleg@...hat.com" <oleg@...hat.com>,
"hjl.tools@...il.com" <hjl.tools@...il.com>,
"Yang, Weijiang" <weijiang.yang@...el.com>,
"Lutomirski, Andy" <luto@...nel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"arnd@...db.de" <arnd@...db.de>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Schimpe, Christina" <christina.schimpe@...el.com>,
"mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
"x86@...nel.org" <x86@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"debug@...osinc.com" <debug@...osinc.com>,
"jamorris@...ux.microsoft.com" <jamorris@...ux.microsoft.com>,
"john.allen@....com" <john.allen@....com>,
"rppt@...nel.org" <rppt@...nel.org>,
"andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"corbet@....net" <corbet@....net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"gorcunov@...il.com" <gorcunov@...il.com>
Subject: Re: [PATCH v7 14/41] x86/mm: Introduce _PAGE_SAVED_DIRTY
On Thu, 2023-03-02 at 13:48 +0100, Borislav Petkov wrote:
> On Mon, Feb 27, 2023 at 02:29:30PM -0800, Rick Edgecombe wrote:
> > diff --git a/arch/x86/include/asm/pgtable_types.h
> > b/arch/x86/include/asm/pgtable_types.h
> > index 0646ad00178b..56b374d1bffb 100644
> > --- a/arch/x86/include/asm/pgtable_types.h
> > +++ b/arch/x86/include/asm/pgtable_types.h
> > @@ -21,7 +21,8 @@
> > #define _PAGE_BIT_SOFTW2 10 /* " */
> > #define _PAGE_BIT_SOFTW3 11 /* " */
> > #define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
> > -#define _PAGE_BIT_SOFTW4 58 /* available for programmer
> > */
> > +#define _PAGE_BIT_SOFTW4 57 /* available for programmer
> > */
> > +#define _PAGE_BIT_SOFTW5 58 /* available for programmer
> > */
> > #define _PAGE_BIT_PKEY_BIT0 59 /* Protection Keys, bit 1/4
> > */
> > #define _PAGE_BIT_PKEY_BIT1 60 /* Protection Keys, bit 2/4
> > */
> > #define _PAGE_BIT_PKEY_BIT2 61 /* Protection Keys, bit 3/4
> > */
> > @@ -34,6 +35,15 @@
> > #define _PAGE_BIT_SOFT_DIRTY _PAGE_BIT_SOFTW3 /* software dirty
> > tracking */
> > #define _PAGE_BIT_DEVMAP _PAGE_BIT_SOFTW4
> >
> > +/*
> > + * Indicates a Saved Dirty bit page.
> > + */
> > +#ifdef CONFIG_X86_USER_SHADOW_STACK
> > +#define _PAGE_BIT_SAVED_DIRTY _PAGE_BIT_SOFTW5 /*
> > Saved Dirty bit */
> > +#else
> > +#define _PAGE_BIT_SAVED_DIRTY 0
> > +#endif
> > +
> > /* If _PAGE_BIT_PRESENT is clear, we use these: */
> > /* - if the user mapped it with PROT_NONE; pte_present gives true
> > */
> > #define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL
> > @@ -117,6 +127,25 @@
> > #define _PAGE_SOFTW4 (_AT(pteval_t, 0))
> > #endif
> >
> > +/*
> > + * The hardware requires shadow stack to be Write=0,Dirty=1.
> > However,
> > + * there are valid cases where the kernel might create read-only
> > PTEs that
> > + * are dirty (e.g., fork(), mprotect(), uffd-wp(), soft-dirty
> > tracking). In
> > + * this case, the _PAGE_SAVED_DIRTY bit is used instead of the HW-
> > dirty bit,
> > + * to avoid creating a wrong "shadow stack" PTEs. Such PTEs have
> > + * (Write=0,SavedDirty=1,Dirty=0) set.
> > + *
> > + * Note that on processors without shadow stack support, the
>
> .git/rebase-apply/patch:154: trailing whitespace.
> * Note that on processors without shadow stack support, the
> warning: 1 line adds whitespace errors.
>
> Hm, apparently git checks for that too - not only trailing empty
> lines.
Weird. And oops on the space. Just wondering how checkpatch missed
this. It didn't, just was in a pile of false positives on that patch
and I didn't notice it in there.
Powered by blists - more mailing lists