From dbc2b89bc042d73e60aeb7d56686aa28d82e2622 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 20 Jun 2019 13:41:18 +1200 Subject: Ensure `vm_stack` is cleared after fork. --- thread.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 492722b085..6c4e6506e8 100644 --- a/thread.c +++ b/thread.c @@ -596,7 +596,11 @@ thread_cleanup_func_before_exec(void *th_ptr) { rb_thread_t *th = th_ptr; th->status = THREAD_KILLED; + // The thread stack doesn't exist in the forked process: th->ec->machine.stack_start = th->ec->machine.stack_end = NULL; + + // The vm_stack is `alloca`ed on the thread stack, so it's gone too: + rb_ec_clear_vm_stack(th->ec); } static void -- cgit v1.2.3