Skip to content

Commit c5ea0da

Browse files
ekoopspoiana
authored andcommitted
chore!: drop legacy BPF probe
Falco 0.43.0 deprecated the legacy eBPF probe, and the support will be removed soon in the next libs release. Drop any reference to it and any CI tests testing it. BREAKING CHANGE: drop all code related to legacy BPF probe Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
1 parent 2728f2b commit c5ea0da

File tree

85 files changed

+114
-14926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+114
-14926
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
name: [system_deps, bundled_deps, sanitizers, zig]
2525
include:
2626
- name: system_deps
27-
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=False
27+
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=False
2828
- name: bundled_deps
29-
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=True
29+
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=True
3030
- name: sanitizers
3131
cmake_opts: -DUSE_ASAN=On -DUSE_UBSAN=On -DUSE_BUNDLED_DEPS=False
3232
- name: zig
@@ -116,7 +116,6 @@ jobs:
116116
- name: Build and test 🏗️🧪
117117
run: |
118118
cmake -B build -S . \
119-
-DBUILD_BPF=On \
120119
-DBUILD_DRIVER=Off \
121120
-DUSE_BUNDLED_DEPS=On \
122121
-DUSE_BUNDLED_LIBELF=Off \
@@ -262,7 +261,6 @@ jobs:
262261
-DUSE_BUNDLED_DEPS=On \
263262
-DBUILD_DRIVER=ON \
264263
-DBUILD_LIBSCAP_MODERN_BPF=ON \
265-
-DBUILD_BPF=On \
266264
-DBUILD_LIBSCAP_GVISOR=On \
267265
-DCREATE_TEST_TARGETS=Off \
268266
-DENABLE_LIBSCAP_TESTS=Off

.github/workflows/driver-api-version.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- 'userspace/libscap/engine/modern_bpf/**'
1111
- 'userspace/libscap/engine/kmod/**'
1212
- 'driver/ppm_events_public.h'
13-
- 'driver/bpf/maps.h'
1413
- 'driver/modern_bpf/maps/maps.h'
1514

1615
jobs:

.github/workflows/driverkit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
steps:
3333
- name: Test drivers build on ${{ matrix.name }}
3434
run: |
35-
driverkit docker --kernelrelease ${{ matrix.kernelrelease }} --target ${{ matrix.target }} --output-module /tmp/libs.ko --output-probe /tmp/libs.o --driverversion $GITHUB_SHA --loglevel debug --kernelurls ${{ matrix.kernelurls }}
35+
driverkit docker --kernelrelease ${{ matrix.kernelrelease }} --target ${{ matrix.target }} --output-module /tmp/libs.ko --driverversion $GITHUB_SHA --loglevel debug --kernelurls ${{ matrix.kernelurls }}
3636
3737
build-drivers-arm64:
3838
strategy:
@@ -57,4 +57,4 @@ jobs:
5757
steps:
5858
- name: Test drivers build on ${{ matrix.name }}
5959
run: |
60-
driverkit docker --kernelrelease ${{ matrix.kernelrelease }} --target ${{ matrix.target }} --output-module /tmp/libs.ko --output-probe /tmp/libs.o --driverversion $GITHUB_SHA --loglevel debug --kernelurls ${{ matrix.kernelurls }} --architecture arm64 --timeout 600
60+
driverkit docker --kernelrelease ${{ matrix.kernelrelease }} --target ${{ matrix.target }} --output-module /tmp/libs.ko --driverversion $GITHUB_SHA --loglevel debug --kernelurls ${{ matrix.kernelurls }} --architecture arm64 --timeout 600

.github/workflows/drivers_ci.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,19 @@ jobs:
8383
-DUSE_BUNDLED_DEPS=On \
8484
-DBUILD_DRIVER=ON \
8585
-DBUILD_LIBSCAP_MODERN_BPF=ON \
86-
-DBUILD_BPF=On \
8786
-DBUILD_LIBSCAP_GVISOR=${{ matrix.enable_gvisor }} \
8887
-DCREATE_TEST_TARGETS=On \
8988
-DENABLE_LIBSCAP_TESTS=On \
9089
-DUSE_ASAN=On \
9190
-DUSE_UBSAN=On
92-
cmake --build build --target scap-open driver bpf libscap_test --parallel $(nproc)
91+
cmake --build build --target scap-open driver libscap_test --parallel $(nproc)
9392
9493
- name: Run scap-open with modern bpf 🏎️
9594
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
9695
run: |
9796
cd build
9897
sudo ./libscap/examples/01-open/scap-open --modern_bpf --num_events 10
9998
100-
- name: Run scap-open with bpf 🏎️
101-
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
102-
run: |
103-
cd build
104-
sudo ./libscap/examples/01-open/scap-open --bpf ./driver/bpf/probe.o --num_events 10
105-
10699
- name: Run scap-open with kmod 🏎️
107100
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
108101
run: |
@@ -169,22 +162,15 @@ jobs:
169162
-DENABLE_DRIVERS_TESTS=ON \
170163
-DBUILD_LIBSCAP_MODERN_BPF=ON \
171164
-DMODERN_BPF_DEBUG_MODE=ON \
172-
-DBUILD_BPF=True \
173165
-DBUILD_LIBSCAP_GVISOR=OFF
174-
cmake --build build --target drivers_test driver bpf --parallel $(nproc)
166+
cmake --build build --target drivers_test driver --parallel $(nproc)
175167
176168
- name: Run drivers_test with modern bpf 🏎️
177169
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
178170
run: |
179171
cd build
180172
sudo ./test/drivers/drivers_test -m
181173
182-
- name: Run drivers_test with bpf 🏎️
183-
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
184-
run: |
185-
cd build
186-
sudo ./test/drivers/drivers_test -b
187-
188174
- name: Run drivers_test with kmod 🏎️
189175
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
190176
run: |
@@ -225,17 +211,14 @@ jobs:
225211
-DENABLE_DRIVERS_TESTS=ON \
226212
-DBUILD_LIBSCAP_MODERN_BPF=ON \
227213
-DMODERN_BPF_DEBUG_MODE=ON \
228-
-DBUILD_BPF=True \
229214
-DBUILD_LIBSCAP_GVISOR=OFF \
230215
-DUSE_BUNDLED_LIBELF=OFF
231-
cmake --build . --target drivers_test driver bpf --parallel $(nproc)
216+
cmake --build . --target drivers_test driver --parallel $(nproc)
232217
sudo ./test/drivers/drivers_test -m
233218
rc_modern=$?
234-
sudo ./test/drivers/drivers_test -b
235-
rc_bpf=$?
236219
sudo ./test/drivers/drivers_test -k
237220
rc_kmod=$?
238-
exit $(($rc_modern + $rc_bpf +$rc_kmod))
221+
exit $(($rc_modern + $rc_kmod))
239222
240223
build-drivers-s390x:
241224
name: build-drivers-s390x 😁 (bundle_deps)
@@ -272,9 +255,8 @@ jobs:
272255
-DENABLE_DRIVERS_TESTS=ON \
273256
-DBUILD_LIBSCAP_MODERN_BPF=ON \
274257
-DMODERN_BPF_DEBUG_MODE=ON \
275-
-DBUILD_BPF=ON \
276258
-DBUILD_LIBSCAP_GVISOR=OFF
277-
cmake --build build --target drivers_test driver bpf --parallel $(nproc)
259+
cmake --build build --target drivers_test driver --parallel $(nproc)
278260
279261
build-modern-bpf-skeleton:
280262
needs: paths-filter
@@ -346,7 +328,6 @@ jobs:
346328
-DBUILD_LIBSCAP_MODERN_BPF=ON \
347329
-DMODERN_BPF_SKEL_DIR=/tmp \
348330
-DBUILD_DRIVER=Off \
349-
-DBUILD_BPF=Off
350331
351332
- name: Build project
352333
run: |

.github/workflows/e2e_ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ jobs:
7676
cmake -B build -S . \
7777
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
7878
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
79-
-DBUILD_BPF=ON \
8079
-DUSE_BUNDLED_DEPS=ON \
8180
-DUSE_ASAN=ON \
8281
-DUSE_UBSAN=ON \
@@ -103,7 +102,7 @@ jobs:
103102
strategy:
104103
matrix:
105104
arch: [amd64, arm64]
106-
driver: [ {name: kmod, option: -k}, {name: bpf, option: -b}, {name: modern-bpf, option: -m} ]
105+
driver: [ {name: kmod, option: -k}, {name: modern-bpf, option: -m} ]
107106
fail-fast: false
108107
steps:
109108
- name: Checkout Libs ⤵️
@@ -145,7 +144,7 @@ jobs:
145144
# different workers, so we rebuild the drivers.
146145
- name: Rebuild drivers
147146
run: |
148-
cmake --build build --target driver bpf --parallel $(nproc) -- -B # -B only works if make is the generator.
147+
cmake --build build --target driver --parallel $(nproc) -- -B # -B only works if make is the generator.
149148
pushd build/test/libsinsp_e2e/resources/
150149
sudo tar xzf fake-proc.tar.gz
151150

.github/workflows/latest-kernel.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
echo "driverversion: ${{ github.sha }}" >> dk.yaml
3232
echo "output:" >> dk.yaml
3333
echo " module: mod.ko" >> dk.yaml
34-
echo " probe: probe.o" >> dk.yaml
3534
if [ "${{ inputs.linux-version }}" = "" ]; then
3635
krel=$(grep "_tag" PKGBUILD | head -n1 | awk -F"=" '{print $2}')
3736
echo "kernelrelease: ${krel:1}" >> dk.yaml

.github/workflows/reusable_e2e_tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ jobs:
9191
- name: Build tests 🏗️
9292
run: |
9393
cmake -B build -S . \
94-
-DBUILD_BPF=ON \
9594
-DBUILD_LIBSCAP_MODERN_BPF=ON \
9695
-DBUILD_LIBSCAP_GVISOR=OFF \
9796
-DENABLE_E2E_TESTS=ON \
9897
${{ matrix.cmake_opts }} \
9998
-DUSE_BUNDLED_LIBBPF=ON
100-
cmake --build build --target sinsp-example driver bpf container_plugin --parallel $(nproc)
99+
cmake --build build --target sinsp-example driver container_plugin --parallel $(nproc)
101100
sudo -E cmake --build build --target e2e-install-deps
102101
103102
- name: Download overriding custom container plugin

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ option(USE_BUNDLED_DRIVER
5858
"Use the driver/ subdirectory in the build process (only available in Linux)" ON
5959
)
6060
option(ENABLE_E2E_TESTS "Enable e2e tests" OFF)
61-
option(ENABLE_DRIVERS_TESTS "Enable driver tests (bpf, kernel module, modern bpf)" OFF)
61+
option(ENABLE_DRIVERS_TESTS "Enable driver tests (kernel module, modern bpf)" OFF)
6262
option(ENABLE_LIBSCAP_TESTS "Enable libscap unit tests" OFF)
6363
option(ENABLE_LIBSINSP_E2E_TESTS "Enable libsinsp e2e tests" OFF)
6464
option(BUILD_SHARED_LIBS "Build libscap and libsinsp as shared libraries" OFF)

CMakePresets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
"CMAKE_BUILD_TYPE": "Release",
1010
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
1111
"BUILD_DRIVER": "ON",
12-
"BUILD_BPF": "ON",
1312
"BUILD_WARNINGS_AS_ERRORS": "ON"
1413
}
1514
},
1615
{
1716
"name": "scap-drivers",
1817
"inherits": "base",
1918
"displayName": "Build scap drivers and their tests",
20-
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
19+
"description": "Build all scap drivers (modern eBPF, kmod) and their tests",
2120
"binaryDir": "${sourceDir}/build-scap-drivers",
2221
"cacheVariables": {
2322
"USE_BUNDLED_DEPS": "ON",

README.md

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Drivers](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/FedeDP/1cbc5d42edf8e3a02fb75e76625f1072/raw/kernel.json)](https://github.com/falcosecurity/libs/actions/workflows/latest-kernel.yml)
88
[![Github Pages](https://github.com/falcosecurity/libs/actions/workflows/pages.yml/badge.svg)](https://falcosecurity.github.io/libs/)
99

10-
This repository contains **libsinsp**, **libscap**, the **kernel module** and the **eBPF probes** sources.
10+
This repository contains **libsinsp**, **libscap**, the **kernel module** and the **modern eBPF probe** sources.
1111

1212
These components are at the foundation of [Falco](https://github.com/falcosecurity/falco) and other projects that work with the same kind of data.
1313

@@ -20,7 +20,7 @@ An image is worth a thousand words, they say:
2020

2121
## Project Layout
2222

23-
* [_driver/_](./driver) contains kernel module and eBPF probe source code,
23+
* [_driver/_](./driver) contains kernel module and modern eBPF probe source code,
2424
so-called **drivers**.
2525
* [_userspace/_](./userspace) contains libscap and libsinsp libraries code.
2626
* **libscap** (aka lib for *System CAPture*) is the userspace library
@@ -41,13 +41,13 @@ external dependencies, plus the libscap and libsinsp ones; consumers
4141

4242
Our drivers officially support the following architectures:
4343

44-
| | Kernel module | eBPF probe | Modern eBPF probe | Status |
45-
| ----------- |----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| ----------------- | ------ |
46-
| **x86_64** | >= 3.10 | >= 4.14 | >= 5.8 | _STABLE_ |
47-
| **aarch64** | >= [3.16](https://github.com/torvalds/linux/commit/055b1212d141f1f398fca548f8147787c0b6253f) | >= 4.17 | >= 5.8 | _STABLE_ |
48-
| **s390x** | >= 3.10 | >= [5.5](https://github.com/torvalds/linux/commit/6ae08ae3dea) | >= 5.8 | _EXPERIMENTAL_ |
49-
| **riscv64** | >= [5.0](https://github.com/torvalds/linux/commit/5aeb1b36cedd3a1dfdbfe368629fed52dee34103) | N/A | N/A | _EXPERIMENTAL_ |
50-
| **ppc64le** | >= 3.10 | >= [5.1](https://github.com/torvalds/linux/commit/ed1cd6deb013a11959d17a94e35ce159197632da) | >= 5.8 | _STABLE_ |
44+
| | Kernel module | Modern eBPF probe | Status |
45+
| ----------- |----------------------------------------------------------------------------------------------| ----------------- | ------ |
46+
| **x86_64** | >= 3.10 | >= 5.8 | _STABLE_ |
47+
| **aarch64** | >= [3.16](https://github.com/torvalds/linux/commit/055b1212d141f1f398fca548f8147787c0b6253f) | >= 5.8 | _STABLE_ |
48+
| **s390x** | >= 3.10 | >= 5.8 | _EXPERIMENTAL_ |
49+
| **riscv64** | >= [5.0](https://github.com/torvalds/linux/commit/5aeb1b36cedd3a1dfdbfe368629fed52dee34103) |N/A | _EXPERIMENTAL_ |
50+
| **ppc64le** | >= 3.10 | >= 5.8 | _STABLE_ |
5151

5252

5353
To access up-to-date status reports on Falco drivers kernel testing, please visit this [page](https://falcosecurity.github.io/libs/). It provides a list of supported syscalls as well as the [report](https://falcosecurity.github.io/libs/report/).
@@ -109,7 +109,6 @@ For your convenience, we have included the instructions for building the `libs`
109109
The project utilizes the `cmake` build system, and the key `make` targets are as follows:
110110

111111
* `driver` -> build the kmod
112-
* `bpf` -> build the legacy `ebpf` probe
113112
* `scap` -> build libscap (`modern_ebpf` driver will be bundled into `scap` if enabled)
114113
* `sinsp` -> build libsinsp (depends upon `scap` target)
115114
* `scap-open` -> build a small example binary for `libscap` to test the drivers (dependent on `scap`)
@@ -154,19 +153,6 @@ make driver
154153
ls -l driver/src/scap.ko;
155154
```
156155

157-
### Build driver - eBPF probe
158-
159-
To build the eBPF probe, you need `clang` and `llvm` packages and you also need your kernel headers installed. Check out Falco's [official documentation](https://falco.org/docs/install-operate/source/).
160-
161-
```bash
162-
cmake -DBUILD_BPF=ON ../;
163-
make bpf
164-
# Verify the eBPF bytecode file was created, uses `.o` extension.
165-
ls -l driver/bpf/probe.o;
166-
```
167-
168-
>__WARNING__: **clang-7** is the oldest supported version to build our BPF probe.
169-
170156
### Build driver - modern eBPF probe
171157

172158
To build the modern eBPF probe, further prerequisites are necessary:
@@ -191,9 +177,7 @@ To build the modern eBPF probe, further prerequisites are necessary:
191177
192178
> __NOTE:__ These are not the requirements to use the modern BPF probe, but rather for building it from source.
193179
194-
Regarding the previously discussed legacy eBPF driver, it generates kernel-specific bytecode (`driver/bpf/probe.o`) tailored to your machine's kernel release (`uname -r`). The location of the bytecode file can then be passed as an argument for testing with the `scap-open` and `sinsp-example` binaries.
195-
196-
However, the modern eBPF driver build process doesn't require kernel headers, and it isn't tied to your kernel release. This is enabled by the CO-RE (Compile Once - Run Everywhere) feature of the modern eBPF driver.
180+
The modern eBPF driver build process doesn't require kernel headers, and it isn't tied to your kernel release. This is enabled by the CO-RE (Compile Once - Run Everywhere) feature of the modern eBPF driver.
197181
198182
CO-RE allows the driver to work on kernels with backported BTF (BPF Type Format) support or kernel versions >= 5.8. The way the driver interprets kernel data structures without direct knowledge of the running kernel is not magic — it leverages predefined type information and BTF-based relocations. We maintain a [vmlinux.h](driver/modern_bpf/definitions/vmlinux.h) file containing essential kernel data structure definitions, allowing the eBPF program to reference fields dynamically. Additionally, for cases where macros or functions from system headers are required, we redefine them in [struct_flavors.h](driver/modern_bpf/definitions/struct_flavors.h). Combined with CO-RE (Compile Once, Run Everywhere), this enables the driver to remain portable across different kernel versions.
199183
@@ -243,7 +227,7 @@ This repository includes convenient test example binaries for both `scap` and `s
243227

244228
When developing new features, you would run either one depending on what you're working on, in order to test and validate your changes.
245229

246-
> __NOTE:__ When you're working on driver development, it can be quite useful to make use of the kernel's built-in `printk` functionality. However, for the traditional bpf driver, you'll need to uncomment a line in the [bpf Makefile](driver/bpf/Makefile) first and use a dedicated build flag `BPF_DEBUG`. For modern eBPF, use the build flag `MODERN_BPF_DEBUG_MODE`. Any logs generated by `bpf_printk()` will be written to `/sys/kernel/debug/tracing/trace_pipe`. Just make sure you have the right permissions set up for this.
230+
> __NOTE:__ When you're working on driver development, it can be quite useful to make use of the kernel's built-in `printk` functionality. For modern eBPF, use the build flag `MODERN_BPF_DEBUG_MODE`. Any logs generated by `bpf_printk()` will be written to `/sys/kernel/debug/tracing/trace_pipe`. Just make sure you have the right permissions set up for this.
247231
248232
Here's an example of a `cmake` command that will enable everything you need for all tests and components. By default, the following flags are disabled, with the exception of `USE_BUNDLED_DEPS` and `CREATE_TEST_TARGETS` (they are enabled by default).
249233

@@ -252,10 +236,8 @@ cmake \
252236
-DUSE_BUNDLED_DEPS=ON \
253237
-DBUILD_LIBSCAP_MODERN_BPF=ON \
254238
-DBUILD_LIBSCAP_GVISOR=ON \
255-
-DBUILD_BPF=ON \
256239
-DBUILD_DRIVER=ON \
257240
-DMODERN_BPF_DEBUG_MODE=ON \
258-
-DBPF_DEBUG=ON \
259241
-DCREATE_TEST_TARGETS=ON \
260242
-DENABLE_LIBSCAP_TESTS=ON \
261243
-DENABLE_DRIVERS_TESTS=ON \
@@ -268,7 +250,6 @@ cmake \
268250
269251
```bash
270252
nproc=$(grep processor /proc/cpuinfo | tail -n 1 | awk '{print $3}');
271-
rm -f driver/bpf/probe.o; make bpf;
272253
rm -f driver/src/scap.ko; make driver;
273254
# scap-open binary
274255
rm -f libscap/examples/01-open/scap-open; make -j$(($nproc-1)) scap-open;

0 commit comments

Comments
 (0)