[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2a3a90e4672d497e430ce40d039a90613c4390c0.camel@gmail.com>
Date: Thu, 17 Jul 2025 22:18:42 +0800
From: KaFai Wan <mannkafai@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, John Fastabend <john.fastabend@...il.com>, Andrii
Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard <eddyz87@...il.com>, Song Liu <song@...nel.org>, Yonghong Song
<yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, Stanislav
Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa
<jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>, Shuah Khan
<shuah@...nel.org>, Yafang Shao <laoar.shao@...il.com>, LKML
<linux-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>, "open
list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>, Leon
Hwang <leon.hwang@...ux.dev>
Subject: Re: [PATCH bpf-next v2 3/3] selftests/bpf: Add selftest for
attaching tracing programs to functions in deny list
On Wed, 2025-07-16 at 18:37 -0700, Alexei Starovoitov wrote:
> On Mon, Jul 14, 2025 at 5:04 AM KaFai Wan <mannkafai@...il.com>
> wrote:
> >
> > The reuslt:
> >
> > $ tools/testing/selftests/bpf/test_progs --name=tracing_deny
> > #467/1 tracing_deny/migrate_disable:OK
> > #467 tracing_deny:OK
> > Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED
> >
> > Signed-off-by: KaFai Wan <mannkafai@...il.com>
> > ---
> > .../selftests/bpf/prog_tests/tracing_deny.c | 11 +++++++++++
> > tools/testing/selftests/bpf/progs/tracing_deny.c | 15
> > +++++++++++++++
> > 2 files changed, 26 insertions(+)
> > create mode 100644
> > tools/testing/selftests/bpf/prog_tests/tracing_deny.c
> > create mode 100644
> > tools/testing/selftests/bpf/progs/tracing_deny.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_deny.c
> > b/tools/testing/selftests/bpf/prog_tests/tracing_deny.c
> > new file mode 100644
> > index 000000000000..460c59a9667f
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/tracing_deny.c
> > @@ -0,0 +1,11 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <test_progs.h>
> > +#include "tracing_deny.skel.h"
> > +
> > +void test_tracing_deny(void)
> > +{
> > + /* migrate_disable depends on CONFIG_SMP */
> > + if (libbpf_find_vmlinux_btf_id("migrate_disable",
> > BPF_TRACE_FENTRY) > 0)
> > + RUN_TESTS(tracing_deny);
> > +}
> > diff --git a/tools/testing/selftests/bpf/progs/tracing_deny.c
> > b/tools/testing/selftests/bpf/progs/tracing_deny.c
> > new file mode 100644
> > index 000000000000..98ef834f0b6d
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/tracing_deny.c
> > @@ -0,0 +1,15 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <linux/bpf.h>
> > +#include <bpf/bpf_helpers.h>
> > +#include <bpf/bpf_tracing.h>
> > +#include "bpf_misc.h"
> > +
> > +char _license[] SEC("license") = "GPL";
> > +
> > +SEC("fentry/migrate_disable")
> > +__failure __msg("Attaching tracing programs to function
> > 'migrate_disable' is rejected.")
> > +int BPF_PROG(migrate_disable)
> > +{
> > + return 0;
> > +}
>
> Please roll these two tiny files into existing files in progs/ and
> prog_tests/
> directories.
> Every file takes time to compile 4 times, so let's avoid unnecessary
> overhead.
>
Okay, will update it in v3.
> --
> pw-bot: cr
--
Thanks,
KaFai
Powered by blists - more mailing lists