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