v5
2026-08-28
支持64字节长任务名 · v5
扩展 task comm 到 64 字节,新增 PR_SET/GET_EXT_NAME prctl,同时保证旧接口仍返回 16 字节并防止溢出。
原始补丁链接
子 Patch(6)
1/6
treewide: Get rid of get_task_comm()
Since commit 4cc0473d7754 (“get rid of __get_task_comm()”), get_task_comm() does just a redundant check for the buffer size and call strscpy_pad(). Replace get_task_comm() calls with strscpy_pad(), th
2/6
treewide: Replace memcpy(..., current->comm) with copy_task_comm()
In order to increase the size of current->comm[] and to avoid breaking any existing code, replace memcpy() with copy_task_comm(). This new function makes sure that the copy is NUL terminated. This is
3/6
lib/string_kunit: Add test for copy_task_comm()
Add a new test for copy_task_comm(). Check if a copy from a task_struct works, and special cases when the size of source and destination buffer mismatches. Signed-off-by: André Almeida <andrealmeid@i
4/6
sched: Extend task command name with TASK_COMM_EXT_LEN
Command name has been restrict to only 16 bytes, which is too limiting, specially when debugging and tracing complex software with thousands of threads and the need to differentiate them. Just as it
5/6
prctl: Add support for long user thread names
Add support for getting and setting long user thread names with PR_{SET,GET}_EXT_NAME. Signed-off-by: André Almeida andrealmeid@igalia.com — include/linux/sched.h | 2 +- include/uapi/linu
6/6
selftests: prctl: Add test for long thread names
Add tests for the new interface to set and get long thread names. The kernel should accept the LONG_NAME and returning it accordingly. For the old PR_GET_NAME interface, the kernel should truncate the