From: "mame (Yusuke Endoh) via ruby-core" Date: 2026-06-09T01:07:43+00:00 Subject: [ruby-core:125645] [Ruby Bug#22096] Freeing a mutex locked by a fiber inside fiber scheduler can crash Issue #22096 has been updated by mame (Yusuke Endoh). Is it difficult to write a regression test for this? ---------------------------------------- Bug #22096: Freeing a mutex locked by a fiber inside fiber scheduler can crash https://bugs.ruby-lang.org/issues/22096#change-117494 * Author: luke-gru (Luke Gruber) * Status: Open * Assignee: luke-gru (Luke Gruber) * Target version: 4.1 * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: REQUIRED ---------------------------------------- While freeing a locked mutex, if there is a waiter for the mutex it could call `rb_fiber_scheduler_unblock` which calls into Ruby code. The function `rb_mutex_unlock_th` was a footgun because it was used during normal Ruby code and also during GC. The fix is to not call this function during GC and simply remove the mutex from `th->keeping_mutexes`. [PR](https://github.com/ruby/ruby/pull/17204) [Backport PR](https://github.com/ruby/ruby/pull/17241) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/