summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-23 00:09:10 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-23 00:09:10 (GMT)
commit5984aa84dbd52de2eb74be52231a380bf6972292 (patch)
tree1e2488fe0ae7c5be02c00717afcf83a1ad0b3d98 /mjit_worker.c
parente38a0b46067fd261a88be608787927ccdf5b7877 (diff)
mjit.c: prevent from accessing expired job
Given that `copy_cache_from_main_thread()` breaks the loop when `stop_worker_p` is TRUE, memory of `job` allocated by `alloca` may be invalid if `stop_worker_p` is already TRUE. mjit_worker.c: explain why `copy_cache_from_main_thread()` should not stop checking `stop_worker_p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index b25dc6f..41d07f0 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -1182,6 +1182,9 @@ copy_cache_from_main_thread(struct mjit_copy_job *job)
return FALSE;
CRITICAL_SECTION_START(3, "in MJIT copy job wait");
+ /* checking `stop_worker_p` too because `RUBY_VM_CHECK_INTS(ec)` may not
+ lush mjit_copy_job_handler when EC_EXEC_TAG() is not TAG_NONE, and then
+ `stop_worker()` could dead lock with this function. */
while (!job->finish_p && !stop_worker_p) {
rb_native_cond_wait(&mjit_worker_wakeup, &mjit_engine_mutex);
verbose(3, "Getting wakeup from client");