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

require either debugfs or tracefs to be mounted #78

Merged
merged 1 commit into from
Apr 30, 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
6 changes: 4 additions & 2 deletions ebpftracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
if len(prg) == 0 {
return fmt.Errorf("unsupported kernel version: %s", t.kernelVersion)
}
_, debugFsErr := os.Stat("/sys/kernel/debug/tracing")
_, traceFsErr := os.Stat("/sys/kernel/tracing")

if _, err := os.Stat("/sys/kernel/debug/tracing"); err != nil {
return fmt.Errorf("kernel tracing is not available: %w", err)
if debugFsErr != nil && traceFsErr != nil {
return fmt.Errorf("kernel tracing is not available: debugfs or tracefs must be mounted")
}

collectionSpec, err := ebpf.LoadCollectionSpecFromReader(bytes.NewReader(prg))
Expand Down