From: KaFai Wan <mannkafai@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>,
Mykola Lysenko <mykolal@fb.com>, Shuah Khan <shuah@kernel.org>,
Yafang Shao <laoar.shao@gmail.com>,
LKML <linux-kernel@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
Leon Hwang <leon.hwang@linux.dev>
Subject: Re: [PATCH bpf-next v2 3/3] selftests/bpf: Add selftest for attaching tracing programs to functions in deny list
Date: Thu, 17 Jul 2025 22:18:42 +0800 [thread overview]
Message-ID: <2a3a90e4672d497e430ce40d039a90613c4390c0.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQ+H6oHMFPvWkXuHv9oanHT57F_HrD_ZpxB0X=37vdAoyw@mail.gmail.com>
On Wed, 2025-07-16 at 18:37 -0700, Alexei Starovoitov wrote:
> On Mon, Jul 14, 2025 at 5:04 AM KaFai Wan <mannkafai@gmail.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@gmail.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
prev parent reply other threads:[~2025-07-17 14:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 12:04 [PATCH bpf-next v2 0/3] bpf: Show precise rejected function when attaching to __noreturn and deny list functions KaFai Wan
2025-07-14 12:04 ` [PATCH bpf-next v2 1/3] bpf: Show precise rejected function when attaching fexit/fmod_ret to __noreturn functions KaFai Wan
2025-07-14 12:04 ` [PATCH bpf-next v2 2/3] bpf: Add log for attaching tracing programs to functions in deny list KaFai Wan
2025-07-14 12:04 ` [PATCH bpf-next v2 3/3] selftests/bpf: Add selftest " KaFai Wan
2025-07-17 1:37 ` Alexei Starovoitov
2025-07-17 14:18 ` KaFai Wan [this message]
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=2a3a90e4672d497e430ce40d039a90613c4390c0.camel@gmail.com \
--to=mannkafai@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®