bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Kees Cook <keescook@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	Petr Mladek <pmladek@suse.com>,
	Peter Ziljstra <peterz@infradead.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Qiang Zhang <qiang.zhang@windriver.com>,
	robdclark <robdclark@chromium.org>,
	Christian Brauner <christian@brauner.io>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Martin Lau <kafai@fb.com>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	john fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	"linux-perf-use." <linux-perf-users@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>,
	kernel test robot <oliver.sang@intel.com>,
	kbuild test robot <lkp@intel.com>
Subject: Re: [PATCH v5 03/15] sched.h: introduce TASK_COMM_LEN_16
Date: Fri, 22 Oct 2021 14:23:27 +0800	[thread overview]
Message-ID: <CALOAHbCu5vXT1DB+d-sv6r2ncBohnqry2uK9R4rYSvbHoVPLOg@mail.gmail.com> (raw)
In-Reply-To: <CAEf4Bzb0YSwqoKn2N4gPJS40atWBRHLkK9fBy=wghkXUC5Sqmw@mail.gmail.com>

On Fri, Oct 22, 2021 at 5:55 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Oct 20, 2021 at 8:45 PM Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > There're many hard-coded 16 used to store task comm in the kernel, that
> > makes it error prone if we want to change the value of TASK_COMM_LEN. A
> > new marco TASK_COMM_LEN_16 is introduced to replace these old ones, then
> > we can easily grep them.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Al Viro <viro@zeniv.linux.org.uk>
> > Cc: Petr Mladek <pmladek@suse.com>
> > ---
> >  include/linux/sched.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index c1a927ddec64..62d5b30d310c 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -274,6 +274,8 @@ struct task_group;
> >
> >  #define get_current_state()    READ_ONCE(current->__state)
> >
> > +/* To replace the old hard-coded 16 */
> > +#define TASK_COMM_LEN_16               16
> >  /* Task command name length: */
> >  #define TASK_COMM_LEN                  16
>
> Can we please convert these two constants into enum? That will allow
> BPF applications to deal with such kernel change more easily because
> these constants will now be available as part of kernel BTF.
>
> Something like this should be completely equivalent for all the kernel uses:
>
> enum {
>     TASK_COMM_LEN = 16,
>     TASK_COMM_LEN_16 = 16,
> };
>
> When later TASK_COMM_LEN is defined as = 24, BPF applications will be
> able to deal with that by querying BTF through BPF CO-RE.
>

Sure. I will convert it to enum.


-- 
Thanks
Yafang

  reply	other threads:[~2021-10-22  6:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  3:45 [PATCH v5 00/15] extend task comm from 16 to 24 for CONFIG_BASE_FULL Yafang Shao
2021-10-21  3:45 ` [PATCH v5 01/15] fs/exec: make __set_task_comm always set a nul ternimated string Yafang Shao
2021-10-21  3:45 ` [PATCH v5 02/15] fs/exec: make __get_task_comm always get a nul terminated string Yafang Shao
2021-10-21  3:45 ` [PATCH v5 03/15] sched.h: introduce TASK_COMM_LEN_16 Yafang Shao
2021-10-21 21:55   ` Andrii Nakryiko
2021-10-22  6:23     ` Yafang Shao [this message]
2021-10-21  3:45 ` [PATCH v5 04/15] cn_proc: make connector comm always nul ternimated Yafang Shao
2021-10-21  3:45 ` [PATCH v5 05/15] drivers/infiniband: make setup_ctxt always get a nul terminated task comm Yafang Shao
2021-10-21  3:45 ` [PATCH v5 06/15] elfcore: make prpsinfo " Yafang Shao
2021-10-21  3:45 ` [PATCH v5 07/15] samples/bpf/kern: use TASK_COMM_LEN instead of hard-coded 16 Yafang Shao
2021-10-21  3:45 ` [PATCH v5 08/15] samples/bpf/user: use TASK_COMM_LEN_16 " Yafang Shao
2021-10-21  3:45 ` [PATCH v5 09/15] tools/include: introduce TASK_COMM_LEN_16 Yafang Shao
2021-10-22  3:52 ` [PATCH v5 00/15] extend task comm from 16 to 24 for CONFIG_BASE_FULL Andrew Morton
2021-10-22  4:00   ` Kees Cook
2021-10-22  6:20     ` 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=CALOAHbCu5vXT1DB+d-sv6r2ncBohnqry2uK9R4rYSvbHoVPLOg@mail.gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christian@brauner.io \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=john.fastabend@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=qiang.zhang@windriver.com \
    --cc=robdclark@chromium.org \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yhs@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).