Skip to content

Commit

Permalink
fix(ebpf): set min kernel version that handle 1 million instructions …
Browse files Browse the repository at this point in the history
…to support cwd and throttling

Signed-off-by: Prateek <[email protected]>
  • Loading branch information
Prateeknandle committed Sep 13, 2024
1 parent dacac4a commit 83b90a9
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 83b90a9

Please sign in to comment.