]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/accounting: handle truncated taskstats netlink messages
authorYiyang Chen <cyyzero16@gmail.com>
Sun, 29 Mar 2026 19:00:41 +0000 (03:00 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 15 Apr 2026 09:15:02 +0000 (02:15 -0700)
commitcc82b3dcc6a8fa259fbda12ab00d6fc00908a49e
tree606b8e5fecb2798b14b51d61a129aa586add2ef8
parent16c4f0211aaa1ec1422b11b59f64f1abe9009fc0
tools/accounting: handle truncated taskstats netlink messages

procacct and getdelays use a fixed receive buffer for taskstats generic
netlink messages.  A multi-threaded process exit can emit a single
PID+TGID notification large enough to exceed that buffer on newer kernels.

Switch to recvmsg() so MSG_TRUNC is detected explicitly, increase the
message buffer size, and report truncated datagrams clearly instead of
misparsing them as fatal netlink errors.

Also print the taskstats version in debug output to make version
mismatches easier to diagnose while inspecting taskstats traffic.

Link: https://lkml.kernel.org/r/520308bb4cbbaf8dc2c7296b5f60f11e12fb30a5.1774810498.git.cyyzero16@gmail.com
Signed-off-by: Yiyang Chen <cyyzero16@gmail.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Dr. Thomas Orgis <thomas.orgis@uni-hamburg.de>
Cc: Fan Yu <fan.yu9@zte.com.cn>
Cc: Wang Yaxin <wang.yaxin@zte.com.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/accounting/getdelays.c
tools/accounting/procacct.c