-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add builder for Flatcar #131
Conversation
Welcome @jepio! It looks like this is your first PR to falcosecurity/driverkit 🎉 |
curl --silent -o /tmp/kernel.config -SL {{ .KernelConfigURL }} | ||
|
||
cd /tmp/kernel | ||
make KCONFIG_CONFIG=/tmp/kernel.config oldconfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these calls to make oldconfig
and modules_prepare
are necessary? I don't actually see them in any of the other builders, but this may be required for flatcar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this part from the vanilla builder. Our own "kernel-devel" package equivalent is compiled against newer glibc, such that it doesn't work with the old debian based builder image. Here we're pulling generic kernel sources (we don't patch our sources) and need to "prepare" those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks!
@leodido any chance you could have a look at this? |
Hi! This looks fine to me. kernel-crawler already has support for Flatcar, so it makes sense to add this. It's been a while since this PR was originally submitted, so not sure if the vendor has changed its upstream package naming format and/or location (I assume not, it's been only a month). |
92be8ca
to
89dbfc1
Compare
Thanks for the link to kernel-crawler, I checked what output it produces, and decided to drop the With this, I would be happy to get lgtm's and/or make any necessary changes. |
Nice! Thanks for the updates. Have you had a chance to try to load the built drivers/probes on Flatcar yet? |
Yes, that's how I came across the issues 2 issues I found. The module now loads correctly on flatcar. |
Could you update the description with an example command-line invocation building a flatcar driver with successful results as in PR130: |
On Flatcar, a kernel version alone is not enough to determine the kernel config and which GCC version was used. But a Flatcar release version number can will give us this information, including the kernel version. So this build works the following way: the kernel release field has to contain a flatcar version number followed by `-flatcar`, such as 3185.0.0-flatcar. Based on this, the correct "channel" will be found (there is 1-1 mapping between flatcar version and channel), and we will fetch kernel version, GCC version and kernel config. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
…version This was an arbitrary requirement that served no purpose. Kernel-crawler generates configs with the kernelrelease set to the Flatcar version number without the '-flatcar' suffix, so let's be consistent with that. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This is required to build Flatcar kernel compatible modules, as otherwise the modules have the wrong version magic and can't be probed. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Flatcar kernels are built with BTF type info, which requires pahole when configuring the kernel. If pahole is missing, then running `make modules_prepare` removes entries from the kernel config and results in built modules failing to probe with the error: module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 0000000090295d6a, val ffffffffc0b5ae8d Buster provides pahole 1.12, but CONFIG_PAHOLE_HAS_SPLIT_BTF requires 1.19 which, luckily, is available in the buster-packports repo. Add that package to the container image. Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
I've added an example command line invocation of this builder and the output that generates (truncated most of the verbose shell output). Also rebased the series to add a commit to support the architecture flag that was merged to master. |
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>
LGTM label has been added. Git tree hash: 23987d0a536896f42d0ada75d1e9bc3b4fab122a
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dwindsor, 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 |
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>
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>
Example output
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area build
What this PR does / why we need it:
This PR introduces a builder for Flatcar. There have been several reports of vanilla builder not working well for Flatcar (https://github.com/falcosecurity/driverkit/issues?q=flatcar), we also have reports on our own issue tracker of the stock Falco build process not working since we shipped a newer GLIBC (flatcar/Flatcar#534). In slack there are occasional questions in slack regarding the kernel module build for Flatcar. So we know that there are plenty of users that would like this to work.
Which issue(s) this PR fixes:
Example output:
Fixes #
Special notes for your reviewer:
I tried to not introduce an extra "osrelease" or "osversion" field but that's actually what we would need. I snuck the "osrelease" into the "kernelrelease" field instead, hope that's ok. Also: any thoughts on getting a GCC newer than 8 into the builder container?
Does this PR introduce a user-facing change?: