summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2024-01-17 23:58:28 +0300
committerAndrew Morton <akpm@linux-foundation.org>2024-01-17 23:58:28 +0300
commitfe33c0fbed75dd464747c0faaedf94c7d8eb4101 (patch)
tree057a9d98ca492c55708baedcc59bf2ea3e2511c7 /tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c
parent5d4747a6cc8e78ce74742d557fc9b7697fcacc95 (diff)
parent052d534373b7ed33712a63d5e17b2b6cdbce84fd (diff)
downloadlinux-fe33c0fbed75dd464747c0faaedf94c7d8eb4101.tar.xz
Merge branch 'master' into mm-hotfixes-stable
Diffstat (limited to 'tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c b/tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c
new file mode 100644
index 000000000000..624078abf3de
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/freplace_unreliable_prog.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2020 Facebook
+
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+
+SEC("freplace/btf_unreliable_kprobe")
+/* context type is what BPF verifier expects for kprobe context, but target
+ * program has `stuct whatever *ctx` argument, so freplace operation will be
+ * rejected with the following message:
+ *
+ * arg0 replace_btf_unreliable_kprobe(struct pt_regs *) doesn't match btf_unreliable_kprobe(struct whatever *)
+ */
+int replace_btf_unreliable_kprobe(bpf_user_pt_regs_t *ctx)
+{
+ return 0;
+}
+
+char _license[] SEC("license") = "GPL";