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

Flatcar driver loader support #2043

Merged
merged 2 commits into from
Jun 13, 2022

Conversation

jepio
Copy link
Contributor

@jepio jepio commented Jun 7, 2022

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area build

What this PR does / why we need it:

This PR ensure falco-driver-loader supports Flatcar. There are two commits that address two parts of this:

  1. fix the kernel module build with dkms, which currently doesn't work due to the driver-loader container having a glibc that is older than the kernel module build directory was compiled against. This is solved by relocating the build tools in the kernel module directory, to run using host linker.
  2. when searching for pre-built kernel module/eBPF probe, use the /etc/os-release VERSION_ID field instead of kernel release. This is consistent with kernel-crawler output and the convention chosen in Add builder for Flatcar driverkit#131, due to the unique design of Flatcar: you can find the right kernel config/kernel version from the OS version, but not the other way around (not without guessing)

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix(falco-driver-loader): building falco module with DKMS on Flatcar and supporting fetching pre-built module/eBPF probe

@poiana
Copy link
Contributor

poiana commented Jun 7, 2022

Welcome @jepio! It looks like this is your first PR to falcosecurity/falco 🎉

@poiana poiana requested review from krisnova and leogr June 7, 2022 15:43
@poiana poiana added the size/M label Jun 7, 2022
@jasondellaluce
Copy link
Contributor

/milestone 0.33.0

@poiana poiana added this to the 0.33.0 milestone Jun 8, 2022
leogr
leogr previously approved these changes Jun 10, 2022
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.

👍

@poiana
Copy link
Contributor

poiana commented Jun 10, 2022

LGTM label has been added.

Git tree hash: 0421b0ddb2fa71b52360617accb41bae4d749b5f

jasondellaluce
jasondellaluce previously approved these changes Jun 10, 2022
Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

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

/approve

@jasondellaluce
Copy link
Contributor

Closing and reopening to trigger the CI

/close

@poiana
Copy link
Contributor

poiana commented Jun 10, 2022

@jasondellaluce: Closed this PR.

In response to this:

Closing and reopening to trigger the CI

/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 Jun 10, 2022
@jasondellaluce
Copy link
Contributor

/reopen

@poiana poiana reopened this Jun 10, 2022
@poiana
Copy link
Contributor

poiana commented Jun 10, 2022

@jasondellaluce: Reopened this PR.

In response to this:

/reopen

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.

@leogr
Copy link
Member

leogr commented Jun 13, 2022

This PR needs to be rebased. I'll do that for you.

jepio added 2 commits June 13, 2022 09:40
Relocate necessary tools from the kernel module build system to run using host
dynlinker and libraries, so that compiling falco module on Flatcar works.

Since Flatcar v2983.0.0, Flatcar ships with glibc-2.33, but the
falco-driver-loader container is based on debian:buster and so has a much older
glibc. This prevents some necessary tools within /lib/modules/*/build from
working which causes the falco module to fail to compile using dkms.

To make the tools work, we need to relocate them so we add patchelf to the
falco and local dockerfiles. The relocation is based on the approach done by
the sysdig agent-kmodule build system, but I'm unable to find the source code
for it. The host linker and libs will be found at /host/usr/lib64, so we change
the interpreter and rpath on the tools. The relocation happens on a copy of the
tools which are then bind mounted at the right location. The result allows the
module build to work.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Pre-built kernel modules/eBPF probes for Flatcar use the value of the OS
VERSION_ID field as KERNEL_RELEASE in the filename. A specific kernel release
version does not uniquely identify a Flatcar configuration, because Flatcar is
image-based instead of package-based. Here's a more specific example: the same
kernel version can be part of various Flatcar releases (across channels
alpha/beta/stable) with differences in configuration. This is why we use the
VERSION_ID value during offline builds with driverkit. Flatcar version numbers
are all higher than 1500.0.0, so there is no risk of collision with kernel
version numbers.

When locally building the kernel module on the system, we have access to the
correct kernel build directory at /lib/modules/$(uname -r)/build with the right
configuration and so for that branch, we need to reset KERNEL_RELEASE=$(uname -r).

See also the driverkit PR that introduces a builder for Flatcar:
falcosecurity/driverkit#131

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@leogr leogr dismissed stale reviews from jasondellaluce and themself via 8fe79ee June 13, 2022 07:40
@leogr leogr force-pushed the flatcar-driver-loader-support branch from 715bdc7 to 8fe79ee Compare June 13, 2022 07:40
@poiana poiana removed the lgtm label Jun 13, 2022
@poiana poiana requested review from jasondellaluce and leogr June 13, 2022 07:40
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.

Rebased.

cc @jasondellaluce Could you approve again please? 🙏

@poiana poiana added the lgtm label Jun 13, 2022
@poiana
Copy link
Contributor

poiana commented Jun 13, 2022

LGTM label has been added.

Git tree hash: 9184469600670b71c8b0031ab67aeffc3df7a5a5

Copy link
Contributor

@jasondellaluce jasondellaluce 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 Jun 13, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasondellaluce, jepio

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 85f91a3 into falcosecurity:master Jun 13, 2022
@jepio
Copy link
Contributor Author

jepio commented Jun 13, 2022

Thanks a lot!

@leogr
Copy link
Member

leogr commented Jun 13, 2022

@jepio you are welcome :)

and thank you again for your contribution 👍

@jepio jepio deleted the flatcar-driver-loader-support branch June 15, 2022 08:14
@jasondellaluce jasondellaluce modified the milestones: 0.33.0, 0.32.1 Jun 17, 2022
johananl added a commit to johananl/falco that referenced this pull request Aug 14, 2023
In falcosecurity#2043 we've added logic
for relocating tools on Flatcar when running falco-driver-loader in kmod
mode. This logic is relevant for BPF mode, too, which is currently
broken on Flatcar. Call flatcar_relocate_tools in BPF mode, too.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
johananl added a commit to johananl/falco that referenced this pull request Aug 14, 2023
In falcosecurity#2043 we've added logic
for relocating tools on Flatcar when running falco-driver-loader in kmod
mode. This logic is relevant for BPF mode, too, which is currently
broken on Flatcar. Call flatcar_relocate_tools in BPF mode, too.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
poiana pushed a commit that referenced this pull request Aug 21, 2023
In #2043 we've added logic
for relocating tools on Flatcar when running falco-driver-loader in kmod
mode. This logic is relevant for BPF mode, too, which is currently
broken on Flatcar. Call flatcar_relocate_tools in BPF mode, too.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
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