aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/raw_tp_null.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-12-20 14:09:45 +0100
committerTakashi Iwai <tiwai@suse.de>2024-12-20 14:09:45 +0100
commit8cbd01ba9c38eb16f3a572300da486ac544519b7 (patch)
treee9a800bcb96bf8e937ddf0d420514dccbc6c1a75 /tools/testing/selftests/bpf/progs/raw_tp_null.c
parent66a0a2b0473c39ae85c44628d14e4366fdc0aa0d (diff)
parent32c9c06adb5b157ef259233775a063a43746d699 (diff)
downloadlinux-8cbd01ba9c38eb16f3a572300da486ac544519b7.tar.gz
linux-8cbd01ba9c38eb16f3a572300da486ac544519b7.tar.bz2
linux-8cbd01ba9c38eb16f3a572300da486ac544519b7.zip
Merge tag 'asoc-fix-v6.13-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.13 A mix of quirks and small fixes, nothing too major anywhere.
Diffstat (limited to 'tools/testing/selftests/bpf/progs/raw_tp_null.c')
-rw-r--r--tools/testing/selftests/bpf/progs/raw_tp_null.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/testing/selftests/bpf/progs/raw_tp_null.c b/tools/testing/selftests/bpf/progs/raw_tp_null.c
index 457f34c151e3..5927054b6dd9 100644
--- a/tools/testing/selftests/bpf/progs/raw_tp_null.c
+++ b/tools/testing/selftests/bpf/progs/raw_tp_null.c
@@ -3,6 +3,7 @@
#include <vmlinux.h>
#include <bpf/bpf_tracing.h>
+#include "bpf_misc.h"
char _license[] SEC("license") = "GPL";
@@ -17,16 +18,14 @@ int BPF_PROG(test_raw_tp_null, struct sk_buff *skb)
if (task->pid != tid)
return 0;
- i = i + skb->mark + 1;
- /* The compiler may move the NULL check before this deref, which causes
- * the load to fail as deref of scalar. Prevent that by using a barrier.
+ /* If dead code elimination kicks in, the increment +=2 will be
+ * removed. For raw_tp programs attaching to tracepoints in kernel
+ * modules, we mark input arguments as PTR_MAYBE_NULL, so branch
+ * prediction should never kick in.
*/
- barrier();
- /* If dead code elimination kicks in, the increment below will
- * be removed. For raw_tp programs, we mark input arguments as
- * PTR_MAYBE_NULL, so branch prediction should never kick in.
- */
- if (!skb)
- i += 2;
+ asm volatile ("%[i] += 1; if %[ctx] != 0 goto +1; %[i] += 2;"
+ : [i]"+r"(i)
+ : [ctx]"r"(skb)
+ : "memory");
return 0;
}