diff --git a/KubeArmor/BPF/enforcer.bpf.c b/KubeArmor/BPF/enforcer.bpf.c index fca8b52e26..02f45a23ea 100644 --- a/KubeArmor/BPF/enforcer.bpf.c +++ b/KubeArmor/BPF/enforcer.bpf.c @@ -428,9 +428,11 @@ int BPF_PROG(enforce_net_create, int family, int type, int protocol) { #define LSM_NET(name, ID) \ int BPF_PROG(name, struct socket *sock) { \ - int type = sock->type; \ - int protocol = sock->sk->sk_protocol; \ - return match_net_rules(type, protocol, ID); \ + int sock_type = BPF_CORE_READ(sock, type); \ + struct sock *sk; \ + sk = BPF_CORE_READ(sock, sk); \ + int protocol = BPF_CORE_READ(sk, sk_protocol); \ + return match_net_rules(sock_type, protocol, ID); \ } SEC("lsm/socket_connect") diff --git a/KubeArmor/enforcer/bpflsm/enforcer_bpfeb.o b/KubeArmor/enforcer/bpflsm/enforcer_bpfeb.o index ea523dfe09..a832c487a9 100644 Binary files a/KubeArmor/enforcer/bpflsm/enforcer_bpfeb.o and b/KubeArmor/enforcer/bpflsm/enforcer_bpfeb.o differ diff --git a/KubeArmor/enforcer/bpflsm/enforcer_bpfel.o b/KubeArmor/enforcer/bpflsm/enforcer_bpfel.o index 33db5b1ca1..a058fdcd26 100644 Binary files a/KubeArmor/enforcer/bpflsm/enforcer_bpfel.o and b/KubeArmor/enforcer/bpflsm/enforcer_bpfel.o differ