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: <20250714120408.1627128-4-mannkafai@gmail.com>
Date: Mon, 14 Jul 2025 20:04:08 +0800
From: KaFai Wan <mannkafai@...il.com>
To: ast@...nel.org,
	daniel@...earbox.net,
	john.fastabend@...il.com,
	andrii@...nel.org,
	martin.lau@...ux.dev,
	eddyz87@...il.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	kpsingh@...nel.org,
	sdf@...ichev.me,
	haoluo@...gle.com,
	jolsa@...nel.org,
	mykolal@...com,
	shuah@...nel.org,
	mannkafai@...il.com,
	laoar.shao@...il.com,
	linux-kernel@...r.kernel.org,
	bpf@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	leon.hwang@...ux.dev
Subject: [PATCH bpf-next v2 3/3] selftests/bpf: Add selftest for attaching tracing programs to functions in deny list

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;
+}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ