[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202503141420.37D605B2@keescook>
Date: Fri, 14 Mar 2025 14:25:09 -0700
From: Kees Cook <kees@...nel.org>
To: Bhupesh <bhupesh@...lia.com>
Cc: akpm@...ux-foundation.org, kernel-dev@...lia.com,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
linux-perf-users@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, oliver.sang@...el.com, lkp@...el.com,
laoar.shao@...il.com, pmladek@...e.com, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com, arnaldo.melo@...il.com,
alexei.starovoitov@...il.com, andrii.nakryiko@...il.com,
mirq-linux@...e.qmqm.pl, peterz@...radead.org, willy@...radead.org,
david@...hat.com, viro@...iv.linux.org.uk, ebiederm@...ssion.com,
brauner@...nel.org, jack@...e.cz, mingo@...hat.com,
juri.lelli@...hat.com, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com
Subject: Re: [PATCH RFC 0/2] Dynamically allocate memory to store task's full
name
On Fri, Mar 14, 2025 at 10:57:13AM +0530, Bhupesh wrote:
> 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.
So there have been long discussions about "comm", and it mainly boils
down to "leave it alone". For the /proc-scraping tools like "ps" and
"top", they check both "comm" and "cmdline", depending on mode. The more
useful (and already untruncated) stuff is in "cmdline", so I suspect it
may make more sense to have pthread_setname_np() interact with that
instead. Also TASK_COMM_LEN is basically considered userspace ABI at
this point and we can't sanely change its length without breaking the
world.
Best to use /proc/$pid/task/$tid/cmdline IMO...
-Kees
> 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
>
--
Kees Cook
Powered by blists - more mailing lists