diff options
author | KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au> | 2024-02-24 19:31:27 +1100 |
---|---|---|
committer | KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au> | 2024-03-25 14:57:04 +1100 |
commit | 48d3bdddbaeabed5fb6a97bfbe65e250d1383a9c (patch) | |
tree | 01073640401bd6cede2fdce1d285465c29d3eb7c | |
parent | ea31228d0c46763a62abef047d37d66709bdaf87 (diff) | |
download | ruby-48d3bdddbaeabed5fb6a97bfbe65e250d1383a9c.tar.gz |
Move asan_fake_stack_handle to EC, not thread
It's really a property of the EC; each fiber (which has its own EC) also
has its own asan_fake_stack_handle.
[Bug #20310]
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | thread.c | 3 | ||||
-rw-r--r-- | thread_pthread.c | 1 | ||||
-rw-r--r-- | vm_core.h | 9 |
4 files changed, 6 insertions, 9 deletions
@@ -6410,7 +6410,7 @@ gc_mark_machine_stack_location_maybe(rb_objspace_t *objspace, VALUE obj) void *fake_frame_start; void *fake_frame_end; bool is_fake_frame = asan_get_fake_stack_extents( - ec->thread_ptr->asan_fake_stack_handle, obj, + ec->machine.asan_fake_stack_handle, obj, ec->machine.stack_start, ec->machine.stack_end, &fake_frame_start, &fake_frame_end ); @@ -527,9 +527,6 @@ void ruby_thread_init_stack(rb_thread_t *th, void *local_in_parent_frame) { native_thread_init_stack(th, local_in_parent_frame); -#ifdef RUBY_ASAN_ENABLED - th->asan_fake_stack_handle = asan_get_thread_fake_stack_handle(); -#endif } const VALUE * diff --git a/thread_pthread.c b/thread_pthread.c index fb446eee82..cdaf6f240c 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -2081,6 +2081,7 @@ native_thread_init_stack(rb_thread_t *th, void *local_in_parent_frame) rb_nativethread_id_t curr = pthread_self(); #ifdef RUBY_ASAN_ENABLED local_in_parent_frame = asan_get_real_stack_addr(local_in_parent_frame); + th->ec->machine.asan_fake_stack_handle = asan_get_thread_fake_stack_handle(); #endif if (!native_main_thread.id) { @@ -1044,6 +1044,10 @@ struct rb_execution_context_struct { VALUE *stack_end; size_t stack_maxsize; RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs; + +#ifdef RUBY_ASAN_ENABLED + void *asan_fake_stack_handle; +#endif } machine; }; @@ -1164,11 +1168,6 @@ typedef struct rb_thread_struct { void **specific_storage; struct rb_ext_config ext_config; - -#ifdef RUBY_ASAN_ENABLED - void *asan_fake_stack_handle; -#endif - } rb_thread_t; static inline unsigned int |