From f6fb95dbf5fce38b18c5ce0a88489ee16520006d Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 30 Jul 2018 21:48:32 +0000 Subject: thread_pthread.c (unregister_ubf_list): assert unblock.func is unset We must not allow reentry into ubf_list_head once we delete ourselves, otherwise we could hang in there forever. [ruby-core:88218] [Bug #14945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 844a4bc800..c8487e55f1 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1178,6 +1178,9 @@ unregister_ubf_list(rb_thread_t *th) { struct list_node *node = &th->native_thread_data.ubf_list; + /* we can't allow re-entry into ubf_list_head */ + VM_ASSERT(th->unblock.func == 0); + if (!list_empty((struct list_head*)node)) { rb_native_mutex_lock(&ubf_list_lock); list_del_init(node); -- cgit v1.2.3