Project

General

Profile

Bug #15041 ยป 0001-cont.c-set-th-root_fiber-to-current-fiber-at-fork.patch

normalperson (Eric Wong), 08/29/2018 06:59 AM

View differences:

cont.c
return rb_block_to_s(fibval, &proc->block, status_info);
}
#ifdef HAVE_WORKING_FORK
void
rb_fiber_atfork(rb_thread_t *th)
{
if (&th->root_fiber->cont.saved_ec != th->ec) {
th->root_fiber = th->ec->fiber_ptr;
th->root_fiber->cont.type = ROOT_FIBER_CONTEXT;
}
th->root_fiber->prev = 0;
}
#endif
/*
* Document-class: FiberError
*
test/ruby/test_fiber.rb
end
bug5700 = '[ruby-core:41456]'
assert_nothing_raised(bug5700) do
Fiber.new{ pid = fork {} }.resume
Fiber.new do
pid = fork do
Fiber.new {}.transfer
end
end.resume
end
pid, status = Process.waitpid2(pid)
assert_equal(0, status.exitstatus, bug5700)
thread.c
/* mjit.c */
void mjit_child_after_fork(void);
void rb_fiber_atfork(rb_thread_t *);
void
rb_thread_atfork(void)
{
......
rb_thread_atfork_internal(th, terminate_atfork_i);
th->join_list = NULL;
rb_mutex_cleanup_keeping_mutexes(th);
rb_fiber_atfork(th);
/* We don't want reproduce CVE-2003-0900. */
rb_reset_random_seed();
-
    (1-1/1)