Thread (5 messages) 5 messages, 3 authors, 2021-11-25

Re: [PATCH v2] kthread: dynamically allocate memory to store kthread's full name

From: Petr Mladek <pmladek@suse.com>
Date: 2021-11-25 09:20:13
Also in: bpf, linux-fsdevel, linux-perf-users, lkml, netdev

On Sat 2021-11-20 11:28:50, Yafang Shao wrote:
When I was implementing a new per-cpu kthread cfs_migration, I found the
comm of it "cfs_migration/%u" is truncated due to the limitation of
TASK_COMM_LEN.

One possible way to fix this issue is extending the task comm size, but
as task->comm is used in lots of places, that may cause some potential
buffer overflows. Another more conservative approach is introducing a new
pointer to store kthread's full name if it is truncated, which won't
introduce too much overhead as it is in the non-critical path. Finally we
make a dicision to use the second approach. See also the discussions in
this thread:
https://lore.kernel.org/lkml/20211101060419.4682-1-laoar.shao@gmail.com/ (local)

After this change, the full name of these truncated kthreads will be
displayed via /proc/[pid]/comm:
Signed-off-by: Yafang Shao <redacted>
Looks good to me:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help