Skip to content

Exclude unneeded progs #1636

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

erthalion
Copy link
Contributor

@erthalion erthalion commented Apr 18, 2024

Description

Reduce number of bpf programs we include into the final probe. This helps to reduce the probe size, and as a side effect helps fighting debug log truncation due to its large size (it contains relocations for all of those progs).

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

Manual testing.

Reduce number of bpf programs we include into the final probe. This
helps to reduce the probe size, and as a side effect helps fighting
debug log truncation due to its large size (it contains relocations for
all of those progs).
@erthalion erthalion requested a review from a team as a code owner April 18, 2024 16:00
# $ bpftool prog | grep tracing | awk '{print $4}' > all_progs.list
# $ grep -v -f progs_in_use.list all_progs.list > collector/excluded_progs.list
file(READ "excluded_progs.list" EXCLUDED_PROGS)
STRING(REGEX REPLACE "\n" "" EXCLUDED_PROGS "${EXCLUDED_PROGS}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh Lord have mercy on our souls :repenting_intensifies:

@@ -0,0 +1,140 @@
^(
Copy link
Collaborator

@Molter73 Molter73 Apr 18, 2024

Choose a reason for hiding this comment

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

On a somewhat more serious note, could we change this to be a straight up list of progs, then use something like JOIN to put them together with | and simply add the ^( and )$ afterwards?
https://cmake.org/cmake/help/latest/command/string.html#join

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, why not.

@robbycochran
Copy link
Collaborator

How do we keep this synchronized when either new system calls are supported in Falco or new system calls are added to collector (progs_in_use)?

@erthalion
Copy link
Contributor Author

erthalion commented Apr 19, 2024

How do we keep this synchronized when either new system calls are supported in Falco or new system calls are added to collector (progs_in_use)?

Good question, @robbycochran. I've described in the commentary how the list was generated, so what we could do to make it easier is to automate this process, maybe load list of used syscalls from an external file during the build as well (not just define in the header), and add a CI check to verify if there are any differences. This way if:

  • New syscalls will be added to Falco, they will not be excluded and built into the probe. The CI check will spin up Collector and complain that the list of loaded progs is different from expected. Having this information, we generate it again.
  • New syscalls added to Collector. Since we would load the list from the file, the only way to add it would be to add it into the list. This could be automated via a script that will re-generate excluded list as a post-execution step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants