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

[WIP] system-monitor: bcc -> libbpf #399

Merged
merged 1 commit into from
Nov 21, 2021

Conversation

humancalico
Copy link
Contributor

@humancalico humancalico commented Sep 28, 2021

Some TODOs (or maybe they should come in a different PR?)

  • Remove the bcc dependencies from {Make, Vagrant}files and the likes
  • Use tracepoints for instrumenting common syscalls instead of kprobes

* We now pre-compile the system_monitor.bpf.c file in the Makefile
  into different object files based on the -D flags. Reason: In bcc we
  were previously using the NewModule function which takes the BPF C
  source file and the C flags as arguments and compiles the BPF code
  at runtime. Since we won't have this functionality in libbpf we
  pre-compile the BPF C source files considering all the different -D
  flags and load them accordingly

* Some of the BPF changes are taken from tracee
  https://github.com/aquasecurity/tracee/blob/611c20/tracee-ebpf/tracee/tracee.bpf.c

Co-authored-by: Geyslan G. Bem <geyslan@accuknox.com>
@humancalico
Copy link
Contributor Author

cc @weirdwiz @oneiro-naut @geyslan for review

@nam-jaehyun
Copy link
Collaborator

This PR is for #38 and it will be merged when KubeArmor supports libbpf inside the KubeArmor daemonset.

mon.BpfModule = bcc.NewModule(bpfSource, []string{"-O2"})
if mon.BpfModule == nil {
return errors.New("bpf module is nil")
mon.BpfModule, err = lbpf.OpenObjectFromFile(bpfObjPath + "system_monitor.bpf.o")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this function call assume that the object file is already there(ie the bpf code is already compiled)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry didn't see this before. Yes it does assume that

@nam-jaehyun nam-jaehyun merged commit 119d4ed into kubearmor:event-auditor Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants