[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe6774f4-2554-9c0c-f1b8-110bb9398324@intel.com>
Date: Wed, 9 Sep 2020 16:45:59 -0700
From: "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
To: Dave Hansen <dave.hansen@...el.com>,
Andy Lutomirski <luto@...nel.org>
Cc: Dave Martin <Dave.Martin@....com>, "H.J. Lu" <hjl.tools@...il.com>,
Florian Weimer <fweimer@...hat.com>, X86 ML <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
linux-arch <linux-arch@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.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 <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Weijiang Yang <weijiang.yang@...el.com>
Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for
shadow stack
On 9/9/2020 4:29 PM, Dave Hansen wrote:
> On 9/9/20 4:25 PM, Yu, Yu-cheng wrote:
>> On 9/9/2020 4:11 PM, Dave Hansen wrote:
>>> On 9/9/20 4:07 PM, Yu, Yu-cheng wrote:
>>>> What if a writable mapping is passed to madvise(MADV_SHSTK)? Should
>>>> that be rejected?
>>>
>>> It doesn't matter to me. Even if it's readable, it _stops_ being even
>>> directly readable after it's a shadow stack, right? I don't think
>>> writes are special in any way. If anything, we *want* it to be writable
>>> because that indicates that it can be written to, and we will want to
>>> write to it soon.
>>>
>> But in a PROT_WRITE mapping, all the pte's have _PAGE_BIT_RW set. To
>> change them to shadow stack, we need to clear that bit from the pte's.
>> That will be like mprotect_fixup()/change_protection_range().
>
> The page table hardware bits don't matter. The user-visible protection
> effects matter.
>
> For instance, we have PROT_EXEC, which *CLEARS* a hardware NX PTE bit.
> The PROT_ permissions are independent of the hardware.
Same for shadow stack here. We consider shadow stack "writable", but we
want to clear _PAGE_BIT_RW, which is set for the PTEs of the other type
of "writable" mapping. To change a writable data mapping to a writable
shadow stack mapping, we need to call change_protection_range().
>
> I don't think the interface should be influenced at *all* by what whacko
> PTE bit combinations we have to set to get the behavior.
>
Powered by blists - more mailing lists