-
Notifications
You must be signed in to change notification settings - Fork 167
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
wip: new(libs): replace elfutils/libelf with elftoolchain/libelf #2174
wip: new(libs): replace elfutils/libelf with elftoolchain/libelf #2174
Conversation
Signed-off-by: Luca Guerra <[email protected]>
Signed-off-by: Luca Guerra <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: LucaGuerra The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
Signed-off-by: Luca Guerra <[email protected]>
Signed-off-by: Luca Guerra <[email protected]>
Signed-off-by: Luca Guerra <[email protected]>
0a5efc7
to
dc906d0
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2174 +/- ##
=======================================
Coverage 75.04% 75.04%
=======================================
Files 255 255
Lines 33589 33589
Branches 5739 5739
=======================================
Hits 25207 25207
Misses 8382 8382
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Luca Guerra <[email protected]>
692c9e2
to
e32d053
Compare
6744e5e
to
e4dee0f
Compare
Signed-off-by: Luca Guerra <[email protected]>
Signed-off-by: Luca Guerra <[email protected]>
Signed-off-by: Luca Guerra <[email protected]>
e4dee0f
to
a89b629
Compare
Hey @LucaGuerra! Thanks for putting this together, I just have some thoughts and questions I'd like to share with you. My main concern is with maintenance of this new vendored dependency, while languages like Go and Rust have integrated tools to do this kind of thing (see Another concern with this approach is how do we track what version of elfutils we are using? I haven't looked super deep into the PR, but I've not seen any mentions of a specific version being used. While this might not be terribly concerning now, it would be nice to have a way to know this in the future for multiple reasons (checking for CVEs, bugfixes, etc..). Finally, for the proposed approaches:
I don't like this one, that is all I have to say 🤣
This one is my favorite. Correct me if I'm wrong, but since we are not planning to redistribute this library, the release could just be a tag on the new repo, right? We don't need to do anything fancier than that. Worst case, I guess we need to build the archive file for it and publish it as a github package?
This is even more work to keep track of changes, I don't like it either. Anyways, sorry about the mile long comment! 😅 |
Thank you for the insights @Molter73 ! Yes, maintaining a fork is everyone's favorite thing to do I know 🤣 And I do share each of your concerns. I didn't want to write a longer comment than I already did in the PR description so I'll answer the questions with the rationale
One thing that makes having a fork of this library feasible is that from looking at the history it is very stable and essentially implements an interface that has been there for a long time. The last commit to elftoolchain/libelf was in 2022, and I don't expect it to change drastically. This is also why I don't think automation is needed to maintain it for now. It is possible that we could upstream something from the patches but we need to check if those "extension" functions would be acceptable for upstream and write them keeping the style consistent with the rest of the project.
The version number for it is just its released version (which however is a bit older) or the SVN revision number, the latter in this case. It seems like everyone's favorite at this point is having a separate repo which is a fork with patches already applied. We can have a tiny "release" process that deals with the boring stuff such as generating the m4 files and puts together an importable source package, slaps a version tag and can be fetched from the main libs repo. |
Please take a look at the alternate implementation with a fork: #2175 |
Closing in favor of #2175 |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area build
/area libscap-engine-modern-bpf
Does this PR require a change in the driver versions?
No
What this PR does / why we need it:
I would like to propose replacing
elfutils/libelf
with elftoolchain's libelf. The latter is an implementation of the libelf spec which is BSD licensed and therefore can be statically linked in Falco and its dependencies. The current situation has a few main disadvantages:musl
The proposed solution is based on Elftoolchain which I've adapted to work with libbpf and Falco libs.
So, how do we build this library? Upstream, the library is obtained via svn and built with BSD Make (which is different from GNU Make) and m4. Since none of those are currently dependencies for Falco or libs, I would propose NOT to require falco libs client to install those. So, I've generated the m4 files (hoping that they're not arch dependent, if they are I'll find a solution) and wrote CMake files just for libelf. In addition, some patches are in order (I don't know yet if they can be upstreamed but we may explore that). There is a README file that explains these steps in detail.
As you can see the PR is huge because it includes everything in the libs repo. We can discuss one of the following:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: