[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10673dd87c27ea9def60ff841ebd261d31b46568.camel@intel.com>
Date: Sun, 25 Jun 2023 16:44:32 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "broonie@...nel.org" <broonie@...nel.org>,
"rppt@...nel.org" <rppt@...nel.org>
CC: "Xu, Pengfei" <pengfei.xu@...el.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"kcc@...gle.com" <kcc@...gle.com>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"Lutomirski, Andy" <luto@...nel.org>,
"nadav.amit@...il.com" <nadav.amit@...il.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"david@...hat.com" <david@...hat.com>,
"Schimpe, Christina" <christina.schimpe@...el.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"corbet@....net" <corbet@....net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dethoma@...rosoft.com" <dethoma@...rosoft.com>,
"jannh@...gle.com" <jannh@...gle.com>,
"mike.kravetz@...cle.com" <mike.kravetz@...cle.com>,
"pavel@....cz" <pavel@....cz>, "bp@...en8.de" <bp@...en8.de>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"john.allen@....com" <john.allen@....com>,
"jamorris@...ux.microsoft.com" <jamorris@...ux.microsoft.com>,
"arnd@...db.de" <arnd@...db.de>,
"bsingharora@...il.com" <bsingharora@...il.com>,
"x86@...nel.org" <x86@...nel.org>,
"oleg@...hat.com" <oleg@...hat.com>,
"fweimer@...hat.com" <fweimer@...hat.com>,
"keescook@...omium.org" <keescook@...omium.org>,
"willy@...radead.org" <willy@...radead.org>,
"gorcunov@...il.com" <gorcunov@...il.com>,
"Yu, Yu-cheng" <yu-cheng.yu@...el.com>,
"andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
"hpa@...or.com" <hpa@...or.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"szabolcs.nagy@....com" <szabolcs.nagy@....com>,
"hjl.tools@...il.com" <hjl.tools@...il.com>,
"debug@...osinc.com" <debug@...osinc.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"Syromiatnikov, Eugene" <esyr@...hat.com>,
"Torvalds, Linus" <torvalds@...ux-foundation.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"Yang, Weijiang" <weijiang.yang@...el.com>,
"Eranian, Stephane" <eranian@...gle.com>
Subject: Re: [PATCH v9 16/42] mm: Add guard pages around a shadow stack.
On Fri, 2023-06-23 at 13:17 +0100, Mark Brown wrote:
> On Fri, Jun 23, 2023 at 10:40:00AM +0300, Mike Rapoport wrote:
> > On Thu, Jun 22, 2023 at 06:27:40PM +0000, Edgecombe, Rick P wrote:
>
> > > Yes, I couldn't find another place for it. This was the
> > > reasoning:
> > >
> https://lore.kernel.org/lkml/07deaffc10b1b68721bbbce370e145d8fec2a494.camel@intel.com/
>
> > > Did you have any particular place in mind?
>
> > Since it's near CONFIG_X86_USER_SHADOW_STACK the comment in mm.h
> could be
>
> > /*
> > * VMA is used for shadow stack and implies guard pages.
> > * See arch/x86/kernel/shstk.c for details
> > */
>
> > and the long reasoning comment can be moved near alloc_shstk in
> > arch/x86/kernel/shstk.h
Makes sense. Not sure why I didn't think of this earlier.
>
> This isn't an x86 specific concept, arm64 has a very similar
> extension
> called Guarded Control Stack (which I should be publishing changes
> for
> in the not too distant future) and riscv also has something. For
> arm64
> I'm using the generic mm changes wholesale, we have a similar need
> for
> guard pages around the GCS and while the mechanics of accessing are
> different the requirement ends up being the same. Perhaps we could
> just
> rewrite the comment to say that guard pages prevent over/underflow of
> the stack by userspace and that a single page is sufficient for all
> current architectures, with the details of the working for x86 put in
> some x86 specific place?
Something sort of similar came up in regards to the riscv series, about
adding something like an is_shadow_stack_vma() helper. The plan was to
not make too many assumptions about the final details of the other
shadow stack features and leave that for refactoring. I think some kind
of generic comment like you suggest makes sense, but I don't want to
try to assert any arch specifics for features that are not upstream. It
should be very easy to tweak the comment when the time comes.
The points about x86 details not belonging in non-arch headers and
having some arch generic explanation in the file are well taken though.
Powered by blists - more mailing lists