[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <490345b6-3e3d-4692-8162-85dcb71434c9@www.fastmail.com>
Date: Tue, 17 Aug 2021 13:51:52 -0700
From: "Andy Lutomirski" <luto@...nel.org>
To: "Borislav Petkov" <bp@...en8.de>,
"luto@...capital.net" <luto@...capital.net>
Cc: "Yu-cheng Yu" <yu-cheng.yu@...el.com>,
"the arch/x86 maintainers" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"Thomas Gleixner" <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
linux-doc@...r.kernel.org, linux-mm@...ck.org,
linux-arch@...r.kernel.org,
"Linux API" <linux-api@...r.kernel.org>,
"Arnd Bergmann" <arnd@...db.de>,
"Balbir Singh" <bsingharora@...il.com>,
"Cyrill Gorcunov" <gorcunov@...il.com>,
"Dave Hansen" <dave.hansen@...ux.intel.com>,
"Eugene Syromiatnikov" <esyr@...hat.com>,
"Florian Weimer" <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, "Jann Horn" <jannh@...gle.com>,
"Jonathan Corbet" <corbet@....net>,
"Kees Cook" <keescook@...omium.org>,
"Mike Kravetz" <mike.kravetz@...cle.com>,
"Nadav Amit" <nadav.amit@...il.com>,
"Oleg Nesterov" <oleg@...hat.com>, "Pavel Machek" <pavel@....cz>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
"Randy Dunlap" <rdunlap@...radead.org>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
"Dave Martin" <Dave.Martin@....com>,
"Weijiang Yang" <weijiang.yang@...el.com>,
"Pengfei Xu" <pengfei.xu@...el.com>,
"Haitao Huang" <haitao.huang@...el.com>,
"Rick P Edgecombe" <rick.p.edgecombe@...el.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH v28 09/32] x86/mm: Introduce _PAGE_COW
On Tue, Aug 17, 2021, at 1:24 PM, Borislav Petkov wrote:
> On Tue, Aug 17, 2021 at 01:13:09PM -0700, Andy Lutomirski wrote:
> > > If special kernel code using shadow stack management insns needs
> > > to modify a shadow stack, then it can check whether a page is
> > > pte/pmd_shstk() but that code is special anyway.
> > >
> > > Hell, a shadow stack page is (Write=0, Dirty=1) so calling it writable
> > > ^^^^^^^
> > > is simply wrong.
> >
> > But it *is* writable using WRUSS, and it’s also writable by CALL,
>
> Well, if we have to be precise, CALL doesn't write it directly - it
> causes for shadow stack to be written as part of CALL's execution. Yeah
> yeah, potato potato.
Potahto.
>
> > WRSS, etc.
>
> Thus the "special kernel code" thing above. I've left it in instead of
> snipping it.
>
WRSS can be used from user mode depending on the configuration.
> > Now if the mm code tries to write protect it and expects sensible
> > semantics, the results could be interesting. At the very least,
> > someone would need to validate that RET reading a read only shadow
> > stack page does the right thing.
>
> Huh?
>
> A shadow stack page is RO (W=0).
Double-you shmouble-you. You can't write it with MOV, but you can write it from user code and from kernel code. As far as the mm is concerned, I think it should be considered writable.
Although... anyone who tries to copy_to_user() it is going to be a bit surprised. Hmm.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
>
Powered by blists - more mailing lists