]> git.ipfire.org Git - thirdparty/systemd.git/commit
coredump: capture crashing thread ID and name
authornoxiouz <atiurin@proton.me>
Fri, 13 Mar 2026 00:36:08 +0000 (00:36 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 18 Mar 2026 10:27:27 +0000 (10:27 +0000)
commit4c7af7d9d1cd40e2f36a87787ce2fab32400bf89
tree2cbb9f29814f547d3b0c57a871503cc9bce1ecc6
parent8a2c423870d8c8997471f61846853c0d54e109f3
coredump: capture crashing thread ID and name

Add %I (TID in initial PID namespace) to the core_pattern, so the
kernel passes the crashing thread's TID to systemd-coredump. Use it
to read the thread's comm name from /proc/<tid>/comm and log both as
new journal fields:

  COREDUMP_TID=       — TID of the crashing thread
  COREDUMP_THREAD_NAME= — comm name of the crashing thread

These fields are also stored as xattrs on external coredump files
(user.coredump.tid, user.coredump.thread_name) and displayed by
coredumpctl info alongside the PID line.

For single-threaded processes the TID equals the PID and thread_name
equals comm; for multi-threaded programs with named worker threads
(pthread_setname_np / PR_SET_NAME) this identifies which thread
crashed without needing to open the coredump file itself.

The new fields are optional in the socket forwarding path, so older
systemd-coredump senders are handled gracefully.

Co-developed-by: Claude <claude@anthropic.com>
src/coredump/coredump-context.c
src/coredump/coredump-context.h
src/coredump/coredump-submit.c
src/coredump/coredumpctl.c
sysctl.d/50-coredump.conf.in
test/units/TEST-87-AUX-UTILS-VM.coredump.sh