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

read BPF license from ELF #42

Merged
merged 2 commits into from
May 17, 2021
Merged

read BPF license from ELF #42

merged 2 commits into from
May 17, 2021

Conversation

leodido
Copy link
Member

@leodido leodido commented May 11, 2021

What type of PR is this?

/kind bug

/kind feature

Any specific area of the project related to this PR?

/area driver-ebpf

/area libscap

What this PR does / why we need it:

While it is indeed correct that the license section is in the BPF probe source code (see 8918b95),
our custom BPF loader should read it by parsing the ELF and then accordingly use the read value in the bpf_attr instance.

Which issue(s) this PR fixes:

Rather than always enforcing the license in the libscap loader - like the #37 attempt does - this PR reads the actual value from the ELF and then uses it in our custom loading phases (see load_tracepoint > bpf_load_program)

Special notes for your reviewer:

Supersedes #37

Does this PR introduce a user-facing change?:

fix(userspace/libscap): read the license section for the BPF ELF
fix(userspace/libscap): pass the read license to the `bpf` syscall via `bpf_attr`

leogr
leogr previously approved these changes May 11, 2021
Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

This is great! 👏

I have tried your change on Falco (by using a test branch) and everything works as expected (see here).

So #37 is not needed anymore.

PS
I will approve again once it is rebased on master.

@poiana
Copy link
Contributor

poiana commented May 11, 2021

LGTM label has been added.

Git tree hash: 83f9320effa113ae586161017264da7a1e376e81

@leogr
Copy link
Member

leogr commented May 11, 2021

/retest

@leogr leogr requested review from gnosek and fntlnz May 12, 2021 06:43
ldegio
ldegio previously approved these changes May 14, 2021
@leodido leodido dismissed stale reviews from ldegio and leogr via 3a30072 May 17, 2021 17:01
@leodido leodido force-pushed the fix/bpf-license-load branch from 39fd150 to 3a30072 Compare May 17, 2021 17:01
@poiana poiana added size/S and removed size/L labels May 17, 2021
Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

/approve

🥳

@poiana
Copy link
Contributor

poiana commented May 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leogr

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 13ec67e into master May 17, 2021
@poiana poiana deleted the fix/bpf-license-load branch May 17, 2021 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants