[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQJbPpjC6CF=R86PG3N4r3gXMUkaLdUfTSpa3TUQFvgZeA@mail.gmail.com>
Date: Mon, 13 Mar 2023 17:19:37 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: David Vernet <void@...ifault.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...nel.org>,
Dave Marchevsky <davemarchevsky@...a.com>,
Tejun Heo <tj@...nel.org>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 3/3] selftests/bpf: Add various tests to check
helper access into ptr_to_btf_id.
On Mon, Mar 13, 2023 at 5:15 PM David Vernet <void@...ifault.com> wrote:
>
> On Mon, Mar 13, 2023 at 04:58:45PM -0700, Alexei Starovoitov wrote:
> > From: Alexei Starovoitov <ast@...nel.org>
> >
> > Add various tests to check helper access into ptr_to_btf_id.
> >
> > Signed-off-by: Alexei Starovoitov <ast@...nel.org>
>
> Thanks a lot for the quick turnaround on this.
>
> LGTM, just left one small nit below.
>
> Acked-by: David Vernet <void@...ifault.com>
>
> > ---
> > .../selftests/bpf/progs/task_kfunc_failure.c | 36 +++++++++++++++++++
> > .../selftests/bpf/progs/task_kfunc_success.c | 4 +++
> > 2 files changed, 40 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
> > index 002c7f69e47f..27994d6b2914 100644
> > --- a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
> > +++ b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c
> > @@ -301,3 +301,39 @@ int BPF_PROG(task_kfunc_from_lsm_task_free, struct task_struct *task)
> > bpf_task_release(acquired);
> > return 0;
> > }
> > +
> > +SEC("tp_btf/task_newtask")
> > +__failure __msg("access beyond the end of member comm")
> > +int BPF_PROG(task_access_comm1, struct task_struct *task, u64 clone_flags)
> > +{
> > + bpf_strncmp(task->comm, 17, "foo");
>
> Instead of 17, can you do either TASK_COMM_LEN + 1, or
> sizeof(task->comm) + 1, to make the test a bit less brittle? Applies to
> the other testcases as well.
I'd rather not, since it's not brittle.
There were several attempts in the past to increase TASK_COMM_LEN
and all failed. It will stay 16 for the foreseeable future.
Powered by blists - more mailing lists