Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ebpf): set min kernel version that handle 1 million instructions to support cwd and throttling #1863

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading