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

Keep the license passed in bpf_attr #37

Closed
wants to merge 1 commit into from

Conversation

gnosek
Copy link
Contributor

@gnosek gnosek commented May 4, 2021

This reverts half of commit 8918b95.
It makes eBPF work at all again, at least on Ubuntu 16.04 and 20.04

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area driver-kmod

/area driver-ebpf

/area libscap

/area libsinsp

/area tests

What this PR does / why we need it:

Without an explicit license in the bpf_attr struct, the bpf() syscall returns -EFAULT when loading any eBPF program:

bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_RAW_TRACEPOINT, insn_cnt=83, insns=0x7f76ed3b0040, license=NULL, log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS}, 72) = -1 EFAULT (Bad address)
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_RAW_TRACEPOINT, insn_cnt=83, insns=0x7f76ed3b0040, license=NULL, log_level=1, log_size=262144, log_buf="", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS}, 72) = -1 EFAULT (Bad address)

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Based on my reading of https://man7.org/linux/man-pages/man7/bpf-helpers.7.html#LICENSE, fetching the license from a dedicated section is a userspace feature (libbpf, maybe?)

cc @fntlnz

Does this PR introduce a user-facing change?:

eBPF works again

This reverts half of commit 8918b95.
It makes eBPF work at all again, at least on Ubuntu 16.04 and 20.04

Signed-off-by: Grzegorz Nosek <[email protected]>
@poiana
Copy link
Contributor

poiana commented May 4, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from gnosek after the PR has been reviewed.

The full list of commands accepted by this bot can be found 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

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.

I'm approving this with the main purpose of unblocking falcosecurity/falco#1552

See the comment above.

@@ -154,6 +154,7 @@ static int bpf_load_program(const struct bpf_insn *insns,
attr.prog_type = type;
attr.insn_cnt = (uint32_t) insns_cnt;
attr.insns = (unsigned long) insns;
attr.license = (unsigned long) "GPL";
Copy link
Member

Choose a reason for hiding this comment

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

I see this as a workaround. The root issue should be in our loader (that is not parsing 'license' section).

Could we add a comment so we won't forget to fix the loader in the future?

@poiana
Copy link
Contributor

poiana commented May 10, 2021

LGTM label has been added.

Git tree hash: 3d2145b9f25a640c37f1a489213c789a1561f694

@leodido leodido mentioned this pull request May 11, 2021
1 task
@leogr leogr self-requested a review May 11, 2021 11:50
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.

Since #42 fixed the root issue, IMO we don't need this workaround anymore.

Thanks anyway!

@leodido
Copy link
Member

leodido commented May 18, 2021

Thanks for bringing this up Grzeg.

#42 is in. I believe we can close this

/close

@poiana poiana closed this May 18, 2021
@poiana
Copy link
Contributor

poiana commented May 18, 2021

@leodido: Closed this PR.

In response to this:

Thanks for bringing this up Grzeg.

#42 is in. I believe we can close this

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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