lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 17 Aug 2021 11:24:29 -0700
From:   "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
To:     Borislav Petkov <bp@...en8.de>
CC:     <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, <linux-kernel@...r.kernel.org>,
        <linux-doc@...r.kernel.org>, <linux-mm@...ck.org>,
        <linux-arch@...r.kernel.org>, <linux-api@...r.kernel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Andy Lutomirski <luto@...nel.org>,
        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 <peterz@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        "Ravi V. Shankar" <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 8/16/2021 3:43 AM, Borislav Petkov wrote:
> On Thu, Jul 22, 2021 at 01:51:56PM -0700, Yu-cheng Yu wrote:
>> @@ -153,13 +178,23 @@ static inline int pud_young(pud_t pud)
>>   
>>   static inline int pte_write(pte_t pte)
>>   {
>> -	return pte_flags(pte) & _PAGE_RW;
>> +	/*
>> +	 * Shadow stack pages are always writable - but not by normal
>> +	 * instructions, and only by shadow stack operations.  Therefore,
>> +	 * the W=0,D=1 test with pte_shstk().
>> +	 */
>> +	return (pte_flags(pte) & _PAGE_RW) || pte_shstk(pte);
> 
> Well, this is weird: if some kernel code queries a shstk page and this
> here function says it is writable but then goes and tries to write into
> it and that write fails, then it'll confuse the user.
> 
> IOW, from where I'm standing, that should be:
> 
> 	return (pte_flags(pte) & _PAGE_RW) && !pte_shstk(pte);
> 
> as in, a writable page is one which has _PAGE_RW and it is *not* a
> shadow stack page because latter is special and not really writable.
> > Hmmm?
> 

Indeed, this can be looked at in a few ways.  We can visualize 
pte_write() as 'CPU can write to it with MOV' or 'CPU can write to it 
with any opcodes'.  Depending on whatever pte_write() is, copy-on-write 
code can be adjusted accordingly.

Yu-cheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ