1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/bpf.h> 3 #include <bpf/bpf_helpers.h> 4 #include "bpf_misc.h" 5 6 #define __unused __attribute__((unused)) 7 8 struct { 9 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 10 __uint(max_entries, 1); 11 __uint(key_size, sizeof(__u32)); 12 __uint(value_size, sizeof(__u32)); 13 } jmp_table SEC(".maps"); 14 15 int done = 0; 16 17 SEC("tc") classifier_0(struct __sk_buff * skb __unused)18int classifier_0(struct __sk_buff *skb __unused) 19 { 20 done = 1; 21 return 0; 22 } 23 24 static __noinline subprog_tail(struct __sk_buff * skb)25int subprog_tail(struct __sk_buff *skb) 26 { 27 /* Don't propagate the constant to the caller */ 28 volatile int ret = 1; 29 30 bpf_tail_call_static(skb, &jmp_table, 0); 31 return ret; 32 } 33 34 SEC("tc") entry(struct __sk_buff * skb)35int entry(struct __sk_buff *skb) 36 { 37 /* Have data on stack which size is not a multiple of 8 */ 38 volatile char arr[1] = {}; 39 40 __sink(arr[0]); 41 42 return subprog_tail(skb); 43 } 44 45 char __license[] SEC("license") = "GPL"; 46