Kernel Events

Events related to the Kernel tells us most of what happens above.

Falco uses different instrumentations to analyze the system workload and pass security events to userspace. We usually refer to these instrumentations as drivers since a driver runs in kernelspace. The driver provides the syscall event source since the monitored events are strictly related to the syscall context.

There are several supported drivers:

  • Modern eBPF probe (default)
  • Kernel module
Kernel moduleModern eBPF probe
x86_64>= 3.10Minimal set of features
aarch64>= 3.10Minimal set of features

Kernel module

By default, the kernel module will be installed when installing the Falco debian/rpm package, when running the falcoctl driver tool shipped within the binary package, or when running the falcosecurity/falco-driver-loader docker image (that just wraps the aforementioned tool).

To install the kernel module, please refer to the installation page.

Least privileged mode

The kernel module requires full privileges and cannot run with Linux capabilities

Modern eBPF probe

The modern eBPF probe is an alternative driver for Falco. The main advantage it brings to the table is that it is embedded into Falco, which means that you don't have to download or build anything, if your kernel is recent enough Falco will automatically inject it!

What's new

The new probe is highly customizable, you are not obliged to use one buffer for each CPU you can also use just one huge buffer for all your CPUs! And obviously, also the buffer size is customizable! All this is possible thanks to new outstanding features like the CO-RE paradigm, the BPF ring buffer and many others, if you are curious you can read more about them in this blog post.

Requirements

The modern eBPF probe doesn't require a specific kernel version. Usually, all versions >=5.8 are enough but there are cases in which the required features could also be backported into older kernels, so it wouldn't be completely fair to define 5.8 as the first supported version. The 2 main required features are:

  1. BPF ring buffer support.
  2. A kernel that exposes BTF.

Falco can automatically detect if these features are available on the running machine and can notify you if something is missing. As an alternative, you could always use bpftool, you just need to type the following commands:

sudo bpftool feature probe kernel | grep -q "map_type ringbuf is available" && echo "true" || echo "false" 
sudo bpftool feature probe kernel | grep -q "program_type tracing is available" && echo "true" || echo "false" 

How to run it

Modern eBPF probe is bundled into the userspace binary and works out of the box, regardless of the kernel release, thanks to the eBPF feature called 'Compile Once Run Everywhere' (CO-RE). To enable it in Falco, just set the engine.kind configuration key to modern_ebpf.

It is supported in all the installation methods of other drivers:

Useful resources

Least privileged mode

The minimal set of capabilities required by Falco to run the modern eBPF probe is the following:

  • CAP_SYS_BPF
  • CAP_SYS_PERFMON
  • CAP_SYS_RESOURCE
  • CAP_SYS_PTRACE

Let's see them in detail:

  • CAP_SYS_RESOURCE: Falco needs this capability to be able to call the setrlimit syscall. The setrlimit syscall is used together with the RLIMIT_MEMLOCK flag to change the amount of memory that can be mlocked into RAM. The default value for this memory limit is very low, so even a very simple eBPF program would fail. The workaround is to increase the default value to something acceptable so eBPF maps can be correctly mlocked in memory.
  • CAP_SYS_PTRACE: Falco needs this capability because it accesses paths like /proc/<pid>/environ. From the userspace standpoint, the permission to do so is mapped to the CAP_SYS_PTRACE capability. For the curious reader, see environ_open implementation in the kernel.
  • CAP_SYS_ADMIN: Falco needs this capability to load eBPF programs and maps, and to interact with the system using the bpf syscall.

This set of capabilities should work most of the time but under some conditions, it is possible to replace the CAP_SYS_ADMIN with two more granular capabilities: CAP_SYS_BPF and CAP_SYS_PERFMON.

The only condition needed is a kernel version that supports these capabilities. The Linux Kernel version 5.8 is the first one that officially supports them but they could have been backported on older versions on some distributions.

Please note: we will try to do our best to keep this as the minimum required set but due to some issues with CO-RE relocations it is possible that this changes in the future.