0001
0002
0003 #include <linux/sched.h>
0004 #include <linux/ptrace.h>
0005 #include <stdint.h>
0006 #include <stddef.h>
0007 #include <stdbool.h>
0008 #include <linux/bpf.h>
0009 #include <bpf/bpf_helpers.h>
0010 #include <bpf/bpf_tracing.h>
0011
0012 char _license[] SEC("license") = "GPL";
0013
0014 SEC("raw_tracepoint/consume_skb")
0015 int while_true(volatile struct pt_regs* ctx)
0016 {
0017 int i = 0;
0018
0019 while (true) {
0020 if (PT_REGS_RC(ctx) & 1)
0021 i += 3;
0022 else
0023 i += 7;
0024 if (i > 40)
0025 break;
0026 }
0027
0028 return i;
0029 }