mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yiyang Chen <cyyzero16@gmail.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Wang Yaxin <wang.yaxin@zte.com.cn>, Fan Yu <fan.yu9@zte.com.cn>,
	"Dr . Thomas Orgis" <thomas.orgis@uni-hamburg.de>,
	Yiyang Chen <cyyzero16@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] taskstats: set version in TGID exit notifications
Date: Mon, 30 Mar 2026 03:00:40 +0800	[thread overview]
Message-ID: <ba83d934e59edd431b693607de573eb9ca059309.1774810498.git.cyyzero16@gmail.com> (raw)
In-Reply-To: <cover.1774810498.git.cyyzero16@gmail.com>

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")
Cc: stable@vger.kernel.org
Signed-off-by: Yiyang Chen <cyyzero16@gmail.com>
---
 kernel/taskstats.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 0cd680ccc7e5..73bd6a6a7893 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -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);
-- 
2.43.0


  reply	other threads:[~2026-03-29 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 19:00 [PATCH 0/2] taskstats: fix TGID exit version and tool message truncation Yiyang Chen
2026-03-29 19:00 ` Yiyang Chen [this message]
2026-03-30 21:29   ` [PATCH 1/2] taskstats: set version in TGID exit notifications Andrew Morton
2026-03-31 16:20     ` Yiyang Chen
2026-03-29 19:00 ` [PATCH 2/2] tools/accounting: handle truncated taskstats netlink messages Yiyang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba83d934e59edd431b693607de573eb9ca059309.1774810498.git.cyyzero16@gmail.com \
    --to=cyyzero16@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=fan.yu9@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas.orgis@uni-hamburg.de \
    --cc=wang.yaxin@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®