forked from kubearmor/KubeArmor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubearmor#1017 from daemon1024/refactor-bpf
bpf,enforcer: remove conditional compilation and add alternate bpflsm availability check
- Loading branch information
Showing
21 changed files
with
385 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,5 +102,3 @@ RED=\033[0;31m | |
GREEN=\033[0;32m | ||
CYAN=\033[0;36m | ||
NC=\033[0m | ||
|
||
CFlags = $(shell tr '\n' ' ' < cflags.lst ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// +build ignore | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright 2023 Authors of KubeArmor */ | ||
|
||
#include "vmlinux.h" | ||
#include <bpf/bpf_helpers.h> | ||
|
||
char LICENSE[] SEC("license") = "Dual BSD/GPL"; | ||
|
||
typedef struct { | ||
bool exec; | ||
} event; | ||
|
||
struct { | ||
__uint(type, BPF_MAP_TYPE_RINGBUF); | ||
__uint(max_entries, 1 << 24); | ||
} events SEC(".maps"); | ||
|
||
// Force emitting struct event into the ELF. | ||
const event *unused __attribute__((unused)); | ||
|
||
SEC("lsm/mmap_file") | ||
int test_memfd() { | ||
event *task_info; | ||
|
||
task_info = bpf_ringbuf_reserve(&events, sizeof(event), 0); | ||
if (!task_info) { | ||
return 0; | ||
} | ||
|
||
task_info->exec = true; | ||
|
||
bpf_ringbuf_submit(task_info, 0); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ else | |
make | ||
fi | ||
|
||
cp *.bpf.o ignore.lst /opt/kubearmor/BPF/ | ||
cp *.bpf.o /opt/kubearmor/BPF/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.