Commit Graph

1748 Commits

Author SHA1 Message Date
Leonardo Grasso
7994460666 new(userspace/engine): validation for unknown-key in rules
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-03-17 12:03:34 +01:00
Leonardo Grasso
9aed480082 fix(userspace/engine): JSON Schema fixes
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-03-17 12:03:34 +01:00
Adnan Ali
6d20070f27 fix(metrics): Prevent race condition crash during metrics collection on shutdown
This fixes a segmentation fault that occurs when /metrics endpoint is accessed during Falco shutdown. The crash happens as the webserver continues serving /metrics requests after outputs and inspectors have been destroyed.

Changes:

- Create cleanup_outputs action to handle outputs destruction
- Create print_stats action for stats printing
- Reorder teardown steps to stop webserver before destorying outputs
- Move outputs.reset() from process_events to cleanup_outputs()

This eliminates the race condition by ensuring the webserver stops accepting requests before any subsystems are destroyed. The synchronisation behaviour of output.reset() block till queue flushed is preserved.

Signed-off-by: Adnan Ali <adduali1310@hotmail.com>
2026-03-16 10:46:29 +01:00
Leonardo Grasso
59dae06e13 update(engine): bump engine version to 0.60.0
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-03-12 17:12:07 +01:00
irozzo-1A
8989870d26 fix(userspace/falco): fix watchdog race condition on timeout exchange
The watchdog thread and stop() consume the timeout pointer with
m_timeout.exchange(nullptr, ...). That exchange was using
memory_order_release. The load part of the RMW needs acquire
semantics so it synchronizes-with the release store in
set_timeout()/cancel_timeout(); otherwise the consumer can see
the pointer value without seeing the writes that initialized
the timeout_data and payload (data race).
Use memory_order_acq_rel on the consumer exchanges so the load
synchronizes-with the producer and the pointed-to memory is
visible before use.

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-03-12 13:21:07 +01:00
irozzo-1A
6fdb686b7a chore(falco): fix warning in webserver.h
/workspaces/falco/userspace/falco/app/../webserver.h:36:2: warning: explicitly defaulted move constructor is implicitly deleted [-Wdefaulted-function-deleted]
   36 |         falco_webserver(falco_webserver&&) = default;
      |         ^
/workspaces/falco/userspace/falco/app/../webserver.h:49:20: note: move constructor of 'falco_webserver' is implicitly deleted because field 'm_failed' has a deleted move constructor
   49 |         std::atomic<bool> m_failed;
      |                           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/13/../../../../include/c++/13/atomic:72:5: note: 'atomic' has been explicitly marked deleted here
   72 |     atomic(const atomic&) = delete;
      |     ^
/workspaces/falco/userspace/falco/app/../webserver.h:36:39: note: replace 'default' with 'delete'
   36 |         falco_webserver(falco_webserver&&) = default;
      |                                              ^~~~~~~
      |                                              delete
/workspaces/falco/userspace/falco/app/../webserver.h:37:19: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
   37 |         falco_webserver& operator=(falco_webserver&&) = default;
      |                          ^
/workspaces/falco/userspace/falco/app/../webserver.h:49:20: note: move assignment operator of 'falco_webserver' is implicitly deleted because field 'm_failed' has a deleted move assignment operator
   49 |         std::atomic<bool> m_failed;
      |                           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/13/../../../../include/c++/13/atomic:73:13: note: 'operator=' has been explicitly marked deleted here
   73 |     atomic& operator=(const atomic&) = delete;
      |             ^
/workspaces/falco/userspace/falco/app/../webserver.h:37:50: note: replace 'default' with 'delete'
   37 |         falco_webserver& operator=(falco_webserver&&) = default;
      |                                                         ^~~~~~~
      |                                                         delete

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-03-11 12:33:06 +01:00
irozzo-1A
7554de160a fix(engine): add unknown filter match in err_is_unknown_type_or_field
After PR https://github.com/falcosecurity/libs/pull/2776 a new error
message has been introduced for unknown types.

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-03-11 12:05:07 +01:00
irozzo-1A
17ebbecec9 feat(userspace/engine): update libs ref and adapt to transformer AST changes
- Bump default falcosecurity/libs to latest main (8f6b914) with
  transformer_list_expr and field_transformer_expr (values) support
- Add visit(transformer_list_expr*) to filter_details_resolver and
  filter_macro_resolver visitors
- Fix field_transformer_expr handling to use e->values instead of e->value

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-03-11 12:05:07 +01:00
Paolo Polidori
865284dffe fix(webserver): fix inconsistent include directives trying to compile the webserver on Apple
Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
2026-02-19 11:54:55 +01:00
irozzo-1A
b511b54d21 chore(build): add support for gperftools CPU profiler
Add comprehensive support for gperftools CPU profiler to enable performance
profiling of Falco. This commit introduces:

- New CMake options:
  * USE_GPERFTOOLS: Enable gperftools CPU profiler support (default: OFF)
  * USE_FRAME_POINTER: Enable frame pointers for accurate profiling (default: OFF)

- Automatic frame pointer enabling: When USE_GPERFTOOLS is enabled, frame
  pointers are automatically enabled to ensure accurate stack traces in
  profiling output.

- Support for both system and bundled gperftools:
  * System gperftools: Automatically detected via find_path/find_library
  * Bundled gperftools: Built from source (version 2.15) when
    USE_BUNDLED_GPERFTOOLS is enabled

- Enhanced stack trace support: Automatically detects and enables libunwind
  when available for better stack traces, falling back to frame pointers
  otherwise.

- Proper library linking: Uses --whole-archive linker flags to ensure
  profiler initialization code is linked even when ProfilerStart() is not
  called directly, enabling CPUPROFILE environment variable support.

- Compile-time detection: Adds HAS_GPERFTOOLS preprocessor definition
  for conditional compilation.

The profiler can be activated at runtime by setting the CPUPROFILE
environment variable to a file path where profiling data should be written.

Usage:
  cmake -DUSE_GPERFTOOLS=ON ..
  make
  CPUPROFILE=/tmp/falco.prof ./falco

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2026-02-12 11:32:11 +01:00
Leonardo Di Giovanna
43aaffc4e0 chore!: drop gRPC output and server support
Falco 0.43.0 deprecated the gRPC output and server supports. Drop
their supports as well as any reference to them.

BREAKING CHANGE: drop gRPC output and server support

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2026-02-05 17:21:54 +01:00
Leonardo Di Giovanna
33a2ce53fd chore!: drop gVisor engine support
Falco 0.43.0 deprecated the gVisor engine support. Drop its support as
well as any reference to it.

BREAKING CHANGE: drop gVisor engine support

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2026-02-05 15:29:54 +01:00
Leonardo Di Giovanna
387499546f chore!: drop legacy BPF probe
Falco 0.43.0 deprecated the legacy eBPF probe. Drop it as well as any
reference to it.

BREAKING CHANGE: drop legacy eBPF probe

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2026-02-05 13:15:54 +01:00
Leonardo Grasso
cca5356911 fix(userspace)!: show source config path only in debug builds
Starting from Falco 0.40, the `falco --help` output incorrectly showed
  the source config path (e.g., /home/runner/work/falco/falco/falco.yaml)
  in release packages. This path was intended only for local development.

  The issue was introduced when RelWithDebInfo build type support was
  added (commit 6bf33ffd). The existing code checked for BUILD_TYPE_RELEASE
  to determine release behavior, but RelWithDebInfo builds defined
  BUILD_TYPE_RELWITHDEBINFO instead, causing them to fall into the
  debug code path.

  This fix introduces BUILD_TYPE_DEBUG and changes the conditionals to
  enable dev features only when CMAKE_BUILD_TYPE is explicitly "debug".
  Both Release and RelWithDebInfo builds now correctly show only
  /etc/falco/falco.yaml.

  Fixes the regression introduced in 0.40.0

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-01-23 15:39:47 +01:00
Leonardo Di Giovanna
bb8f6fa136 chore(userspace): deprecate --gvisor-generate-config CLI option
DEPRECATION NOTICE: deprecate `--gvisor-generate-config` CLI option

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2026-01-23 12:08:46 +01:00
Leonardo Grasso
69581443ae fix(userspace/engine): missing closing quote in deprecated field warning
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-01-21 16:16:32 +01:00
Kevin Vu
3dabda4b7d fix: prevent NULL pointer crash in program_output on popen failure
Signed-off-by: Kevin Vu <vietcgi@gmail.com>
2026-01-12 09:31:44 +01:00
Leonardo Di Giovanna
8b01753f6e chore(userspace): deprecate legacy eBPF probe, gVisor engine and gRPC
DEPRECATION NOTICE: deprecate legacy eBPF, gVisor and gRPC

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2026-01-08 15:50:17 +01:00
Leonardo Di Giovanna
e34a6b28eb chore(cmake): bump libs/drivers to 0.23.0/9.1.0+driver
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-12-24 09:36:41 +01:00
Adnan Ali
f4df5681fd fix(metrics): Add null check for state.outputs in metrics collection
This change adds a defensive null check before accessing state.outputs->get_outputs_queue_num_drops() to prevent segfaults if outputs is destroyed while metrics are being collected.

Signed-off-by: Adnan Ali <adduali1310@hotmail.com>
2025-12-23 15:18:38 +01:00
irozzo-1A
5b53681d2f chore(engine): add deprecation warning for evt.latency when used in conditions
Emit a deprecation warning when `evt.latency` is detected in a rule
condition.

Signed-off-by: irozzo-1A <iacopo@sysdig.com>
2025-12-01 12:54:18 +01:00
Leonardo Grasso
933fb7e823 fix(userspace/falco): correct default duration calculation
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-10-21 20:53:44 +02:00
Iacopo Rozzo
9eacf5e58f chore(deps): bump libs version to 0.22.0
Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-10-17 15:09:15 +02:00
Iacopo Rozzo
1717a98749 feat(engine): emit warning when a rule output uses deprecated "evt.dir"
Emit a warning when a rule uses the deprecated "evt.dir" field in output.

Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-10-14 09:46:43 +02:00
Leonardo Grasso
38be8ba5d2 update(cmake): update libs and driver to 0.22 dev
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-10-13 12:32:37 +02:00
Iacopo Rozzo
8c4e5aa854 Use generic DEPRECATED_ITEM warning code
Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-10-09 14:06:12 +02:00
Iacopo Rozzo
42085c9d7a feat(engine): emit warning when a condition uses deprecated "evt.dir"
Emit a warning when a rule with a condition using "evt.dir" field is
encountered.
The direction have been deprecated in the scope of enter event
suppression initiative.

Signed-off-by: Iacopo Rozzo <iacopo.rozzo@iacopo.rozzo>
2025-10-09 14:06:12 +02:00
Leonardo Grasso
573871955c chore(userspace/engine): bump Falco engine version to 0.56.0
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-09-30 18:52:12 +02:00
Tero Kauppinen
eee4acc488 fix(userspace/falco): fix actions taken when events are dropped
User can configure a list of actions that are taken when Falco
detects a threshold exceeding value in drop statistics.

However, the logic that handles the list of configured actions
is designed to process only a single action; it takes only the
first action of the list. This approach has the problem that the
order of the actions comes as the deciding factor in choosing
which action is taken in case there are more than one action.

This fix enables Falco to process all actions on the list.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-09-30 18:36:12 +02:00
Iacopo Rozzo
7fb9986e5a fix(prometheus): deprecate enter events drop stats
Enter events are no longer tracked by the Falco libs, this change
deprecates the Prometheus metrics related to enter event drops.

Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-09-23 10:37:08 +02:00
Leonardo Di Giovanna
4fa53452c3 fix(userspace/engine): fix logger date format
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-09-18 14:54:46 +02:00
Leonardo Di Giovanna
4d3b685c8b feat: make libs internal auto thread purging intervals configurable
Make Falco's libs internal auto thread purging interval and timeout
configurable and set their default values to 5 minutes. This helps
controlling the memory impact of process exit events dropping and
events re-ordering.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-09-16 15:42:34 +02:00
Samuel Gaist
7c7196f1f0 chore: pre-commit cleanup
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
e34caee3f8 Revert "refactor(userspace/falco): remove duplicate condition test"
This reverts commit 0ae61528fb.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
909122a849 refactor(userspace/falco): remove duplicate condition test
handled is test a second time for the same while it's already
part of the initial entry condition.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
e8c527f204 refactor(userspace/falco): comment out unused variable names
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
179234e08e refactor(userspace/falco): add missing override
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
d6fde4ac16 refactore(userspace/falco): use static_cast rather than c style cast
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
cdea5ad35f refactor(userspace/falco): correct variable scope
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
07438534e7 refactor(userspace/falco): add missing initial value
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
dadf81ed9d fix(userspace/falco): use correct qualifier for size_t in printf
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
3b91cb685f refactor(userspace/falco): const correctness
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
e5654849d4 refactor(userspace/engine): port from asctime to strftime
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
0cc39ac5e7 refactor(userspace/engine): make constructor explicit
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
d9f561cd7b refactor(userspace/engine): remove unused variable
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
668bbfc9de refactor(userpsace/engine): add missing override
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
4d03686999 refactor(userspace/engine): fix variable scope
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Samuel Gaist
2da40e798b refactor(userspace/engine): const correctness
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Leonardo Grasso
fda1430afb fix(userspace/falco): smart pointer for sinsp_dumper
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-08-12 11:25:43 +02:00
Leonardo Grasso
97d88d12f1 chore(userspace/engine): initialize bool member for falco_rule
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-08-12 11:25:43 +02:00