1 // SPDX-License-Identifier: GPL-2.0 2 3 #include "vmlinux.h" 4 #include <bpf/bpf_tracing.h> 5 #include <bpf/bpf_helpers.h> 6 7 #include "bpf_misc.h" 8 9 char _license[] SEC("license") = "GPL"; 10 11 int bpf_sock_destroy(struct sock_common *sk) __ksym; 12 13 SEC("tp_btf/tcp_destroy_sock") 14 __failure __msg("calling kernel function bpf_sock_destroy is not allowed") 15 int BPF_PROG(trace_tcp_destroy_sock, struct sock *sk) 16 { 17 /* should not load */ 18 bpf_sock_destroy((struct sock_common *)sk); 19 20 return 0; 21 } 22 23