falcosecurity / driverkit

Kit for building Falco drivers: kernel modules or eBPF probes
Apache License 2.0
62 stars 52 forks source link

fix(pkg/driverbuilder): fixed debian `rpi` and `rt` flavors kernel urls fetching #329

Closed FedeDP closed 3 months ago

FedeDP commented 3 months ago

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area pkg

What this PR does / why we need it:

This PR fixes support to fetch kernel headers for debian rpi and rt flavors, where the common package has the -$flavor suffix.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Example:

./_output/bin/driverkit docker --target debian --kernelrelease 4.19.0-26-rt-amd64 --kernelversion 1 --output-probe /tmp/mod.o --loglevel debug --builderimage auto:master
level=DEBUG msg="running without a configuration file"
level=DEBUG msg="running with options" output-module="" output-probe=/tmp/mod.o driverversion=master kernelrelease=4.19.0-26-rt-amd64 kernelversion=1 target=debian arch=amd64 kernelurls=[] repo-org=falcosecurity repo-name=libs
level=INFO msg="driver building, it will take a few seconds" processor=docker
level=DEBUG msg="doing a new docker build"
level=DEBUG msg="kernel header url found" url=http://security-cdn.debian.org/pool/main/l/linux/linux-headers-4.19.0-26-rt-amd64_4.19.304-1_amd64.deb
level=DEBUG msg="kernel header url found" url=http://security-cdn.debian.org/pool/main/l/linux/linux-headers-4.19.0-26-common-rt_4.19.304-1_all.deb
level=DEBUG msg="kernel header url found" url=http://mirrors.kernel.org/debian/pool/main/l/linux/linux-kbuild-4.19_4.19.249-2_amd64.deb

As you can see, proper headers are now found and the build succeeds:

level=INFO msg="eBPF probe available" path=/tmp/mod.o

Does this PR introduce a user-facing change?:

NONE
FedeDP commented 3 months ago

On master instead:

./_output/bin/driverkit docker --target debian --kernelrelease 4.19.0-26-rt-amd64 --kernelversion 1 --output-probe /tmp/mod.o --loglevel debug --builderimage auto:master
level=DEBUG msg="running without a configuration file"
level=DEBUG msg="running with options" output-module="" output-probe=/tmp/mod.o driverversion=master kernelrelease=4.19.0-26-rt-amd64 kernelversion=1 target=debian arch=amd64 kernelurls=[] repo-org=falcosecurity repo-name=libs
level=INFO msg="driver building, it will take a few seconds" processor=docker
level=DEBUG msg="doing a new docker build"
level=ERROR msg=exiting err="kernel headers not found"
FedeDP commented 3 months ago

/cc @EXONER4TED

poiana commented 3 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EXONER4TED, FedeDP

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: - ~~[OWNERS](https://github.com/falcosecurity/driverkit/blob/master/OWNERS)~~ [EXONER4TED,FedeDP] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment