Project

General

Profile

Actions

Bug #21441

closed

SEGV during thread cleanup if profiler calls thread_profiles_frames at wrong time

Bug #21441: SEGV during thread cleanup if profiler calls thread_profiles_frames at wrong time
2

Added by luke-gru (Luke Gruber) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:122548]

Description

During thread cleanup, if a ruby sampling profiler calls thread_profile_frames at just the wrong time, the ec's stack is cleared but the CFP still exists on the EC, so thread_profile_frames assumes it can walk the stack and crashes.

In rb_ec_clear_vm_stack, it should set cfp to NULL before clearing the stack. If during rc_ec_clear_vm_stack the process gets a signal and this thread handles it and calls thread_profile_frames, the early return check of if (!cfp) fails, it continues and crashes in this function.


Related issues 1 (0 open — 1 closed)

Related to Ruby - Bug #22477: rb_ec_clear_vm_stack() can still clear the VM stack before ec->cfp = NULL on aarch64ClosedEregon (Benoit Daloze)Actions
Actions

Also available in: PDF Atom