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

BPF probe compile once run everywhere with BTF #186

Closed
fntlnz opened this issue Nov 29, 2019 · 30 comments
Closed

BPF probe compile once run everywhere with BTF #186

fntlnz opened this issue Nov 29, 2019 · 30 comments
Labels
kind/feature New feature or request lifecycle/stale

Comments

@fntlnz
Copy link
Contributor

fntlnz commented Nov 29, 2019

This will likely become a proposal if it receives a good feedback here (like doing a 👍 counts as feedback )

What would you like to be added:

Adapt and compile our eBPF probe loader code to the BPF type format (BTF) - links below.

Why is this needed:

Some considerations first
One of the main barriers that new and old users encounter when trying to adopt falco is building either the kernel module or the BPF probe. To mitigate this we’ve been working on two main efforts over time:

  • doing containerized builds to minimize the host dependencies
  • having pre built kernel modules for a wide variety of kernels

Despite this, many users still struggle and in my opinion the experience in that area has a lot of room of improvement.

Moreover, in new-ish environments (recent kernel 4 and 5) using eBPF is becoming more and more common and honestly I expect that to become the default for Falco at some point. This also makes sense from a privileges point of view where we will only need capabilities for the bpf syscall .

Summary of Problems with our current approach

  • difficult to just run falco because the compilation or the download might not go right
  • kernel headers need to be installed on every host along with the clang tool chain that processes them
  • sometimes having kernel headers and tool chain is just very hard or impossible (immutable environments)
  • compiling is complicated, a single mistake and the user can’t load the loader and falco becomes useless
  • wider attack surface because having to compile stuff for the kernel requires a tool chain in a container that can read kernel folders (e.g /lib/modules)
  • difficult to distribute the “kernel side” of falco

The actual idea
After all these considerations I think that we need to adapt our current programs to take advantage of BTF (links below) in order to be able to compile once and run everywhere.

Read more about BTF here: https://www.kernel.org/doc/html/latest/bpf/btf.html and here https://facebookmicrosites.github.io/bpf/blog/2018/11/14/btf-enhancement.html

Next steps
After gathering some initial feedback here with this message I’ll open a formal proposal with an action plan

@fntlnz
Copy link
Contributor Author

fntlnz commented Nov 29, 2019

/assign @fntlnz

#dibs

@leodido
Copy link
Member

leodido commented Dec 3, 2019

/assign @leodido

@sunil1783
Copy link

For porting falco on ppc64le ,we are facing issues while using containers of docker files having older OS kernel version and gcc-6/5 dependent packages.
So above suggested changes are required, to support latest OS kernel version and latest gcc versions.
falcosecurity/falco#982
falcosecurity/falco#932

@stale
Copy link

stale bot commented Mar 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this as completed Mar 15, 2020
@jnach
Copy link

jnach commented Jun 30, 2020

Fundamentally, to offer an eBPF agent to a system/kernel you do not yourself control, I would imagine you inevitably have to solve this problem to drive eBPF adoption. I started down this path as well after an analysis of BCC optimizations, bravo and consider this an upvote.

@fntlnz fntlnz reopened this Jun 30, 2020
@fntlnz
Copy link
Contributor Author

fntlnz commented Jun 30, 2020

Thanks @jnach - I'd also love some help here in case you are up to!

@jnach
Copy link

jnach commented Jul 2, 2020

Interested...

@jnach
Copy link

jnach commented Jul 2, 2020

Also doing containerized builds to minimize the host dependencies - doesn't matter with eBPF, you can try an init container to make sure kernel-devel packages are there (which tends to break on update) or you can crack the code on CORE. The second one is particularly scalable.

@stale
Copy link

stale bot commented Aug 31, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Issues labeled "cncf", "roadmap" and "help wanted" will not be automatically closed. Please refer to a maintainer to get such label added if you think this should be kept open.

@stale stale bot closed this as completed Sep 7, 2020
@fntlnz fntlnz reopened this Feb 4, 2021
@fntlnz
Copy link
Contributor Author

fntlnz commented Feb 4, 2021

I'm working on it.

@jnach
Copy link

jnach commented Feb 4, 2021

Someday I might have enough free time to help lift, unfortunately the invisible hand says otherwise at the moment.

@poiana
Copy link
Contributor

poiana commented May 5, 2021

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@poiana
Copy link
Contributor

poiana commented Jun 4, 2021

Stale issues rot after 30d of inactivity.

Mark the issue as fresh with /remove-lifecycle rotten.

Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle rotten

@poiana
Copy link
Contributor

poiana commented Jul 5, 2021

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/close

@poiana
Copy link
Contributor

poiana commented Jul 5, 2021

@poiana: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/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.

@poiana poiana closed this as completed Jul 5, 2021
@leogr
Copy link
Member

leogr commented Oct 15, 2021

/reopen
/remove-lifecycle rotten

We still want this :)

@poiana
Copy link
Contributor

poiana commented Oct 15, 2021

@leogr: Reopened this issue.

In response to this:

/reopen
/remove-lifecycle rotten

We still want this :)

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.

@poiana poiana reopened this Oct 15, 2021
@FedeDP
Copy link
Contributor

FedeDP commented Oct 19, 2021

If i understand correctly, we "only" need to port libscap to libbpf; libbpf right now supports CO-RE, but it mandates a kernel with BTF type information and clang/llvm 10+ (build only dep).
See here for details: https://github.com/libbpf/libbpf#bpf-co-re-compile-once--run-everywhere

Here is a nice demo app that uses libbpf and CO-RE: https://github.com/libbpf/libbpf-bootstrap#bootstrap

@poiana
Copy link
Contributor

poiana commented Jan 17, 2022

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@leogr
Copy link
Member

leogr commented Jan 19, 2022

/remove-lifecycle stale

@fntlnz Would we like to move this proposal to libs?

@fntlnz fntlnz transferred this issue from falcosecurity/falco Jan 20, 2022
@fntlnz fntlnz added the kind/feature New feature or request label Jan 20, 2022
@poiana poiana removed the needs-kind label Jan 20, 2022
@jnach
Copy link

jnach commented Jan 20, 2022

The business need is and I think always will be a moving target here, libs or not. You can:
A: Solve for unknown kernel with (likely) BTF, libs or not, it's still compiled for a specific kernel version. Maybe there is some kind of hook possible to hang with updates? It's hard to say.
B: Have kernel solve for you by supporting specific versions, which is also difficult from an update/security perspective as an offering.

@Andreagit97
Copy link
Member

Andreagit97 commented Mar 29, 2022

Hi all 🖖 I wrote down some ideas about a new BPF probe. If you are interested, you can take a look here 👀

@jundizhou
Copy link

jundizhou commented May 6, 2022

We are using the software in depth.We believe that using kernel modules to adapt to lower versions of the kernel is still just needed, but libbpf is a trend. Do you have any plans to replace libbpf.

@poiana
Copy link
Contributor

poiana commented Aug 4, 2022

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@FedeDP
Copy link
Contributor

FedeDP commented Aug 4, 2022

/remove-lifecycle stale

@poiana
Copy link
Contributor

poiana commented Nov 2, 2022

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@leogr
Copy link
Member

leogr commented Nov 14, 2022

@FedeDP @Andreagit97 do we have another issue for tracking this?

@Andreagit97
Copy link
Member

We had this one #513 to track the syscall support of the modern BPF probe, and now we have this PR falcosecurity/falco#2282 in Falco, that I will enrich with some info when we will be ready to release modern bpf packages

@leogr
Copy link
Member

leogr commented Nov 23, 2022

Closing in favor of #513

/close

@poiana poiana closed this as completed Nov 23, 2022
@poiana
Copy link
Contributor

poiana commented Nov 23, 2022

@leogr: Closing this issue.

In response to this:

Closing in favor of #513

/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
Labels
kind/feature New feature or request lifecycle/stale
Projects
None yet
Development

No branches or pull requests

9 participants