Thread (82 messages) 82 messages, 10 authors, 2021-05-21

Re: [PATCH v26 23/30] x86/cet/shstk: Handle thread shadow stack

From: Yu, Yu-cheng <hidden>
Date: 2021-05-11 18:35:14
Also in: linux-arch, linux-doc, linux-mm, lkml

On 5/10/2021 7:15 AM, Borislav Petkov wrote:
On Tue, Apr 27, 2021 at 01:43:08PM -0700, Yu-cheng Yu wrote:
quoted
@@ -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
quoted
+	/* 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...
quoted
  	if (!ret && unlikely(test_tsk_thread_flag(current, TIF_IO_BITMAP)))
  		io_bitmap_share(p);
... instead of here?

<---
io_bitmap_share() does refcount_inc(&current->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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help