diff options
author | Samuel Williams <[email protected]> | 2019-06-20 11:31:22 +1200 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2019-06-20 16:44:50 +1200 |
commit | e4cafa393f8fd4aa207f20b1d122884b4de99cf1 (patch) | |
tree | 78e6a286bcb55b6dd180153b1be9508090c25090 /vm_core.h | |
parent | c26c51449461e3c8ee9bb4e1800933fb3d3caf67 (diff) |
Ensure that vm_stack is cleared in `thread_cleanup_func_before_exec`.
If `vm_stack` is left dangling in a forked process, the gc attempts to scan
it, but it is invalid and will cause a segfault. Therefore, we clear it
before forking.
In order to simplify this, `rb_ec_clear_vm_stack` was introduced.
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -907,6 +907,10 @@ void rb_ec_set_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size); // @param size the size of the stack, as in `VALUE stack[size]`. void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size); +// Clear (set to `NULL`) the vm_stack pointer. +// @param ec the execution context to update. +void rb_ec_clear_vm_stack(rb_execution_context_t *ec); + typedef struct rb_thread_struct { struct list_node vmlt_node; VALUE self; |