[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87cbd676-5b60-da55-1f95-c5a6ae61e3fc@intel.com>
Date: Tue, 17 Aug 2021 11:36:21 -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 16/32] x86/mm: Update maybe_mkwrite() for shadow stack
On 8/16/2021 10:03 AM, Borislav Petkov wrote:
> On Thu, Jul 22, 2021 at 01:52:03PM -0700, Yu-cheng Yu wrote:
>> diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
>> index 3364fe62b903..ba449d12ec32 100644
>> --- a/arch/x86/mm/pgtable.c
>> +++ b/arch/x86/mm/pgtable.c
>> @@ -610,6 +610,26 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma,
>> }
>> #endif
>>
>> +pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
>> +{
>> + if (likely(vma->vm_flags & VM_WRITE))
>> + pte = pte_mkwrite(pte);
>> + else if (likely(vma->vm_flags & VM_SHADOW_STACK))
>> + pte = pte_mkwrite_shstk(pte);
>> + return pte;
>> +}
>> +
>> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>> +pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma)
>> +{
>> + if (likely(vma->vm_flags & VM_WRITE))
>> + pmd = pmd_mkwrite(pmd);
>> + else if (likely(vma->vm_flags & VM_SHADOW_STACK))
>> + pmd = pmd_mkwrite_shstk(pmd);
>
> What are all those likely()ies here for?
>
I will remove those.
Thanks,
Yu-cheng
Powered by blists - more mailing lists