1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
5 #include <bpf/bpf_tracing.h>
8 char _license[] SEC("license") = "GPL";
13 SEC("tp_btf/bpf_testmod_test_raw_tp_null")
14 int BPF_PROG(test_raw_tp_null, struct sk_buff *skb)
16 struct task_struct *task = bpf_get_current_task_btf();
21 /* If dead code elimination kicks in, the increment +=2 will be
22 * removed. For raw_tp programs attaching to tracepoints in kernel
23 * modules, we mark input arguments as PTR_MAYBE_NULL, so branch
24 * prediction should never kick in.
26 asm volatile ("%[i] += 1; if %[ctx] != 0 goto +1; %[i] += 2;"