Skip to content

Commit

Permalink
Bump libbpf and libbpf-go
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed May 11, 2023
1 parent f03fcdc commit 00327e2
Show file tree
Hide file tree
Showing 18 changed files with 813 additions and 194 deletions.
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ dependencies:
match: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud

- name: libbpf
version: 1.0.1
version: 1.2.0
refPaths:
- path: hack/install-libbpf.sh
match: VERSION
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/acobaugh/osrelease v0.1.0
github.com/aquasecurity/libbpfgo v0.4.6-libbpf-1.1.0
github.com/aquasecurity/libbpfgo v0.4.8-libbpf-1.2.0.0.20230509162948-80f41e18e690
github.com/blang/semver/v4 v4.0.0
github.com/cert-manager/cert-manager v1.11.1
github.com/containers/common v0.53.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6q
github.com/aliyun/credentials-go v1.2.3 h1:Vmodnr52Rz1mcbwn0kzMhLRKb6soizewuKXdfZiNemU=
github.com/aliyun/credentials-go v1.2.3/go.mod h1:/KowD1cfGSLrLsH28Jr8W+xwoId0ywIy5lNzDz6O1vw=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/aquasecurity/libbpfgo v0.4.6-libbpf-1.1.0 h1:b4RQasaC8u+zvCFJO6z4e+XoDJ3XEwxcMSdrbT1GFnk=
github.com/aquasecurity/libbpfgo v0.4.6-libbpf-1.1.0/go.mod h1:v+Nk+v6BtHLfdT4kVdsp+fYt4AeUa3cIG2P0y+nBuuY=
github.com/aquasecurity/libbpfgo v0.4.8-libbpf-1.2.0.0.20230509162948-80f41e18e690 h1:iDvZaf9Xcw9JfzJyqG9L9cYDwSpaFRg5pLddu4IvId0=
github.com/aquasecurity/libbpfgo v0.4.8-libbpf-1.2.0.0.20230509162948-80f41e18e690/go.mod h1:UD3Mfr+JZ/ASK2VMucI/zAdEhb35LtvYXvAUdrdqE9s=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
Expand Down
11 changes: 6 additions & 5 deletions hack/install-libbpf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

set -euo pipefail

VERSION=1.0.1
VERSION=1.2.0
curl -sSfL --retry 5 --retry-delay 3 \
"https://github.com/libbpf/libbpf/archive/refs/tags/v$VERSION.tar.gz" -o- |
tar xfz -
pushd "libbpf-$VERSION/src"
make BUILD_STATIC_ONLY=y install
popd
rm -rf "libbpf-$VERSION"

DIR="libbpf-$VERSION"
trap 'rm -rf -- "$DIR"' EXIT

make -C "$DIR/src" BUILD_STATIC_ONLY=y install install_uapi_headers -j8
3 changes: 2 additions & 1 deletion internal/pkg/daemon/bpfrecorder/bpfrecorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ func (b *BpfRecorder) Load(startEventProcessor bool) (err error) {
if err != nil {
return fmt.Errorf("init events ringbuffer: %w", err)
}
b.StartRingBuffer(ringbuffer)
const timeout = 300
b.PollRingBuffer(ringbuffer, timeout)

if startEventProcessor {
go b.processEvents(events)
Expand Down
80 changes: 41 additions & 39 deletions internal/pkg/daemon/bpfrecorder/bpfrecorderfakes/fake_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/pkg/daemon/bpfrecorder/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type impl interface {
RemoveAll(string) error
Chown(string, int, int) error
CloseModule(*bpf.BPFMap)
StartRingBuffer(*bpf.RingBuffer)
PollRingBuffer(*bpf.RingBuffer, int)
GoArch() string
Readlink(string) (string, error)
ParseUint(string) (uint32, error)
Expand Down Expand Up @@ -230,8 +230,8 @@ func (d *defaultImpl) GoArch() string {
return runtime.GOARCH
}

func (d *defaultImpl) StartRingBuffer(b *bpf.RingBuffer) {
b.Start()
func (d *defaultImpl) PollRingBuffer(b *bpf.RingBuffer, timeout int) {
b.Poll(timeout)
}

func (d *defaultImpl) CloseModule(m *bpf.BPFMap) {
Expand Down
131 changes: 131 additions & 0 deletions vendor/github.com/aquasecurity/libbpfgo/.clang-format

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 00327e2

Please sign in to comment.