[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <53e114e06a82ed587ef566d07e95390b2e7a036a.camel@intel.com>
Date: Fri, 17 Feb 2023 16:53:38 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "bp@...en8.de" <bp@...en8.de>
CC: "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>,
"Eranian, Stephane" <eranian@...gle.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.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>,
"andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
"oleg@...hat.com" <oleg@...hat.com>,
"Yang, Weijiang" <weijiang.yang@...el.com>,
"Lutomirski, Andy" <luto@...nel.org>,
"hjl.tools@...il.com" <hjl.tools@...il.com>,
"jamorris@...ux.microsoft.com" <jamorris@...ux.microsoft.com>,
"arnd@...db.de" <arnd@...db.de>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Schimpe, Christina" <christina.schimpe@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"john.allen@....com" <john.allen@....com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"rppt@...nel.org" <rppt@...nel.org>,
"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 v5 11/39] x86/mm: Update pte_modify for _PAGE_COW
On Fri, 2023-02-17 at 17:11 +0100, Borislav Petkov wrote:
> On Fri, Feb 10, 2023 at 05:00:05PM +0000, Edgecombe, Rick P wrote:
> > /*
> > * Dirty bit is not preserved above so it can be done
> > * in a special way for the shadow stack case, where it
> > * may need to set _PAGE_SAVED_DIRTY. __pte_mkdirty() will
> > do
> > * this in the case of shadow stack.
> > */
> > if (oldval & _PAGE_DIRTY)
> > if (cpu_feature_enabled(X86_FEATURE_USER_SHSTK) &&
> > !pte_write(pte_result))
> > pte_set_flags(pte_result,
> > _PAGE_SAVED_DIRTY);
> > else
> > pte_set_flags(pte_result, _PAGE_DIRTY);
> > }
> >
> > return pte_result;
> > }
> >
> > So the later logic of doing the _PAGE_SAVED_DIRTY (_PAGE_COW) part
> > is
> > not centralized. It's ok?
>
> I think so.
>
> 1. If you have a single pte_mkdirty() and not also a __ helper, then
> there's less confusion for callers as to which interface they
> should be
> using
>
> 2. The not centralized part is a single conditional so it's not like
> you're saving on gazillion code lines
>
> So I'd prefer that.
>
>
Fair enough, I'll adjust it. Thanks!
Powered by blists - more mailing lists