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: <CAADnVQ+H6oHMFPvWkXuHv9oanHT57F_HrD_ZpxB0X=37vdAoyw@mail.gmail.com>
Date: Wed, 16 Jul 2025 18:37:05 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: KaFai Wan <mannkafai@...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 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.

--
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ