From: David Hildenbrand <david@redhat.com>
To: Yafang Shao <laoar.shao@gmail.com>,
akpm@linux-foundation.org, rostedt@goodmis.org,
keescook@chromium.org, pmladek@suse.com, arnaldo.melo@gmail.com,
andrii.nakryiko@gmail.com, alexei.starovoitov@gmail.com
Cc: linux-mm@kvack.org, bpf@vger.kernel.org,
linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Michal Miroslaw <mirq-linux@rere.qmqm.pl>,
Peter Zijlstra <peterz@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH -mm v2 1/3] elfcore: replace old hard-code 16 with TASK_COMM_LEN_16
Date: Mon, 13 Dec 2021 15:41:43 +0100 [thread overview]
Message-ID: <b0539137-c91d-0787-721e-c6ed4ced69ec@redhat.com> (raw)
In-Reply-To: <20211211063949.49533-2-laoar.shao@gmail.com>
On 11.12.21 07:39, Yafang Shao wrote:
> A new macro TASK_COMM_LEN_16 is introduced for the old hard-coded 16 to
> make it more grepable. As explained above this marco, the difference
> between TASK_COMM_LEN and TASK_COMM_LEN_16 is that TASK_COMM_LEN_16 must
> be a fixed size 16 and can't be changed.
>
> Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
> Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Cc: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Petr Mladek <pmladek@suse.com>
> ---
> include/linux/elfcore-compat.h | 8 ++------
> include/linux/elfcore.h | 9 ++-------
> include/linux/sched.h | 5 +++++
> 3 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/elfcore-compat.h b/include/linux/elfcore-compat.h
> index 54feb64e9b5d..69fa1a728964 100644
> --- a/include/linux/elfcore-compat.h
> +++ b/include/linux/elfcore-compat.h
> @@ -5,6 +5,7 @@
> #include <linux/elf.h>
> #include <linux/elfcore.h>
> #include <linux/compat.h>
> +#include <linux/sched.h>
>
> /*
> * Make sure these layouts match the linux/elfcore.h native definitions.
> @@ -43,12 +44,7 @@ struct compat_elf_prpsinfo
> __compat_uid_t pr_uid;
> __compat_gid_t pr_gid;
> compat_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
> - /*
> - * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be
> - * changed as it is exposed to userspace. We'd better make it hard-coded
> - * here.
> - */
> - char pr_fname[16];
> + char pr_fname[TASK_COMM_LEN_16];
> char pr_psargs[ELF_PRARGSZ];
> };
>
> diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
> index 746e081879a5..d3bb4bd3c985 100644
> --- a/include/linux/elfcore.h
> +++ b/include/linux/elfcore.h
> @@ -65,13 +65,8 @@ struct elf_prpsinfo
> __kernel_gid_t pr_gid;
> pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
> /* Lots missing */
> - /*
> - * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be
> - * changed as it is exposed to userspace. We'd better make it hard-coded
> - * here.
> - */
> - char pr_fname[16]; /* filename of executable */
> - char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
> + char pr_fname[TASK_COMM_LEN_16]; /* filename of executable */
> + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
> };
>
> static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index c79bd7ee6029..8d963a50a2a8 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -279,6 +279,11 @@ struct task_group;
> * BPF programs.
> */
> enum {
> + /*
> + * For the old hard-coded 16, which is exposed to userspace and can't
> + * be changed.
> + */
> + TASK_COMM_LEN_16 = 16,
> TASK_COMM_LEN = 16,
> };
>
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-12-13 14:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-11 6:39 [PATCH -mm v2 0/3] Phase 2 of task comm cleanups Yafang Shao
2021-12-11 6:39 ` [PATCH -mm v2 1/3] elfcore: replace old hard-code 16 with TASK_COMM_LEN_16 Yafang Shao
2021-12-13 14:41 ` David Hildenbrand [this message]
2021-12-11 6:39 ` [PATCH -mm v2 2/3] cn_proc: replaced old hard-coded " Yafang Shao
2021-12-12 6:10 ` Michal Miroslaw
2021-12-12 16:26 ` Yafang Shao
2021-12-11 6:39 ` [PATCH -mm v2 3/3] tools/perf: replace " Yafang Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0539137-c91d-0787-721e-c6ed4ced69ec@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=arnaldo.melo@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=keescook@chromium.org \
--cc=laoar.shao@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox