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

Fixes for arm64 #158

Merged
merged 1 commit into from May 3, 2022
Merged

Fixes for arm64 #158

merged 1 commit into from May 3, 2022

Conversation

javierhonduco
Copy link
Contributor

On my dev machine:

$ uname -m
arm64

This PR addresses this and creates a GO Make variable to make it easy to
override while trying golang binaries in non-standard paths

Test plan

$ sudo make GO=/usr/local/go/bin/go run-dynamic
[...]
sudo ./run.sh main-dynamic
[*] SUCCESS: all good

cc/ @Sylfrena @v-thakkar @kakkoyun

kakkoyun
kakkoyun previously approved these changes Apr 27, 2022
Copy link
Contributor

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@grantseltzer
Copy link
Contributor

I never noticed that we were missing this, strange that it's only in those 3 selftests. In the other selftests we have ARCH defined but it's used for GOARCH, not for the clang bpf object compilation. Are the other selftests building for you on your arm machine? For example, the tc selftest?

This is definitely a very welcome fix, and I want to make sure it's consistent across every selftest.

@javierhonduco
Copy link
Contributor Author

Seems to work! :D

$ [tc] sudo make GO=/usr/local/go/bin/go run-dynamic
make -C /home/vagrant/work/libbpfgo libbpfgo-dynamic
make[1]: Entering directory '/home/vagrant/work/libbpfgo'
CC=clang \
	CGO_CFLAGS= \
	CGO_LDFLAGS="-lelf -lz -lbpf" \
	/usr/local/go/bin/go build .
make[1]: Leaving directory '/home/vagrant/work/libbpfgo'
CC=clang \
	CGO_CFLAGS= \
	CGO_LDFLAGS="-lelf -lz -lbpf" \
	/usr/local/go/bin/go build -o ./main-dynamic ./main.go
sudo ./run.sh main-dynamic
libbpf: Kernel error message: Exclusivity flag on, cannot modify
[*] SUCCESS: all good

https://github.com/aquasecurity/libbpfgo/blob/main/selftest/tc/Makefile is a symlink to ../common/Makefile so I think that's why it works as we are modifying it in this PR 😄

selftest/tcpconnect/Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@javierhonduco
Copy link
Contributor Author

Removed a leftover arch=x86 variable

On my dev machine:
```
$ uname -m
arm64
```

This PR addresses this and creates a `GO` Make variable to make it easy to
override while trying golang binaries in non-standard paths

**Test plan**
```
$ sudo make GO=/usr/local/go/bin/go run-dynamic
[...]
sudo ./run.sh main-dynamic
[*] SUCCESS: all good
```
@grantseltzer
Copy link
Contributor

LGTM!

@grantseltzer grantseltzer merged commit 0850b8c into aquasecurity:main May 3, 2022
@javierhonduco javierhonduco deleted the arm64-fix branch May 3, 2022 13:07
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