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

makefile: fix vmlinuxh rule #239

Merged
merged 1 commit into from
Sep 14, 2022
Merged

Conversation

geyslan
Copy link
Member

@geyslan geyslan commented Sep 8, 2022

Fixes: #238

@geyslan geyslan added the bug Something isn't working label Sep 8, 2022
@geyslan geyslan self-assigned this Sep 8, 2022
Makefile Outdated Show resolved Hide resolved
Comment on lines +98 to +101
@if [ ! $(BPFTOOL) ]; then \
echo "ERROR: could not find bpftool"; \
exit 1; \
fi;
Copy link
Member Author

Choose a reason for hiding this comment

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

Despite what was suggested in #239 (comment), this remains for now. Whether we keep an up-to-date vmlinux.h in the tree or build (and make available for consumer) the latest bpftool can be discussed in #177.

My thoughts anyway: the consumer of this library needs, for better experience, an updated tooling (bpftool in this case), which is not offered in common distros, but those that are rolling release.

Copy link
Contributor

Choose a reason for hiding this comment

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

Question: why to "fix" this instead of simply adding a vmlinux.h file to the repository (from a recent enough kernel, like 5.15 or so. We can have the file "tar.bz2" and uncompressed by Makefile to save space even. @grantseltzer WDYT ? Obligating the user to have bpftool is complicated. If we pick Ubuntu distribution, for example, it depends on having package named "linux-tools-XXXX" (depending on the kernel version), and is error-prone (sometimes bpftool in a container has wrong version due to host kernel being different, and things like that).

Copy link
Contributor

@grantseltzer grantseltzer Sep 9, 2022

Choose a reason for hiding this comment

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

Keep in mind that by 'user' here, we're talking people who are running the selftests, not consumers of libbpfgo (where they provide their own vmlinux.h file). With that in mind, I can see it being reasonable to expect someone to have their own bpftool if their advanced enough to be running tests. On the other hand, they may be exploring bpf code for learning purposes (I think a major reason for selftests) and using a pre-made vmlinux.h would help with that.

I'm leaning towards us having an existing vmlinux.h file, but not to tar/zip it to make it more obvious what's going on. This is also what we do in tracee.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreeing with you both. I think it demands its own issue, but first let's decides the requirements.

  • Remove libbpfgo Makefile bpftool requirement.
  • Make available an updated pre-made vmlinux.h (I think it can be one extracted from Arch/Manjaro - due to its freshness) in the libbpfgo tree for static and dynamic compilations (format to be defined).
  • Add a Makefile flag (env var) to one specify its own vmlinux.h overriding the offered by libbpfgo.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

@geyslan That sounds great to me!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done: #242.

@geyslan
Copy link
Member Author

geyslan commented Sep 12, 2022

As #242 was created, I think this PR is ready for review.

Copy link
Contributor

@grantseltzer grantseltzer 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 grantseltzer merged commit 33d4c0d into aquasecurity:main Sep 14, 2022
@geyslan geyslan deleted the 238-vmlinuxh branch March 31, 2023 23:59
@geyslan geyslan restored the 238-vmlinuxh branch March 31, 2023 23:59
@geyslan geyslan deleted the 238-vmlinuxh branch March 31, 2023 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Makefile rule $(VMLINUXH) bpftool err
3 participants