linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Dynamically allocate memory to store task's full name
@ 2025-03-14  5:27 Bhupesh
  2025-03-14  5:27 ` [PATCH RFC 1/2] exec: " Bhupesh
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bhupesh @ 2025-03-14  5:27 UTC (permalink / raw)
  To: akpm
  Cc: bhupesh, kernel-dev, linux-kernel, bpf, linux-perf-users,
	linux-fsdevel, linux-mm, oliver.sang, lkp, laoar.shao, pmladek,
	rostedt, mathieu.desnoyers, arnaldo.melo, alexei.starovoitov,
	andrii.nakryiko, mirq-linux, peterz, willy, david, viro,
	keescook, ebiederm, brauner, jack, mingo, juri.lelli, bsegall,
	mgorman, vschneid

While working with user-space debugging tools which work especially
on linux gaming platforms, I found that the task name is truncated due
to the limitation of TASK_COMM_LEN.

For example, currently running 'ps', the task->comm value of a long
task name is truncated due to the limitation of TASK_COMM_LEN.
    create_very_lon

This leads to the names passed from userland via pthread_setname_np()
being truncated.

Now, during debug tracing, seeing truncated names is not very useful,
especially on gaming platforms where the number of tasks running can
be very hight.

For example for debug applications invoking 'pthread_getname_np()'
to debug task names.

This RFC aims to start a conversation and improve the initial RFC
patchset to avoid such buffer overflows by introducing a new
dynamically allocated pointer to store task's full name, which
shouldn't introduce too much overhead as it is in the non-critical
path.

After this change, the full name of these (otherwise truncated) tasks
will be shown in 'ps'. For example:
    create_very_long_name_user_space_script.sh

Bhupesh (2):
  exec: Dynamically allocate memory to store task's full name
  fs/proc: Pass 'task->full_name' via 'proc_task_name()'

 fs/exec.c             | 21 ++++++++++++++++++---
 fs/proc/array.c       |  2 +-
 include/linux/sched.h |  9 +++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-18 18:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14  5:27 [PATCH RFC 0/2] Dynamically allocate memory to store task's full name Bhupesh
2025-03-14  5:27 ` [PATCH RFC 1/2] exec: " Bhupesh
2025-03-14  5:27 ` [PATCH RFC 2/2] fs/proc: Pass 'task->full_name' via 'proc_task_name()' Bhupesh
2025-03-14 21:25 ` [PATCH RFC 0/2] Dynamically allocate memory to store task's full name Kees Cook
2025-03-15  7:43   ` Andres Rodriguez
2025-03-18 11:19     ` Bhupesh Sharma
2025-03-18 15:51       ` Kees Cook
2025-03-18 18:06         ` Bhupesh Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox