lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzb0YSwqoKn2N4gPJS40atWBRHLkK9fBy=wghkXUC5Sqmw@mail.gmail.com>
Date:   Thu, 21 Oct 2021 14:55:31 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Yafang Shao <laoar.shao@...il.com>
Cc:     Kees Cook <keescook@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>,
        Petr Mladek <pmladek@...e.com>,
        Peter Ziljstra <peterz@...radead.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Valentin Schneider <valentin.schneider@....com>,
        qiang.zhang@...driver.com, robdclark@...omium.org,
        Christian Brauner <christian@...uner.io>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Ingo Molnar <mingo@...hat.com>, juri.lelli@...hat.com,
        Vincent Guittot <vincent.guittot@...aro.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        john fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        "linux-perf-use." <linux-perf-users@...r.kernel.org>,
        linux-fsdevel@...r.kernel.org,
        open list <linux-kernel@...r.kernel.org>,
        oliver.sang@...el.com, kbuild test robot <lkp@...el.com>
Subject: Re: [PATCH v5 03/15] sched.h: introduce TASK_COMM_LEN_16

On Wed, Oct 20, 2021 at 8:45 PM Yafang Shao <laoar.shao@...il.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@...il.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Cc: Petr Mladek <pmladek@...e.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.

>
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ