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

feat: send logs to userspace + revamp #14

Merged
merged 13 commits into from
Apr 16, 2024
Merged

feat: send logs to userspace + revamp #14

merged 13 commits into from
Apr 16, 2024

Conversation

deansheather
Copy link
Member

@deansheather deansheather commented Apr 12, 2024

Update bpf_printk statements to be also sent to userspace so they can be logged alongside events. All log lines are considered errors and should be checked (unless running a debug eBPF binary).

Revamps the CO-RE reads that were performed in the eBPF code to use slimmer types and to use BPF helper macros for readability.

Adds more tests as well as ebpf benchmarks.

Update bpf_printk statements to be also sent to userspace so they can be
logged alongside events. All log lines are considered errors and should
be checked (unless running a debug eBPF binary).

Revamps the CO-RE reads that were performed in the eBPF code to use
slimmer types and to use BPF helper macros for readability.
@deansheather deansheather requested a review from sreya April 12, 2024 07:22
@deansheather
Copy link
Member Author

$ COUNT=10000 ./bench/bench.sh 
+ exec sudo -E unshare --pid --fork --setuid 1000 --setgid 1000 -- /usr/local/go/bin/go test -exec sudo -bench=. '-run="^#"' -count=1 -benchtime=10000x ./
goos: linux
goarch: amd64
pkg: github.com/coder/exectrace/bench
cpu: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
BenchmarkExectraceBase/eBPF-2              10000           1108432 ns/op
BenchmarkExectraceBase/eBPF/enter_execve           10042              5497 ns/op
BenchmarkExectracePIDNSFilter/eBPF-2               10000           1115366 ns/op
BenchmarkExectracePIDNSFilter/eBPF/enter_execve    10042              6670 ns/op
PASS
ok      github.com/coder/exectrace/bench        22.716s

@deansheather deansheather merged commit cbef761 into main Apr 16, 2024
8 checks passed
@deansheather deansheather deleted the dean/logs branch April 16, 2024 07:45
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.

2 participants