Skip to contentSkip to conversation

taskstats: set version in TGID exit notifications

PATCH New Yiyang Chen 1 participant 1 message Mar 29 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 taskstats: set version in TGID exit notifications

delay accounting started populating taskstats records with a valid version field via fill_pid() and fill_tgid().

Later, commit ad4ecbcba728 ("[PATCH] delay accounting taskstats interface send tgid once") changed the TGID exit path to send the cached signal->stats aggregate directly instead of building the outgoing record through fill_tgid(). Unlike fill_tgid(), fill_tgid_exit() only accumulates accounting data and never initializes stats->version.

As a result, TGID exit notifications can reach userspace with version == 0 even though PID exit notifications and TASKSTATS_CMD_GET replies carry a valid taskstats version.

Set stats->version = TASKSTATS_VERSION after copying the cached TGID aggregate into the outgoing netlink payload so all taskstats records are self-describing again.

Fixes ad4ecbcba728 ("[PATCH] delay accounting taskstats interface send tgid once")
---
 kernel/taskstats.c | 1 +
 1 file changed, 1 insertion(+)
kernel/taskstats.c +1 -0
index 0cd680ccc7e5..73bd6a6a7893 100644
@@ -649,6 +649,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead)
 		goto err;
 
 	memcpy(stats, tsk->signal->stats, sizeof(*stats));
+	stats->version = TASKSTATS_VERSION;
 
 send:
 	send_cpu_listeners(rep_skb, listeners);
Signature · 1 line
2.43.0