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: incorrect CAP_BPF check method #715

Merged
merged 1 commit into from
Jan 4, 2025
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 cli/cmd/env_detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func detectBpfCap() error {
return fmt.Errorf("failed to get the capabilities of the current process: %v", err)
}

haveBpfCap := data[0].Permitted&unix.CAP_BPF != 0
capBpfMask := uint32(1 << (unix.CAP_BPF - 32))
capSysAdminMask := uint32(1 << unix.CAP_SYS_ADMIN)
haveBpfCap := (data[1].Permitted&capBpfMask != 0) || (data[0].Permitted&capSysAdminMask != 0)
if !haveBpfCap {
return fmt.Errorf("the current user does not have CAP_BPF to load bpf programs. Please run as root or use sudo or add the --privileged=true flag for Docker.")
}
Expand Down
Loading