[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a645aefc-632f-b1eb-4f4e-1c5b0f9e75d5@intel.com>
Date: Tue, 11 May 2021 11:35:03 -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>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...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>
Subject: Re: [PATCH v26 23/30] x86/cet/shstk: Handle thread shadow stack
On 5/10/2021 7:15 AM, Borislav Petkov wrote:
> On Tue, Apr 27, 2021 at 01:43:08PM -0700, Yu-cheng Yu wrote:
>> @@ -181,6 +184,12 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
>> if (clone_flags & CLONE_SETTLS)
>> ret = set_new_tls(p, tls);
>>
>> +#ifdef CONFIG_X86_64
>
> IS_ENABLED
>
>> + /* Allocate a new shadow stack for pthread */
>> + if (!ret)
>> + ret = shstk_setup_thread(p, clone_flags, stack_size);
>> +#endif
>> +
>
> And why is this addition here...
>
>> if (!ret && unlikely(test_tsk_thread_flag(current, TIF_IO_BITMAP)))
>> io_bitmap_share(p);
>
> ... instead of here?
>
> <---
>
io_bitmap_share() does refcount_inc(¤t->thread.io_bitmap->refcnt),
and the function won't fail. However, shadow stack allocation can fail.
So, maybe leave io_bitmap_share() at the end?
Thanks,
Yu-cheng
Powered by blists - more mailing lists