Project

General

Profile

Actions

Bug #22471

closed

Thread#name= on a terminated thread may dump core

Bug #22471: Thread#name= on a terminated thread may dump core

Added by mame (Yusuke Endoh) about 19 hours ago. Updated about 18 hours ago.

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

Description

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.

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
Actions

Also available in: PDF Atom