Skip to content

Commit

Permalink
Merge pull request #1863 from Prateeknandle/btf_support
Browse files Browse the repository at this point in the history
fix(ebpf): set min kernel version that handle 1 million instructions to support cwd and throttling
  • Loading branch information
DelusionalOptimist authored Oct 29, 2024
2 parents 2273d81 + fa62463 commit 319b70c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion KubeArmor/BPF/system_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ static __always_inline u32 init_context(sys_context_t *context)
}
}

#if (defined(BTF_SUPPORTED))
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 2, 0) // min version that supports 1 million instructions
struct fs_struct *fs;
fs = READ_KERN(task->fs);
struct path path = READ_KERN(fs->pwd);
Expand All @@ -1046,6 +1046,7 @@ static __always_inline u32 init_context(sys_context_t *context)

// To check if subsequent alerts should be dropped per container
static __always_inline bool should_drop_alerts_per_container(sys_context_t *context, struct pt_regs *ctx, u32 types, args_t *args) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 2, 0)
u64 current_timestamp = bpf_ktime_get_ns();

struct outer_key key = {
Expand Down Expand Up @@ -1112,6 +1113,7 @@ static __always_inline bool should_drop_alerts_per_container(sys_context_t *cont
}

bpf_map_update_elem(&kubearmor_alert_throttle, &key, state, BPF_ANY);
#endif
return false;
}

Expand Down

0 comments on commit 319b70c

Please sign in to comment.