[ruby-core:127230] [Ruby Bug#22471] Thread#name= on a terminated thread may dump core
Issue #22471 has been reported by mame (Yusuke Endoh). ---------------------------------------- Bug #22471: Thread#name= on a terminated thread may dump core https://bugs.ruby-lang.org/issues/22471 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- Calling `Thread#name=` on a terminated thread calls `pthread_setname_np()` with an invalid `pthread_t`, which can cause a SEGV or rename an unrelated thread. ```ruby ts = 100.times.map { Thread.new {} }.each(&:join) ts.each { |t| t.name = "x" } ``` ``` $ ruby -v test.rb ruby 4.1.0dev (2026-08-21T07:50:27Z master c9e9101403) +PRISM [x86_64-linux] test.rb:2: [BUG] Segmentation fault at 0x0000716a88eae990 ``` -- https://bugs.ruby-lang.org/
Issue #22471 has been updated by mame (Yusuke Endoh). https://github.com/ruby/ruby/pull/19520 ---------------------------------------- Bug #22471: Thread#name= on a terminated thread may dump core https://bugs.ruby-lang.org/issues/22471#change-119646 * Author: mame (Yusuke Endoh) * Status: Open * Backport: 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- Calling `Thread#name=` on a terminated thread calls `pthread_setname_np()` with an invalid `pthread_t`, which can cause a SEGV or rename an unrelated thread. ```ruby ts = 100.times.map { Thread.new {} }.each(&:join) ts.each { |t| t.name = "x" } ``` ``` $ ruby -v test.rb ruby 4.1.0dev (2026-08-21T07:50:27Z master c9e9101403) +PRISM [x86_64-linux] test.rb:2: [BUG] Segmentation fault at 0x0000716a88eae990 ``` -- https://bugs.ruby-lang.org/
Issue #22471 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED ruby_3_4 commit:d545840aa6297fb93d9ffb3e44ac944ace009ce7 merged revision(s) commit:6fdd4520878eebd737d2a702c62051d46f199f89. ---------------------------------------- Bug #22471: Thread#name= on a terminated thread may dump core https://bugs.ruby-lang.org/issues/22471#change-119786 * Author: mame (Yusuke Endoh) * Status: Closed * Backport: 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED ---------------------------------------- Calling `Thread#name=` on a terminated thread calls `pthread_setname_np()` with an invalid `pthread_t`, which can cause a SEGV or rename an unrelated thread. ```ruby ts = 100.times.map { Thread.new {} }.each(&:join) ts.each { |t| t.name = "x" } ``` ``` $ ruby -v test.rb ruby 4.1.0dev (2026-08-21T07:50:27Z master c9e9101403) +PRISM [x86_64-linux] test.rb:2: [BUG] Segmentation fault at 0x0000716a88eae990 ``` -- https://bugs.ruby-lang.org/
Issue #22471 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: DONE, 4.0: DONE ruby_4_0 commit:e041213778c7bfc557b0cecee37f1c82098a0988 merged revision(s) commit:6fdd4520878eebd737d2a702c62051d46f199f89. ---------------------------------------- Bug #22471: Thread#name= on a terminated thread may dump core https://bugs.ruby-lang.org/issues/22471#change-119978 * Author: mame (Yusuke Endoh) * Status: Closed * Backport: 3.3: REQUIRED, 3.4: DONE, 4.0: DONE ---------------------------------------- Calling `Thread#name=` on a terminated thread calls `pthread_setname_np()` with an invalid `pthread_t`, which can cause a SEGV or rename an unrelated thread. ```ruby ts = 100.times.map { Thread.new {} }.each(&:join) ts.each { |t| t.name = "x" } ``` ``` $ ruby -v test.rb ruby 4.1.0dev (2026-08-21T07:50:27Z master c9e9101403) +PRISM [x86_64-linux] test.rb:2: [BUG] Segmentation fault at 0x0000716a88eae990 ``` -- https://bugs.ruby-lang.org/
participants (3)
-
k0kubun (Takashi Kokubun) -
mame (Yusuke Endoh) -
nagachika (Tomoyuki Chikanaga)