From: "jhawthorn (John Hawthorn) via ruby-core" Date: 2025-10-27T17:33:35+00:00 Subject: [ruby-core:123549] [Ruby Bug#21649] Ractors can access non-shareable object through singleton classes Issue #21649 has been reported by jhawthorn (John Hawthorn). ---------------------------------------- Bug #21649: Ractors can access non-shareable object through singleton classes https://bugs.ruby-lang.org/issues/21649 * Author: jhawthorn (John Hawthorn) * Status: Open * Assignee: ractor * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- If we send a non-shareable object into a Ractor, it needs to be copied. ``` ��� ruby -W0 -e 'Ractor.new(p(Object.new)) { |o| p(o) }.join' # # ``` However we're able to instead smuggle it through a singleton class to unsafely get a mutable reference to the same object in both Ractors. ``` ��� ruby -W0 -e 'Ractor.new(p(Object.new).singleton_class) { |o| p(o.attached_object) }.join' # # ``` I think we should probably make singleton classes copy the shareability of their attached object. -- 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/