Compare commits

...

1086 Commits

Author SHA1 Message Date
Angelo Puglisi 082157de78 fix(userspace/libsinsp): sinsp_filter_check_user::extract_single return-stack-address
Address the following warning (we build with -Werror...):
```
/__w/libs/libs/userspace/libsinsp/sinsp_filtercheck_user.cpp:104:26: warning: address of stack memory associated with local variable 'user' returned [-Wreturn-stack-address]
  104 |                         RETURN_EXTRACT_STRING(user);
      |                                               ^~~~
/__w/libs/libs/userspace/libsinsp/sinsp_filtercheck_user.cpp:34:21: note: expanded from macro 'RETURN_EXTRACT_STRING'
   34 |                 return (uint8_t*)(x).c_str(); \
      |                                   ^
```

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-08-06 16:39:05 +02:00
Holger Hoffstätte a273f3d05c fix(libsinsp): use proper INET6_ADDRSTRLEN buffer size for inet_ntop
glibc-2.42 added __inet_ntop_chk fortification, which started to fail:

  *** buffer overflow detected ***: terminated
  Program received signal SIGABRT, Aborted.
  0x00007ffff629b0dc in __pthread_kill_implementation () from /lib64/libc.so.6
  (gdb) bt
  #0  0x00007ffff629b0dc in __pthread_kill_implementation () from /lib64/libc.so.6
  #1  0x00007ffff6242572 in raise () from /lib64/libc.so.6
  #2  0x00007ffff6229f3b in abort () from /lib64/libc.so.6
  #3  0x00007ffff622b148 in __libc_message_impl.cold () from /lib64/libc.so.6
  #4  0x00007ffff6327337 in __fortify_fail () from /lib64/libc.so.6
  #5  0x00007ffff6326c92 in __chk_fail () from /lib64/libc.so.6
  #6  0x00007ffff6327a62 in __inet_ntop_chk () from /lib64/libc.so.6
  #7  0x000055555569da3d in inet_ntop (__af=10, __src=0x555555ee0800, __dst=0x7fffffff4f90 "\260P\377\377\377\177", __dst_size=100) at /usr/include/bits/inet-fortified.h:36
  #8  ipv6tuple_to_string[abi:cxx11](ipv6tuple*, bool) (tuple=0x555555ee0800, resolve=false) at /tmp/portage/dev-debug/sysdig-0.40.1/work/libs-0.20.0/userspace/libsinsp/utils.c

Use INET6_ADDRSTRLEN as destination buffer size.

Fixes: https://github.com/falcosecurity/libs/issues/2573
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2025-08-04 12:16:49 +02:00
Federico Di Pierro 8cd5fbf687 fix(userspace/libsinsp): properly check `lastevent_retrieved` value before accessing `enter_evt` in `parse_open_openat_creat_exit` for `PPME_SYSCALL_OPENAT_X`.
Also, fixed a small bug in a test.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-08-04 10:00:48 +02:00
Federico Di Pierro b530bf90fb cleanup(userspace/libsinsp): drop `sinsp_parser::m_tmp_events_buffer`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-08-04 10:00:48 +02:00
Tero Kauppinen fc31690604 feat(savefile): add empty parameter support for PPME_SETPGID_X
Support for empty parameters was added with
https://github.com/falcosecurity/libs/pull/2550.

This update adds empty parameter support for `PPME_SYSCALL_SETPGID_X`.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-08-04 09:46:48 +02:00
Tero Kauppinen 831ed012e0 feat(savefile): add empty parameter support for PPME_SYSCALL_SETNS_X
Support for empty parameters was added with
https://github.com/falcosecurity/libs/pull/2550.

This update adds empty parameter support for `PPME_SYSCALL_SETNS_X`.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-08-04 09:46:48 +02:00
Tero Kauppinen 90c9ffecd5 feat(savefile): added empty parameter support for PPME_SYSCALL_FCHDIR_X
Support for empty parameters was added with
https://github.com/falcosecurity/libs/pull/2550.

This update adds empty parameter support for `PPME_SYSCALL_FCHDIR_X`.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-08-01 12:39:29 +02:00
Leonardo Di Giovanna 719eeed0bc refactor(userspace/libsinsp): remove timestamp saving custom logic
Remove unused timestamp saving custom logic in parser for
`PPME_SYSCALL_SELECT_E`, `PPME_SYSCALL_POLL_X`,
`PPME_SYSCALL_PPOLL_X` and `PPME_SYSCALL_EPOLLWAIT_X` events

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-08-01 12:11:29 +02:00
Federico Di Pierro 59960f5df1 update(cmake): bumped container plugin to 0.3.4.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-08-01 10:19:28 +02:00
Tero Kauppinen b5e18368c5 cleanup(libsinsp): utilize `get_exit_event_fd_location`
The current implementation uses custom code for fetching
the location of fd-related arguments for specific syscalls.

This update removes the custom code and utilizes the
existing `get_exit_event_fd_location` function instead by
expanding it with the location of the `dirfd' argument.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-31 15:39:24 +02:00
Tero Kauppinen 6685f4a0ec fix: add `EF_USES_FD` flag to events missing it
Some of the events in `g_event_info` structure are not flagged
with `EF_USES_FD` but still use the fd information when parsing.

Add the flag to the following events:

PPME_SYSCALL_SYMLINKAT_X
PPME_SYSCALL_UNLINKAT_2_X
PPME_SYSCALL_MKDIRAT_X
PPME_SYSCALL_FCHMODAT_X
PPME_SYSCALL_FCHOWNAT_X

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-31 15:39:24 +02:00
Leonardo Di Giovanna 7c1aecf4c6 feat: make `PPME_SYSCALL_CLONE3_{E, X}` managed by scap-converter
Make `PPME_SYSCALL_CLONE3_E` and `PPME_SYSCALL_CLONE3_X` managed by
the scap converter and contextually fix some tests using clone3 and
clone events.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-31 12:08:23 +02:00
Leonardo Di Giovanna 39ab969475 feat: make `PPME_SYSCALL_VFORK_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_VFORK_E` and `PPME_SYSCALL_VFORK_X` events
managed by the scap-converter. Specifically, convert them to the
corresponding `PPME_SYSCALL_VFORK_17_{E, X}` event types; this allows
userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-31 12:08:23 +02:00
Leonardo Di Giovanna 870a8a7bc2 feat: make `PPME_SYSCALL_VFORK_17_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_VFORK_17_E` and `PPME_SYSCALL_VFORK_17_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_VFORK_20_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-31 12:08:23 +02:00
Leonardo Di Giovanna 8808497f1a feat: make `PPME_SYSCALL_VFORK_20_{E, X}` managed by scap-converter
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-31 12:08:23 +02:00
Leonardo Di Giovanna 2618d37a20 feat: make `PPME_SYSCALL_FORK_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_FORK_E` and `PPME_SYSCALL_FORK_X` events
managed by the scap-converter. Specifically, convert them to the
corresponding `PPME_SYSCALL_FORK_17_{E, X}` event types; this allows
userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 18:34:19 +02:00
Leonardo Di Giovanna 5e0981dc0d feat: make `PPME_SYSCALL_FORK_17_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_FORK_17_E` and `PPME_SYSCALL_FORK_17_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_FORK_20_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 18:34:19 +02:00
Leonardo Di Giovanna 8f3e222d16 feat: make `PPME_SYSCALL_FORK_20_{E, X}` managed by scap-converter
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 18:34:19 +02:00
Tero Kauppinen 52d638570a fix(userspace/libsinsp): remove state handling for PPM_SYSCALL_LINK
and PPM_SYSCALL_LINKAT

The new driver does not emit `PPM_SYSCALL_LINK` and
`PPM_SYSCALL_LINKAT` events anymore, and there is no longer need
to handle the old version of the events. This update removes the
state handling and adds conversion rules for the scap files.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-30 17:40:19 +02:00
Leonardo Di Giovanna 8ad30697ed feat: make `PPME_SYSCALL_CLONE_11_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_CLONE_11_E` and `PPME_SYSCALL_CLONE_11_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_CLONE_11_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 16:01:18 +02:00
Leonardo Di Giovanna fa62300265 feat: make `PPME_SYSCALL_CLONE_16_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_CLONE_16_E` and `PPME_SYSCALL_CLONE_16_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_CLONE_17_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 16:01:18 +02:00
Leonardo Di Giovanna 316fcb2a39 feat: make `PPME_SYSCALL_CLONE_17_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_CLONE_17_E` and `PPME_SYSCALL_CLONE_17_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_CLONE_20_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 16:01:18 +02:00
Leonardo Di Giovanna 6b56ab9ab7 feat: make `PPME_SYSCALL_CLONE_20_{E, X}` managed by scap-converter
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 16:01:18 +02:00
Tero Kauppinen a7ba9de555 fix(userspace/libsinsp): remove state handling for PPM_SYSCALL_UNLINK
and PPM_SYSCALL_UNLINKAT

The new driver does not emit `PPM_SYSCALL_UNLINK` and
`PPM_SYSCALL_UNLINKAT` events anymore, and there is no longer need
to handle the old version of the events. This update removes the
state handling and adds conversion rules for the scap files.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-30 14:03:18 +02:00
Leonardo Di Giovanna 1e35de4388 feat: make `PPME_SYSCALL_EXECVE_8_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_8_E` and `PPME_SYSCALL_EXECVE_8_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_13_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna 78acd68141 feat: make `PPME_SYSCALL_EXECVE_13_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_13_E` and `PPME_SYSCALL_EXECVE_13_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_14_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna 21e8b0c1c0 feat: make `PPME_SYSCALL_EXECVE_14_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_14_E` and `PPME_SYSCALL_EXECVE_14_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_15_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna c3d38df059 feat: make `PPME_SYSCALL_EXECVE_15_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_15_E` and `PPME_SYSCALL_EXECVE_15_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_16_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna ebe35459a3 feat: make `PPME_SYSCALL_EXECVE_16_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_16_E` and `PPME_SYSCALL_EXECVE_16_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_17_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna 9b991ad442 feat: make `PPME_SYSCALL_EXECVE_17_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_17_E` and `PPME_SYSCALL_EXECVE_17_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_18_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna 828935f0e5 feat: make `PPME_SYSCALL_EXECVE_18_{E, X}` managed by scap-converter
Make both `PPME_SYSCALL_EXECVE_18_E` and `PPME_SYSCALL_EXECVE_18_X`
events managed by the scap-converter. Specifically, convert them to
the corresponding `PPME_SYSCALL_EXECVE_19_{E, X}` event types; this
allows userspace code to get rid of special handling code for them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-30 10:42:56 +02:00
Leonardo Di Giovanna d021cbfd34 feat: make `PPME_SYSCALL_EXECVEAT_X` "scap converter"-managed
Let the scap converter managing all the possible variation of
`PPME_SYSCALL_EXECVEAT_X` event, adapting the userspace code to
handle possible empty values coming from the conversion.

The `PPME_SYSCALL_EXECVEAT_E` event is stil sent to sinsp, as its
parameters are still used as a fallback if the `trusted_exepath`
parameter is not present in the exit event.

Moreover, fixes some execveat tests.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-29 14:12:09 +02:00
Leonardo Di Giovanna b8a55f471e test(userspace/libsinsp): add scap conversion test for execve
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-29 14:12:09 +02:00
Leonardo Di Giovanna b4d1072d66 feat(userspace/libsinsp)!: defer sinsp evt params null-encoding logic
In the previous implementation, some specific parameter configurations
(empty or containing '(NULL)', with the type being equal to
`PT_CHARBUF`, `PT_FSPATH` or `PT_FSRELPATH`) were patched at loading
time with the following configuration:
- data: "<NA>"
- len: 5
This made empty parameters indistinguishable from non-empty
parameters.

The new implementation loads the parameters and keeps them untouched:
in this way, it is possible to inspect their original data and
lengths.

Since majority of the userspace space implementation still relies on
the aforementioned particular "null" encoding, a couple of new methods
(i.e. `sinsp_evt_param::used_legacy_null_encoding()` and
`sinsp_evt_param::data_and_len_with_legacy_null_encoding()`),
helping to check or simulate the old behaviour, are provided.
Moreover, parameter conversion methods (e.g.
`sinsp_evt_param::as<T>()`), still return the legacy encoded version.

BREAKING CHANGE: make parameter data and len private

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-29 10:10:09 +02:00
Leonardo Grasso 2a3b01dbb1 fix(userspace/libscap/engine/gvisor): handle read() < 0
Co-authored-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-07-28 10:26:05 +02:00
Leonardo Grasso 7d599304a5 fix(userspace/libsinsp): eliminate race condition in plugin async event handler cleanup
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-07-28 10:26:05 +02:00
Leonardo Grasso b902665cc3 fix(userspace/libscap/engine/gvisor): proper null termination in runsc output handling
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-07-28 10:26:05 +02:00
Leonardo Grasso a81dc05c16 fix(userspace/libsinsp): prevent path traversal in container memory usage reader
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-07-28 10:26:05 +02:00
Leonardo Di Giovanna 592217e71c fix(userspace/libsinsp): partially fix filterchecks for empty params
Introduce two fixes:
- turn "NULL" into "<NA>" upon string conversion for parameters that
  couldn't be empty before the introduction of the notion of "empty
  parameters" in the scap-converter
- fix implementation of `exists` operator for `evt.rawarg` by
flagging zero-length parameters as non-existing.

Moreover, introduce a bunch of unit tests for `evt.arg.*` and
`evt.rawarg.*`, and move some of the old one to new locations. Tests
are annotated in order to reflect the expectation of a future good
implementation.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-25 10:48:44 +02:00
Leonardo Di Giovanna 1f177d0599 fix(userspace/libscap): fix `SCAP_EMPTY_PARAMS_SET` def on Windows
Do not use GCC extension to define `SCAP_EMPTY_PARAMS_SET`. In this
way, it can be used in Windows.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-25 10:48:44 +02:00
Leonardo Di Giovanna 31673d110d fix(userspace/libscap): populate error in case of failing `stat` on fd
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-24 15:31:41 +02:00
Tero Kauppinen a04a40f95f fix(libscap): add missing fd locations for dup exit events
The function extracting `fd` parameter's location from the
exit event is missing information for the dup syscalls.

Add location of the `fd` parameter in the exit event for
all dup syscalls.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-24 11:11:40 +02:00
Leonardo Di Giovanna 5afd8eee0e fix: `evt.rawarg.*` raw val eval for pids, uids, gids and socktuples
Add support for `evt.rawarg.*` raw value evaluation for `PT_PID`,
`PT_UID`, `PT_GID` and `PT_SOCKTUPLE`.

Moreover, add support for numerical comparison for `PT_UID` and
`PT_GID`.

Finally, introduce some helpers letting generating execve and connect
events for testing purposes.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-23 16:01:36 +02:00
Francesco Emmi 7deb173ca5 fix(sinsp_suppress): Fix comm-based suppression to cascade to child processes after /proc scan
Addresses https://github.com/falcosecurity/libs/issues/2546
Ensures that `comm-based` suppression correctly applies not only to processes matching
the configured comm values, but also to their child processes—even when those processes
were already running at the time the library is initialized.
This is achieved by having scap notify sinsp when a `/proc` scan refresh begins and ends.
While the scan is in progress, sinsp builds a temporary `TID` tree to track parent-child relationships.
Once the scan completes, sinsp performs a post-processing step that traverses the tree and suppresses
all children of any process already marked as suppressed by comm.

Signed-off-by: Francesco Emmi <francesco.as@gmail.com>
2025-07-22 09:37:28 +02:00
Leonardo Di Giovanna 9f7c159c49 feat: add support for creating events with empty parameters
Add scap API to create/encode events with empty parameters, as this is
required to easily tests events whose type is managed by the scap
converter.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-21 15:32:29 +02:00
Tero Kauppinen 398f606986 fix(userspace/libsinsp): remove state handling for PPM_SYSCALL_RMDIR
The new driver does not emit `PPM_SYSCALL_RMDIR` events anymore, and
there is no longer need to handle the old version of the rmdir event.
This update removes the state handling and adds conversion rules for
the scap files.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-21 13:02:26 +02:00
Tero Kauppinen a8d69fc285 cleanup(libsinsp): removed unused PPME_SYSCALL_MKDIR_X statements
The current implementation does no longer emit PPME_SYSCALL_MKDIR_X
events and these events are also converted to PPME_SYSCALL_MKDIR_2_X
events for older scap files. Remove unused PPME_SYSCALL_MKDIR_X
statements from the codebase.

Added the CIF_FALLBACK_TO_EMPTY flag for parameters copied from
the enter event.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-21 13:02:26 +02:00
Tero Kauppinen c1cd8e2387 fix(testing): adjust gvisor testing for execve
https://github.com/falcosecurity/libs/pull/2544 implements conversion
of the exceve_x event which increases the number of parameters to 30.

Adjust the number of expected parameters from 27 to 30 for execve_x
events with the gvisor engine.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-21 10:13:31 +02:00
Leonardo Di Giovanna 17a7da6ceb feat: make `PPME_SYSCALL_EXECVE_19_X` "scap converter"-managed
Let the scap converter managing all the possible variation of
`PPME_SYSCALL_EXECVE_19_X` event, adapting the userspace code to
handle possible empty values coming from the conversion.

The `PPME_SYSCALL_EXECVE_19_E` event is stil sent to sinsp, as its
`filename` parameter value is still used as a fallback if the
`trusted_exepath` parameter is not present in the exit event.

Moreover, fixes some execve and execveat tests and align comments
to the new one-line style in the kernel drivers and tests.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-16 11:04:54 +02:00
Tero Kauppinen 878d24507b cleanup(libsinsp): retrieve parameters from the prlimit exit events
There is no need to store the prlimit entry event, because all
required parameters are available in the exit event.

Modify the prlimit exit event handler to retrieve information from
the exit event instead of the entry event. Added scap conversion
rules for the exit event with 5 parameters.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-16 10:36:53 +02:00
Tero Kauppinen 92703f2b42 feat(libscap): support for old PPME_SYSCALL_PTRACE_X events
Old PPME_SYSCALL_PTRACE_X events have zero parameters and they
need conversion support. Add support for converting events
with zero parameters to events with 3 parameters.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-15 14:28:47 +02:00
Leonardo Di Giovanna 605d8366b7 feat: fall back to empty gid instead of default one in scap converter
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-15 10:57:46 +02:00
Leonardo Di Giovanna d6bf8e983f feat: fall back to empty uid instead of default one in scap converter
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-15 10:57:46 +02:00
Leonardo Di Giovanna 109ef4fd73 feat(userspace/libscap): add scap converter "from empty" instruction
Add `C_INSTR_FROM_EMPTY` converter instruction code. This specify
to generate an empty parameter. In order to keep compatibility with
old scap files, an empty parameter has a parameter length set to 0
but it still have `len` bytes set to 0 as parameter value, where
`len` is determined from the parameter type.
E.g.: a `PT_UINT64` parameter will have the length set to 0 and its
value will occupy 8 bytes, all set to 0.

Contextually, introduce the notion of conversion flags and
particularly, the `CIF_FALLBACK_TO_EMPTY` flag: by default, if a
`C_INSTR_FROM_ENTER` instruction is encountered, and for some reason
the converter is not able to obtain a parameter from the enter event,
it pushes a default parameter; if `CIF_FALLBACK_TO_EMPTY` is
specified, it will fallback to an empty parameter.

This flag is a temporary solution to avoid handling empty parameters
in place of default ones in a single shot.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-15 10:57:46 +02:00
Leonardo Di Giovanna 7f6e58baaf ci: switch `debian:buster` apt debian repository URL to snapshot URL
As buster reached its EOL, the official debian repo URL doesn't
host anymore buster packages info. For this reason, change the URLs
to point to the `20250630T203427Z` snapshot, which still contains
them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-15 09:58:46 +02:00
Leonardo Di Giovanna 0394af7612 fix(userspace/libsinsp): fix recv data buffer index
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-11 18:21:24 +02:00
Leonardo Di Giovanna 45952bf4c7 fix: fix scap converter `PT_UID` parameters default value
Fix the scap converter `PT_UID` parameters default value by setting it
to `UINT32_MAX`. Moreover, fix scap converter tests and sinsp parser
code to correctly account for the default value.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-10 20:09:18 +02:00
Leonardo Di Giovanna e8d3b78fff fix(userspace/libsinsp): fix threadinfo ctor params forward decl
`sinsp_threadinfo_ctor_params` is declared as struct but
forward-declared as class. Fix forward declaration by declaring it
as struct.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-10 14:53:17 +02:00
Leonardo Di Giovanna c658df0835 refactor: clean scap converter tests
Constify wherever possible and remove redundant qualifiers.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-10 12:38:16 +02:00
Leonardo Di Giovanna 25159de410 feat: add `PPME_SYSCALL_CONNECT_E` params to `PPME_SYSCALL_CONNECT_X`
Add `PPME_SYSCALL_CONNECT_E` parameters to` PPME_SYSCALL_CONNECT_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update connect-related drivers, scap converter and sinsp parser
tests to account the new layout.

For the moment, do not touch userspace connect "enter event"-related
logic as it requires additional work to be done on driver's tuple
generation logic.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-10 12:08:17 +02:00
Angelo Puglisi a320519189 feat(userspace/libsinsp/example): print tables entries
Introduced an optional argument to -T, to output the tables entries in a
json format.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-07-09 19:16:10 +02:00
Angelo Puglisi 9494d6f0c5 feat(libsinsp/state): introduce table_input_adapter
Helper class to access subtables

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-07-09 19:16:10 +02:00
Angelo Puglisi 3797e18e31 feat(libsinsp/state): typeinfo::from
Introduce typeinfo::from convenience function, to create a typeinfo
object from ss_plugin_state_type

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-07-09 19:16:10 +02:00
Leonardo Di Giovanna 0f6ea5c6f2 fix(driver/bpf): fix `sched_process_exec_args` conditional definition
The current `sched_process_exec_args` raw tracepoint definition is
actually the tracepoint one; similarly, the current tracepoint
defintion is actually the raw tracepoint one. Swap them to give the
correct definition on each context.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-09 17:12:10 +02:00
Tero Kauppinen 94b471887f feat(libscap/libsinsp): fcntl scap conversion
This update adds scap event conversion for the fcntl syscall exit
events and it eliminates the need to store the entry event in
libsinsp.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-07-09 15:25:09 +02:00
Angelo Puglisi 4d572b21b9 chore(libsinsp): clean "detect container id" comments
Missed from https://github.com/falcosecurity/libs/pull/2207, the comment
makes no sense now. Drop it.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-07-09 14:06:08 +02:00
Super User 2a5b4c7347 fix(test/drivers): correctly handle accept socketcalls on s390x
Revise the socketcall test case for accept for modern BPF and
other drivers.

On s390x, there is no direct accept syscall and for modern BPF
accept4 is used instead.

The BPF and kernel drivers handle socketcalls internally and, thus,
can handle accept. There was only special handling for setting up
the event.  This commit also adds handling for the argument assertions.

Solving these test case failures:

````
Expected: (m_current_param) <= (m_event_header->nparams), actual: 6 vs 5
>>>>> The param id '6' is too big.

/root/git/libs/test/drivers/event_class/event_class.cpp:1457: Failure
Expected equality of these values:
  size
    Which is: 0
  expected_size
    Which is: 4
>>>>> length of the param is not correct. Param id = 6

[  FAILED  ] SyscallExit.socketcall_acceptX_INET
[  FAILED  ] SyscallExit.socketcall_acceptX_INET6
[  FAILED  ] SyscallExit.socketcall_acceptX_UNIX
[  FAILED  ] SyscallExit.socketcall_acceptX_failure
````

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
2025-07-08 15:50:01 +02:00
Super User 52ddeb4950 chore(test/libsinsp_e2e): add climits header file
Recent compilers complain about missing climits header file:

libs/test/libsinsp_e2e/sys_call_test.cpp: In lambda function:
/root/git/libs/test/libsinsp_e2e/sys_call_test.cpp:266:23: error: ‘INT_MAX’ was not declared in this scope
  266 |                 close(INT_MAX);
      |                       ^~~~~~~
libs/test/libsinsp_e2e/sys_call_test.cpp:266:23: note: ‘INT_MAX’ is defined in header ‘<climits>’; this is probably fixable by adding ‘#include <climits>’

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
2025-07-08 15:50:01 +02:00
Leonardo Di Giovanna 0752d7502a fix(drivers): align and improve `connect` kernel drivers fillers
The current bpf and kmod's `connect` fillers implementations extract
socket tuple information only if the socket file descriptor is greater
than or equal to zero: this does not ensure that the file descriptor
is valid and that the kernel has the correct amount of information
needed to build the socket tuple.

On the other side, the modern probe implementation correctly checks
the system call return value on the exit program, but doesn't try
hard enough to build the socket tuple, as it does not leverage the
sockaddr provided by the user.

Align all three implementations, checking the system call return value
and leveraging the user-provided sockaddr information to build the
socket tuple.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-04 14:11:42 +02:00
Angelo Puglisi e3cb9f6941 feat(userspace/libsinsp/example): add -T option to print available tables
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-07-04 13:52:42 +02:00
Leonardo Di Giovanna b917815e05 feat: add `PPME_SYSCALL_PWRITEV_E` params to `PPME_SYSCALL_PWRITEV_X`
Add `PPME_SYSCALL_PWRITEV_E` parameters to` PPME_SYSCALL_PWRITEV_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update pwritev-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-02 18:33:30 +02:00
Leonardo Di Giovanna e2751c656f feat!(userspace/libsinsp): remove unused sinsp ptr in tinfo factory
Remove unused sinsp pointer instance variable in
`sinsp_threadinfo_factory` component.

BREAKING CHANGE: update `sinsp_threadinfo_factory` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-02 17:45:30 +02:00
Leonardo Di Giovanna 70c6b3a557 test(e2e): increase `sinsp-example` init waiting interval
Recent additions increased `sinsp-example` instrumentation time in
such a way that now events can be produced by the testing framework
even before `sinsp-example` is initialized and receptive to them.
Increase `sinsp-example` initialization waiting interval to account
for this changes.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-07-02 17:20:30 +02:00
Leonardo Di Giovanna 0932ac00e6 fix(driver): cast rets and fds to 32 bits before sending them in dup*
Complete the work in 3385c69812 by
aligning the dup2's and dup3's fillers returned value handling to the
other file descriptors handling. Moreover, it also align the dup's
fillers file descriptors handling.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-01 12:15:21 +02:00
Leonardo Di Giovanna ed45c08a52 test(userspace/libsinsp/parsers): check fd info set by epoll_create{1}
Check that `epoll_create` and `epoll_create1` correctly set fd info
on the event and on the current thread's fd table.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-01 09:50:20 +02:00
Leonardo Di Giovanna 5a3dab1ff6 feat: add `PPME_SYSCALL_WRITEV_E` params to `PPME_SYSCALL_WRITEV_X`
Add `PPME_SYSCALL_WRITEV_E` parameters to `PPME_SYSCALL_WRITEV_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update writev-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-07-01 09:40:20 +02:00
Leonardo Di Giovanna 0860ad84f2 feat: add `PPME_SYSCALL_LSEEK_E` params to `PPME_SYSCALL_LSEEK_X`
Add `PPME_SYSCALL_LSEEK_E` parameters to `PPME_SYSCALL_LSEEK_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update lseek-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-30 17:51:18 +02:00
Gerald Combs 7ad639c989 fix(userspace/libsinsp/example): Allow processing scaps with plugins
Select the SOURCE_PLUGIN_ENGINE only if SAVEFILE_ENGINE hasn't been
previously selected. This lets us process .scap files with a plugin.

This makes the "-s" and "-p" command line flags sensitive to order, so
document that behavior.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-06-30 10:53:15 +02:00
Leonardo Di Giovanna 239b981406 feat: extend `PPME_SYSCALL_{P}READV_X` with enter parameters
Add `PPME_SYSCALL_{P}READV_E` parameters to `PPME_SYSCALL_{P}READV_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update {p}readv-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 17:28:01 +02:00
Leonardo Di Giovanna 690b08091f feat: extend `PPME_SYSCALL_COPY_FILE_RANGE_X` with enter parameters
Add `PPME_SYSCALL_COPY_FILE_RANGE_E` parameters to
`PPME_SYSCALL_COPY_FILE_RANGE_X` event definition and align all 3
kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update copy_file_range-related drivers, scap converter and sinsp
parser tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 16:12:01 +02:00
Leonardo Di Giovanna 8651bc4112 test(userpsace/libsinsp): add scap conversion test for `splice_x`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 15:11:00 +02:00
Angelo Puglisi 2b2d80fcca chore(threadinfo): protected ctor_params
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-27 15:04:00 +02:00
Federico Di Pierro 0014b60142 update(cmake): bumped container plugin to 0.3.1.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-27 14:37:00 +02:00
Leonardo Di Giovanna 254a757a09 feat: add `PPME_SYSCALL_SPLICE_E` params to `PPME_SYSCALL_SPLICE_X`
Add `PPME_SYSCALL_SPLICE_E` parameters to `PPME_SYSCALL_SPLICE_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update splice-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 14:35:00 +02:00
Leonardo Di Giovanna 269bf4fb1b feat: extend `PPME_SYSCALL_INOTIFY_INIT_X` with enter parameters
Add `PPME_SYSCALL_INOTIFY_INIT_E` parameters to
`PPME_SYSCALL_INOTIFY_INIT_X` event definition and align all 3 kernel
drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update inotify_init-related drivers, scap converter and sinsp
parser tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 13:26:59 +02:00
Leonardo Di Giovanna 04ca7f1813 feat: extend `PPME_SYSCALL_TIMERFD_CREATE_X` with enter parameters
Add `PPME_SYSCALL_TIMERFD_CREATE_E` parameters to
`PPME_SYSCALL_TIMERFD_CREATE_X` event definition and align all 3
kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update timerfd_create-related drivers, scap converter and sinsp
parser tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-27 12:05:59 +02:00
Leonardo Di Giovanna 51c8323149 feat: extend `PPME_SYSCALL_NANOSLEEP_X` with enter parameters
Add `PPME_SYSCALL_NANOSLEEP_E` parameters to
`PPME_SYSCALL_NANOSLEEP_X` event definition and align all 3 kernel
drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update nanosleep-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-26 18:13:56 +02:00
Leonardo Di Giovanna cbd6fcd693 feat: extend `PPME_SYSCALL_SIGNALFD_X` with enter parameters
Add `PPME_SYSCALL_SIGNALFD_E` parameters to `PPME_SYSCALL_SIGNALFD_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update signalfd-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-26 16:38:55 +02:00
Leonardo Di Giovanna c4ea330ea5 feat: extend `PPME_SOCKET_ACCEPT4_6_X` with enter parameters
Add `PPME_SOCKET_ACCEPT4_6_E` parameters to `PPME_SOCKET_ACCEPT4_6_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update accept4-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-26 13:02:53 +02:00
Leonardo Di Giovanna b80c4b2404 feat: extend `PPME_SYSCALL_{KILL,TKILL,TGKILL}_X` with enter params
Add `PPME_SYSCALL_{KILL,TKILL,TGKILL}_E` parameters to
`PPME_SYSCALL_{KILL,TKILL,TGKILL}_X` event definition and align all 3
kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update kill/tkill/tgkill-related drivers, scap converter and sinsp
parser tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-25 17:16:49 +02:00
Leonardo Di Giovanna 8d2e05bde9 feat: extend `PPME_SYSCALL_QUOTACTL_X` with enter parameters
Add `PPME_SYSCALL_QUOTACTL_E` parameters to `PPME_SYSCALL_QUOTACTL_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update quotactl-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-25 14:59:48 +02:00
Leonardo Di Giovanna 0487682879 feat: extend `PPME_SYSCALL_SENDFILE_X` with enter parameters
Add `PPME_SYSCALL_SENDFILE_E` parameters to `PPME_SYSCALL_SENDFILE_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update sendfile-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-25 12:05:48 +02:00
Angelo Puglisi dbdfd363fc feat(libsinsp): implement timed reset for proc lookup counters
- implement timed reset for proc lookup counters
- improve max process lookup log

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-25 09:54:48 +02:00
Leonardo Di Giovanna 4adc56d7f2 fix(driver): cast fds to 32 bits before sending them in dup2 and dup3
Align dup2 and dup3 fillers implementations to other fillers
implementation by casting syscalls' file descriptor parameters to
`int32_t` before sending them.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-25 09:31:48 +02:00
Angelo Puglisi e2edae006b update(event_processor)!: new build_threadinfo API
- Adapt build_threadinfo to the new sinsp_threadinfo constructor
- Have sinsp_threadinfo_ctor_params to allow forward declaration and
  avoid cyclic dependency

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-24 18:36:48 +02:00
Leonardo Di Giovanna db53313bb9 feat: extend `PPME_SYSCALL_SIGNALFD4_X` with enter parameters
Add `PPME_SYSCALL_SIGNALFD4_E` parameters to
`PPME_SYSCALL_SIGNALFD4_X` event definition and align all 3 kernel
drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update signalfd4-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-24 17:41:48 +02:00
Leonardo Di Giovanna cc481dc0d7 feat: extend `PPME_SYSCALL_EVENTFD2_X` with enter parameters
Add `PPME_SYSCALL_EVENTFD2_E` parameters to `PPME_SYSCALL_EVENTFD2_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update eventfd2-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-24 16:26:49 +02:00
Leonardo Di Giovanna a008f7d254 feat: add `PPME_SYSCALL_UMOUNT2_E` params to `PPME_SYSCALL_UMOUNT2_X`
Add `PPME_SYSCALL_UMOUNT2_E` parameters to `PPME_SYSCALL_UMOUNT2_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update umount2-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-24 15:14:47 +02:00
Leonardo Di Giovanna 0e0b27948f feat: extend `PPME_SYSCALL_EPOLL_CREATE{1}_X` with enter parameters
Add `PPME_SYSCALL_EPOLL_CREATE{1}_E` parameters to
`PPME_SYSCALL_EPOLL_CREATE{1}_X` event definitions and align all 3
kernel drivers to them.

Add new rules to scap file converter table to convert events in old
scap files to the new layouts.

Add/update epoll_create{1}-related drivers, scap converter and sinsp
parser tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-24 13:55:47 +02:00
Leonardo Di Giovanna d5936857e8 feat: extend `PPME_SYSCALL_MPROTECT_X` with enter parameters
Add `PPME_SYSCALL_MPROTECT_E` parameters to `PPME_SYSCALL_MPROTECT_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update mprotect-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-23 20:31:40 +02:00
Leonardo Di Giovanna dfa5b70ca7 feat: add `PPME_SYSCALL_SECCOMP_E` params to `PPME_SYSCALL_SECCOMP_X`
Add `PPME_SYSCALL_SECCOMP_E` parameters to `PPME_SYSCALL_SECCOMP_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update seccomp-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-23 17:34:39 +02:00
Leonardo Di Giovanna 88b685acf9 feat: add `PPME_SYSCALL_UNSHARE_E` params to `PPME_SYSCALL_UNSHARE_X`
Add `PPME_SYSCALL_UNSHARE_E` parameters to `PPME_SYSCALL_UNSHARE_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update unshare-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-23 15:31:38 +02:00
Leonardo Di Giovanna d8d7486f96 feat: add `PPME_SYSCALL_ACCESS_E` params to `PPME_SYSCALL_ACCESS_X`
Add `PPME_SYSCALL_ACCESS_E` parameters to `PPME_SYSCALL_ACCESS_X`
event definition and align all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update access-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-23 12:34:36 +02:00
Leonardo Di Giovanna 448b5cd915 feat: add `PPME_SYSCALL_MOUNT_E` params to `PPME_SYSCALL_MOUNT_X`
Add `PPME_SYSCALL_MOUNT_E` parameters to `PPME_SYSCALL_MOUNT_X` event
definition and aligns all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update mount-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-23 11:08:35 +02:00
Leonardo Di Giovanna e81b13ab9a feat: add `PPME_SYSCALL_PPOLL_E` params to `PPME_SYSCALL_PPOLL_X`
Add `PPME_SYSCALL_PPOLL_E` parameters to `PPME_SYSCALL_PPOLL_X` event
definition and aligns all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update ppoll-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-20 18:16:21 +02:00
Leonardo Di Giovanna 5f249d1bf8 feat: extend `SEMCTL_X` and `SEMGET_X` with enter parameters
Add `PPME_SYSCALL_SEMCTL_E`/`PPME_SYSCALL_SEMGET_E` parameters to
`PPME_SYSCALL_SEMCTL_X`/`PPME_SYSCALL_SEMGET_X` event definitions and
aligns all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update semctl/semget-related drivers, scap converter and sinsp
parser tests to account for the new layouts.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-20 13:22:17 +02:00
Leonardo Di Giovanna 2f1bd46b6f feat: add `PPME_SYSCALL_SEMOP_E` params to `PPME_SYSCALL_SEMOP_X`
Add `PPME_SYSCALL_SEMOP_E` parameters to `PPME_SYSCALL_SEMOP_X` event
definition and aligns all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update semop-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-20 11:12:17 +02:00
Leonardo Di Giovanna da77c772d6 feat: add `PPME_SYSCALL_FLOCK_E` params to `PPME_SYSCALL_FLOCK_X`
Add `PPME_SYSCALL_FLOCK_E` parameters to `PPME_SYSCALL_FLOCK_X` event
definition and aligns all 3 kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update flock-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-20 07:09:16 +02:00
Leonardo Di Giovanna 2c182825d0 feat: extend `PPME_SYSCALL_GETDENTS{64}_X` defs with enter params
Add `PPME_SYSCALL_GETDENTS{64}_E` parameters to
`PPME_SYSCALL_GETDENTS{64}_X` event definitions and aligns all 3
kernel drivers to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update getdents{64}-related drivers, scap converter and sinsp
parser tests to account for the new layouts.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-19 16:48:12 +02:00
Leonardo Di Giovanna baec689e4a feat: add `PPME_SYSCALL_MUNMAP_E` params to `PPME_SYSCALL_MUNMAP_X`
Add `PPME_SYSCALL_MUNMAP_E` parameters to `PPME_SYSCALL_MUNMAP_X`
event definition and aligns all 3 kernel drivers and gvisor engine
to it.

Add new rules to scap file converter table to convert events in old
scap files to the new layout.

Add/update munmap-related drivers, scap converter and sinsp parser
tests to account the new layout.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-19 15:37:12 +02:00
dependabot[bot] ebd2b8ab07 chore(deps): Bump dawidd6/action-download-artifact from 10 to 11
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 10 to 11.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](4c1e823582...ac66b43f0e)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '11'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-19 11:43:10 +02:00
Leonardo Di Giovanna 316ffbee77 feat: add `PPME_SYSCALL_MMAP2_E` params to `PPME_SYSCALL_MMAP2_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-18 17:58:05 +02:00
Tero Kauppinen 3c0a93c9d8 fix(driver): fix offset for the effective id
When setre*id args where moved to exit event with commit

d7d1e7c861

the offset for the effective id was not updated to
point to the correct value. Instead it was pointing to
the offset where the real id is stored.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-18 13:01:05 +02:00
Tero Kauppinen dd6d0d23f4 new(driver): update exit events PPME_SYSCALL_SETRESUID_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setresuid syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-18 13:01:05 +02:00
Tero Kauppinen b788826fbe fix(driver): PT_UID is of type uint32_t
Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-18 13:01:05 +02:00
dependabot[bot] f122ea93e8 chore(deps): Bump softprops/action-gh-release in the actions group
Bumps the actions group with 1 update: [softprops/action-gh-release](https://github.com/softprops/action-gh-release).


Updates `softprops/action-gh-release` from 2.2.2 to 2.3.2
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](da05d55257...72f2c25fcb)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-18 11:54:05 +02:00
Tero Kauppinen 5830040d66 new(driver): update exit events PPME_SYSCALL_SETRESGID_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setresgid syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-18 10:26:05 +02:00
Tero Kauppinen 0220333af2 test(userspace/libsinsp/parsers): add setgid parsing test
Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-18 10:26:05 +02:00
Leonardo Di Giovanna 71b46c15bf feat: add `PPME_SYSCALL_MMAP_E` params to `PPME_SYSCALL_MMAP_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-17 18:33:45 +02:00
Leonardo Di Giovanna 0fb9d35685 fix(driver/bpf): fix `socket_x` and `socketpair_x` domain encoding
Partially revert changes introduced in
dfdd45cc2c by replacing the usage
of `socket_family_to_scap` helper with a calls to a new ad-hoc helper
for the legacy bpf probe. To avoid breaking the verifier on old kernel
version, just convert user-provided negative socket family values to
`PPM_AF_UNSPEC` and leave positive values as are. This simplified
version relies on the fact that `AF_*` and corresponding `PPM_AF_*`
macros map to the same values.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-17 14:38:43 +02:00
Leonardo Di Giovanna da0f8f034b feat!: add `PPME_SYSCALL_CLOSE_E` fd param to `PPME_SYSCALL_CLOSE_X`
Extend `PPME_SYSCALL_CLOSE_X` event by adding the fd parameter to its
definition. Keep the sinsp parser logic associating the fdinfo to the
`close` enter event, but don't apply anymore any additional logic
for it: in other words, remove any code associated to the notion of
"close in progress" or "close canceled" as they have no meaning
anymore.

BREAKING CHANGE: remove `FLAGS_CLOSE_IN_PROGRESS` and
  `FLAGS_CLOSE_CANCELED` `sinsp_fdinfo::flags`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-17 13:20:43 +02:00
Tero Kauppinen 8aad951bcf fix(userspace/libsinsp): remove state handling for `PPM_SYSCALL_MKDIR`
The new driver does not emit `PPM_SYSCALL_MKDIR` events anymore, and
there is no longer need to handle the old version of the mkdir event.
This update removes the state handling and adds conversion rules for
the scap files.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-16 16:37:37 +02:00
Leonardo Di Giovanna e50c511abf update(cmake/modules): bump container plugin to 0.3.0
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-16 15:13:37 +02:00
Leonardo Di Giovanna 883c697208 feat: add `GETRLIMIT_E` params to `GETRLIMIT_X` and align setrlimit_x
Add `PPM_SYSCALL_GETRLIMIT_E` params to `PPM_SYSCALL_GETRLIMIT_X`
event definition and align all 3 kernel drivers to the it. Moreover,
align setrlimit_x parsing logic to getrlimit_x logic by unify the
implementation and avoiding storing setrlimit_e: this requires
adding ad-hoc conversion rules for old versions of setrlimit events
coming from old scap files.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-13 14:06:17 +02:00
Federico Di Pierro 2ed1539808 fix(userspace/libsinsp): avoid clearing host users and groups tables every minute.
Since we now do not store users and groups full info inside each threadinfo,
we would lose users and groups info for host processes after 1 minute.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-12 14:09:11 +02:00
Leonardo Di Giovanna c0771abecc feat: add `PPME_SYSCALL_BRK_4_E` params to `PPME_SYSCALL_BRK_4_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-12 11:45:12 +02:00
Leonardo Di Giovanna f9812eb71a fix(test/drivers): fix multiple driver tests
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-11 16:51:06 +02:00
Leonardo Di Giovanna dfdd45cc2c fix(driver): convert domain before sending it in socket and socketpair
Fix `domain` parameter exported value by converting it to its
corresponding scap representation in both legacy bpf and kernel
probes.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-11 16:51:06 +02:00
Leonardo Di Giovanna a55e1a89e4 refactor: remove redundant zero init in aggregate initialization
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-11 16:51:06 +02:00
Leonardo Di Giovanna 2b78f3a3a0 ci: remove old libs clones and disable bundled libelf on ppc64 tests
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-11 16:51:06 +02:00
Leonardo Grasso aacbdd3dca update(cmake/modules): bump container plugin to 0.2.6
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-06-11 12:19:05 +02:00
Tero Kauppinen ec4efa02f7 new(driver): update exit events PPME_SYSCALL_SETGID_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setgid syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-11 10:58:05 +02:00
Leonardo Di Giovanna e416bbd7bc feat: add `PPME_SYSCALL_FSTAT_E` params to `PPME_SYSCALL_FSTAT_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-10 18:01:01 +02:00
Leonardo Di Giovanna 42182ffe0d feat: add `PPME_SYSCALL_IOCTL_3_E` params to `PPME_SYSCALL_IOCTL_3_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-10 14:19:01 +02:00
Tero Kauppinen cc1d7fa7d4 fix(driver): remove the EF_MODIFIES_STATE flag from setpgid
Event parsing for setpgid has previously been removed with
567c2e23cc.
However, the EF_MODIFIES_STATE flag was still left in the
event definitions.

This update will remove the flag as suggested here:
https://github.com/falcosecurity/libs/issues/2427#issuecomment-2954895278

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-10 13:57:00 +02:00
dependabot[bot] 2a838b7b72 chore(deps): Bump requests from 2.32.2 to 2.32.4 in /test/e2e/tests
Bumps [requests](https://github.com/psf/requests) from 2.32.2 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.2...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-10 11:46:00 +02:00
Leonardo Di Giovanna cdcc76090f test(userspace/libsinsp/parsers): add poll parsing test
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-10 11:38:00 +02:00
Leonardo Di Giovanna eedad225ef feat: add `PPME_SYSCALL_LLSEEK_E` params to `PPME_SYSCALL_LLSEEK_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-10 11:38:00 +02:00
Leonardo Di Giovanna fb382debc7 fix(test/drivers): ignore `SO_REUSEPORT` setsockopt syscall error
Commit https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=5b0af621c3f6
restricts `SO_REUSEPORT` socket option to inet sockets: this means
that calls to `setsockopt` setting `SO_REUSEPORT` on unix sockets are
not permitted anymore and will fail on any version backporting the
change. For this reason, still perform the call (to account for socket
belonging to inet families) but ignore its return value and hope any
subsequent call to bind is going to succeed.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-10 10:28:00 +02:00
Tero Kauppinen b32c29c62c new(driver): update exit events PPME_SYSCALL_SETPGID_X with enter params
This update is part of the implementation for disabling support for
    syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setpgid syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-10 10:10:59 +02:00
Angelo Puglisi 298d53de5c chore: rename sinsp_evt::init overload with data param
Improve readability by renaming `init(uint8_t* evdata, uint16_t cpuid)`
to `init_from_raw`

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-10 09:34:00 +02:00
Angelo Puglisi f4a919b6d1 cleanup: drop unused sinsp_evt::init overloads
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-10 09:34:00 +02:00
Angelo Puglisi 5ab41edb19 cleanup: drop sinsp_evt::init_keep_threadinfo
After commit 3f3e3fb23 we're not directly using `init_keep_threadinfo()`
anymore, so let's merge it with `init()`.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-06-10 09:34:00 +02:00
Tero Kauppinen 2d9505cda2 new(driver): update exit events PPME_SYSCALL_FCHDIR_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the fchdir syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-09 17:08:56 +02:00
Melissa Kilby 768c2de0d2 doc(OWNERS): move incertum (Melissa Kilby) to emeritus_approvers
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-06-09 12:18:54 +02:00
Iacopo Rozzo 212d997c09 chore(libsinsp): avoid repeating getservbyname
Avoid repeating `getservbyname` call in `sinsp_filter_value_parser::string_to_rawval`.

Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-06-06 17:24:39 +02:00
Leonardo Di Giovanna 52fb26ae50 feat: add `PPME_SYSCALL_POLL_E` params to `PPME_SYSCALL_POLL_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-06 14:12:38 +02:00
Tero Kauppinen 8a445f5c96 new(driver): update exit events PPME_SYSCALL_SETNS_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setns syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-06 13:02:38 +02:00
Leonardo Di Giovanna 067f3d46fe feat: add `EPOLLWAIT_E` params to `EPOLLWAIT_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-05 17:29:31 +02:00
Federico Di Pierro 65c6326eb5 update(cmake): update tbb to v2022.1.0.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-05 12:52:30 +02:00
Leonardo Di Giovanna 09fc7484d3 feat: add `PPME_SYSCALL_FUTEX_E` params to `PPME_SYSCALL_FUTEX_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-05 12:38:30 +02:00
Federico Di Pierro 8662400108 fix(userspace/libsinsp): properly return after failed assert.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-05 11:37:30 +02:00
Leonardo Di Giovanna 39b018fc33 feat: add `PPME_SYSCALL_EVENTFD_E` params to `PPME_SYSCALL_EVENTFD_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-04 17:33:25 +02:00
Leonardo Di Giovanna 97d0cedec5 test(userspace/libsinsp/scap_files): add `assert_num_event_types()`
Replace helper to verify the presence of the exact number of events
of specific types inside a single scap file. Differently from the
old `assert_num_event_type()`, this helper is able to perform the
check on multiple event types at the same type: this helps
consolidating all the tests checking the number of events in all scap
file under a single test.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-04 16:38:58 +02:00
Tero Kauppinen edc27e75ac new(driver): update exit events PPME_SYSCALL_MKDIR_2_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the mkdir syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-04 16:13:24 +02:00
Leonardo Di Giovanna 364f451c08 doc(OWNERS): add `ekoops` to approvers
Signed-off-by: Leonardo Di Giovanna <41296180+ekoops@users.noreply.github.com>
2025-06-04 12:27:23 +02:00
Andrea Terzolo 84779b662d ci: update bpfvalidator action
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-06-03 22:38:18 +02:00
Leonardo Di Giovanna 8b9fb7aa0d refactor(userspace/libsinsp/parsers): clean chdir handling logic
Remove unneded `CHDIR_E` event handling and clean `CHDIR_X` handling
code.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-03 18:22:15 +02:00
Leonardo Di Giovanna a2eff855f6 feat: add `PPME_SOCKET_RECVMSG_E` params to `PPME_SOCKET_RECVMSG_X`
Add enter events parameters to `PPME_SOCKET_RECVMSG_X` and align all
three kernel drivers to the new definition. Contextually, align tuple
parameter extraction in all three drivers, and remove exceptions
in recvmsg driver tests accounting for the removed differences.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-03 17:31:14 +02:00
Leonardo Di Giovanna 7a0eb59e9f feat: add `PPME_SOCKET_SENDMSG_E` params to `PPME_SOCKET_SENDMSG_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-06-03 12:40:12 +02:00
Tero Kauppinen a7f8091378 new(driver): update exit events PPME_SYSCALL_PTRACE_X with enter params
This update is part of the implementation for disabling support for
syscall enter events. It implements the following steps:

1. Adds enter parameters to the exit event
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the ptrace syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-06-03 09:56:11 +02:00
Federico Di Pierro deaf325786 chore(userspace/libsinsp): use a normal `map` instead of unoredered one.
This allows Falco outputs to be appended alphabetically sorted.
Also, should fix the build of Falco with old yaml-cpp versions.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-03 09:55:11 +02:00
Federico Di Pierro 2c12c631e7 chore(userspace/libsinsp): automatically prepend `static.` to static filters names.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-03 09:55:11 +02:00
Federico Di Pierro df2f1b48b1 new(userspace/libsinsp): add a `sinsp_filtercheck_static` class.
It allows people to set "static" filterchecks; for now, it only supports string ones.
The API is very simple since the filterchecks are initialized from an unordered_map<string,string>.

Added also a bunch of tests.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-03 09:55:11 +02:00
Federico Di Pierro 9c64fa99e9 chore(userspace/libsinsp): add small test.
Also, document m_event_info behavior.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-03 09:54:11 +02:00
Federico Di Pierro 4cd3f9678c cleanup(userspace/libsinsp): enable `names_to_event_set` to match async event names.
Libsinsp will now take a copy (not a reference) of scap event table,
and each plugin loaded with ASYNC cap will append its async_event_names
to the table, that will grow larger than PPM_EVENT_MAX, up to 1024 elements.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-06-03 09:54:11 +02:00
dependabot[bot] c810d471eb chore(deps): Bump dawidd6/action-download-artifact from 9 to 10
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 9 to 10.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](07ab29fd4a...4c1e823582)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-03 09:53:11 +02:00
Grzegorz Nosek a4057823f5 fix(plugin): fix and clarify extract offsets docs/tests
The docs (and a unit test) specified `value_offsets` to be an array
of `ss_plugin_extract_value_offsets` structs, while the code in
plugin_filtercheck.cpp expected it to be a struct of arrays.
Things worked out only because we never extract multiple fields
in one go (at least in libsinsp itself).

Keep the plugin_filtercheck.cpp behavior and adapt the documentation
and tests to match.

Additionally, clarify that the offsets are counted from the start
of the event buffer (including the header).

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-05-30 19:02:38 +02:00
Federico Di Pierro 3540a0a923 update(ci): update zig to 0.14.1.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-30 19:01:39 +02:00
Melissa Kilby 414c9d9156 chore(README): refine build and testing sections
* Remove references to the localhost `test/vm` framework
* Remove overly detailed build guidelines for containers
* Ensure more precise and accurate terminology

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-05-30 16:41:38 +02:00
Melissa Kilby aa17d2472b chore(test/vm): remove localhost `test/vm` framework
* No longer maintained: This framework will not receive updates or support in the future.
* Past usefulness: It was valuable for detecting regressions in legacy drivers but has now outlived its practical use.
* Compatibility issues: It was incompatible with the Firecracker framework. VirtualBox caused interference when trying to integrate it into the CI workflow on the same test server where kernel driver tests using Firecracker were conducted.

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-05-30 16:41:38 +02:00
Leonardo Di Giovanna 1510ba4b60 fix(userspace/libscap/savefile) revert enter event freeing logic
Commit 72a6d4f39a changed the logic
governing when enter events are freed. Specifically, enter events
were freed after having performed a conversion (not a skipped
conversion) involving an exit event. With this configuration, the
following conversion would not work:

```c++
{conversion_key{EXAMPLE_E, 1},
  conversion_info().action(C_ACTION_STORE)},
{conversion_key{EXAMPLE_X, 4},
  conversion_info().action(C_ACTION_ADD_PARAMS)
    .instrs({{C_INSTR_FROM_DEFAULT, 0}})},
{conversion_key{EXAMPLE_X, 5},
  conversion_info().action(C_ACTION_ADD_PARAMS)
    .instrs({{C_INSTR_FROM_ENTER, 0}})}
```

The reason why it would not work, is that the converter would
free the stored enter event upon execution of the second conversion,
and would not find it upon execution of the third one.

Revert only the logic applied to free the enter event, which means
freeing it only if it is used by a `C_INSTR_FROM_ENTER` instruction.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-30 16:34:37 +02:00
Andrea Terzolo 9c49cfa4fb ci: introduce bpfvalidator for modern bpf probe
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-05-30 08:19:34 +02:00
Leonardo Di Giovanna 70cf2f5e58 feat(userpace/libscap): add printing support for `PT_DYN` parameters
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-30 06:54:33 +02:00
Leonardo Di Giovanna 841f0ff10e test(drivers/test_suites/syscall): add coverage for fd parameters
Add test coverage for file descriptor parameters and some spurious
ones of other kind.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-29 14:37:26 +02:00
Leonardo Di Giovanna d39cae2a9e feat: add `SOCKETPAIR_E` params to `SOCKETPAIR_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-29 14:00:26 +02:00
Leonardo Di Giovanna 3eef3f356e chore: add `/kind test` to PR template
Signed-off-by: Leonardo Di Giovanna <41296180+ekoops@users.noreply.github.com>
2025-05-27 17:55:12 +02:00
Leonardo Di Giovanna 186e522d2c feat: add `PPME_SOCKET_SHUTDOWN_E` params to `PPME_SOCKET_SHUTDOWN_X`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-27 15:19:11 +02:00
Leonardo Di Giovanna 6b246b3c7d fix(drivers/modern_bpf): fix socket fd conversion error
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-27 12:18:11 +02:00
Leonardo Di Giovanna d259f54eec feat: add `RECVFROM_E` params to `RECVFROM_X`
Add enter events parameters to `RECVFROM_X` event definition and
align all three kernel drivers to the new definition.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-27 11:30:10 +02:00
Leonardo Di Giovanna 4cde7d2104 test(sinsp/scap_files): add accept events conversion tests
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-27 09:34:11 +02:00
Leonardo Di Giovanna 6c7ef209a0 new: extend `SEND_X` and `SENDTO_X` with enter events parameters
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-26 14:14:05 +02:00
Leonardo Di Giovanna 7e1d4679d5 fix(userspace/libscap): avoid field access to possibly NULL struct
`event` can be NULL and code must not access it without guarding the
access. Fix it by avoiding the access to the event field and using
instead the `event_type` function parameter.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-26 13:46:04 +02:00
Leonardo Di Giovanna 35c0655bdf feat: add `RECV_E` and `tuple` params and to `RECV_X`
Add enter events parameters to `RECV_X` event definition and align
all three kernel drivers to the new definition. Moreover, add the
`tuple` parameter to it, and align userspace logic to leverage its
presence. Finally, add the capability to leverage the content
extracted from the syscall data buffer in userspace.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-26 12:46:05 +02:00
Luca Guerra 511597356f chore(build): update container plugin version
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-05-26 11:19:27 +02:00
Leonardo Di Giovanna 0485889370 fix(userspace/libscap): account unaligned access while printing params
Take into account possible misaligned accesses while printing scap
event parameters to standard output by first copying misaligned bytes
using memcpy. Contextually, factorize multiple switch case, sharing
the same handling code.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-26 09:54:05 +02:00
Leonardo Di Giovanna 1e844317dd feat(userspace/libsinsp/example): add `-c` and `-A` options in example
Add two new CLI options for the modern eBPF probe in `sinsp-example`:
- `-c <num>, --cpus-for-each-buffer <num>` - allowing to select the
  number of CPUs for each ring buffer
- `-A, --all-cpus` - allowing to allocate ring buffers for all
  available CPUs (not only online ones)

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-22 16:39:41 +02:00
Leonardo Di Giovanna cd8f3f4dde refactor(userspace/libsinsp/examples): replace `NULL` with `nullptr`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-22 16:39:41 +02:00
Tero Kauppinen d1f550a596 new(driver): update exit events PPME_SYSCALL_SETUID_X with enter params
This update is part of the proposal for disabling support for
syscall enter events. It implements the following steps:

1. Add enter parameters to the exit event.
2. Adapt sinsp state to work just with exit events.
3. Create a scap-file conversion (in a dedicated scap-file converter)
   to convert ENTER events into merged EXIT ones.
4. Add some tests replaying scap-files.

for the setuid syscall.

Signed-off-by: Tero Kauppinen <tero.kauppinen@est.tech>
2025-05-21 12:41:34 +02:00
Leonardo Di Giovanna 41f053ce22 feat(userspace/libsinsp)!: remove `sinsp::get_thread_ref()`
As the end goal is to remove unneeded duties from `sinsp`, remove
`sinsp::get_thread_ref()` API and let users directly call the
corresponding thread manager API.

BREAKING CHANGE: remove `sinsp::get_thread_ref()`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-20 09:26:27 +02:00
Leonardo Di Giovanna 8a202df952 feat(userspace/libsinsp)!: make some `sinsp_parser` methods const
BREAKING CHANGE: make some `sinsp_parser` methods const

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-20 09:25:27 +02:00
Leonardo Di Giovanna b0abcb8097 feat(userspace/libsinsp)!: make `sinsp_parser::reset()` const
Make `sinsp_parser::reset()` const by removing the logic for
obtaining the syscall event source index and providing it directly
from sinsp.

BREAKING CHANGE: make `sinsp_parser::reset()` const

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-20 09:25:27 +02:00
dependabot[bot] 71e8386925 chore(deps): Bump codecov/codecov-action in the actions group
Bumps the actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `codecov/codecov-action` from 5.4.2 to 5.4.3
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](ad3126e916...18283e04ce)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-20 05:49:26 +02:00
Leonardo Di Giovanna 344adc24e0 refactor(libsinsp): use early return in `handle_plugin_async_event()`
Apply early return and idiom in `sinsp::handle_plugin_async_event()`
and contextually reformat comments.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-19 15:24:02 +02:00
Federico Di Pierro 5a1faed158 update(cmake): bump container plugin to 0.2.3.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-19 10:46:00 +02:00
Luca Guerra 9c2734a643 cleanup(modern_bpf): address review comments
Signed-off-by: Luca Guerra <luca@guerra.sh>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-05-13 09:58:28 +02:00
Luca Guerra cf1c8ee89d cleanup(modern_bpf): use a regular map for shared ebpf settings
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-05-13 09:58:28 +02:00
Luca Guerra 4c2cde893b cleanup(modern_bpf): use a separate map for 64bit interesting syscalls table
Signed-off-by: Luca Guerra <luca@guerra.sh>
Co-authored-by: Kondah Mouad <kondah.mouad@gmail.com>
2025-05-13 09:58:28 +02:00
Federico Di Pierro 1983c6371f fix(driver/modern_bpf,userspace/libpman): move `g_64bit_sampling_syscall_table` and `g_ia32_to_64_table` to rodata.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Luca Guerra <luca@guerra.sh>
2025-05-13 09:58:28 +02:00
Federico Di Pierro 6c5659b814 fix(userspace/libscap): avoid a possible read past end of buffer.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-10 12:59:09 +02:00
Federico Di Pierro b1b10eff78 chore(driver/modern_bpf): limit `bpf_loop` helper to 16 iterations.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-09 10:11:01 +02:00
Melissa Kilby c0b1aeabc5 new(libsinsp): introduce proc.aargs field
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-05-08 12:58:55 +02:00
Leonardo Di Giovanna 729ead2a3e feat(userspace/libsinsp)!: drop `syslog` support
BREAKING CHANGE: drop `syslog` support,
`sinsp_parser::get_syslog_decoder()`, `sinsp_filter_check_syslog`
component and `sinsp_syslog_decoder` component

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-07 18:27:50 +02:00
Federico Di Pierro 8d44eca410 fix(test/e2e): rewrite `assert_events` to avoid ending too soon sinsp-example log matching.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-07 10:59:49 +02:00
Federico Di Pierro 5afe6d2ccc update(cmake): bumped container plugin to 0.2.2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-07 10:58:49 +02:00
Leonardo Di Giovanna ff50d63fd0 refactor(userspace/libsinsp): improve code locality and style
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 17:50:45 +02:00
Leonardo Di Giovanna d1253e2215 refactor(userspace/libsinsp): use early-return pattern in parser reset
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 17:50:45 +02:00
Leonardo Di Giovanna 5cfd2f1940 docs(userspace/libsinsp): clean `sinsp_parser::reset()` comments
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 17:50:45 +02:00
Leonardo Di Giovanna aa7e6917a7 fix(userspace/libsinsp): account `PPME_SCHEDSWITCH_1_E` event
Account `PPME_SCHEDSWITCH_1_E` events as "schedswitch" event.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 17:50:45 +02:00
Leonardo Di Giovanna a77b862607 refactor(userspace/libsinsp): add evt classification helpers
Add event classification helpers and use them in
`sinsp_parser::reset()`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 17:50:45 +02:00
Leonardo Di Giovanna bca865fe23 feat(userspace/libsinsp)!: constify `set_track_connection_status()`
BREAKING CHANGE: make `sinsp::set_track_connection_status()` const

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:03:45 +02:00
Leonardo Di Giovanna 573745549c feat(userspace/libsinsp)!: avoid arg copy in `sinsp::set_thread_pool`
BREAKING CHANGE: update `sinsp::set_thread_pool()` signature

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:03:45 +02:00
Leonardo Di Giovanna 2526292a64 refactor(userspace/libsinsp): make `is_initialstate_event()` static
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:03:45 +02:00
Leonardo Di Giovanna 5d4a8fb66c refactor(userspace/libsinsp): replace `NULL` with `nullptr` in `sinsp`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:03:45 +02:00
Leonardo Di Giovanna 163078298a feat(userspace/libsinsp)!: remove `sinsp::remove_thread()`
As the end goal is to remove unneeded duties from `sinsp`, remove
`sinsp::remove_thread()` API and let users directly call the
corresponding thread manager API.

BREAKING CHANGE: remove `sinsp::remove_thread()`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:02:47 +02:00
Leonardo Di Giovanna f1cc5d909f feat(userspace/libsinsp)!: remove `sinsp::add_thread()`
As the end goal is to remove unneeded duties from `sinsp`, remove
`sinsp::add_thread()` API and let users directly call the
corresponding thread manager API.

BREAKING CHANGE: remove `sinsp::add_thread()`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:02:47 +02:00
Leonardo Di Giovanna 25158ff77b feat(userspace/libsinsp)!: remove unused `sinsp_dumper::m_inspector`
BREAKING CHANGE: remove `sinsp_dumper::set_inspector` API

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-06 16:01:49 +02:00
Federico Di Pierro 9ffd335279 chore(ci): add libsrepo and libsversion inputs to reusable_e2e_tests workflow.
Also, drop concurrency key.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 15:04:45 +02:00
Federico Di Pierro 9546b09cb6 fix(ci): download custom container plugin from workflow.
Since we cannot have multi-steps action when invoking a reusable workflow.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 15:04:45 +02:00
Federico Di Pierro 59a68aa85e fix(test/e2e): properly flush remaining queue once sinsp process leaves.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 14:19:44 +02:00
Federico Di Pierro 928c973a2e fix(userspace/libpman): fix modern bpf engine hot-reload.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 13:34:44 +02:00
Federico Di Pierro b1b30d3215 chore(ci): add new optional input params to the reusable workflow.
They allow to disable test for podman or docker.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Federico Di Pierro ad018b7caa cleanup(ci): drop intercept_tls_get_addr workaround for ASAN in ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Federico Di Pierro 69ecbd4b34 cleanup(ci): drop `sysctl` workaround step.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Federico Di Pierro 48fafb2750 fix(test/e2e): drop assert of docker-only event (runc).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Federico Di Pierro d2a7a65a35 new(ci): add a reusable_e2e_tests workflow and use it in PR CI.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Federico Di Pierro 400f1282c3 new(ci): run e2e tests with podman socket too.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-06 12:14:44 +02:00
Melissa Kilby 00641e17e1 fix(libsinsp): change to EPF_ARG_ALLOWED for proc.args + simplify check
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-05-06 10:04:43 +02:00
Melissa Kilby 52a030aad8 update(libsinsp): support indexed proc.args access
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2025-05-06 10:04:43 +02:00
Leonardo Di Giovanna 003b502377 feat(userspace/libsinsp)!: drop unused `sinsp_dumper` APIs
BREAKING CHANGE: remove `sinsp_dumper::get_memory_dump_cur_buf()` and
`sinsp_dumper::next_write_position()` public APIs

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-05 23:00:40 +02:00
Leonardo Di Giovanna 838f0570a4 refactor(userspace/libsinsp): replace `NULL` with `nullptr`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-05 12:15:37 +02:00
Leonardo Di Giovanna 337068e03b feat(userspace/libsinsp)!: use refs in `sinsp_parser`'s public APIs
Explicitely enforce, by accepting references, the non-nullness of the
input parameters in the `sinsp_parser` public APIs.

BREAKING CHANGE: update `sinsp_parser::process_event()`,
`sinsp_parser::event_cleanup()`, `sinsp_parser::reset()`,
`sinsp_parser::retrieve_enter_event()` and
`sinsp_parser::parse_dirfd()` signatures

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-05 12:15:37 +02:00
Leonardo Di Giovanna 501f36db13 refactor(userspace/libsinsp): use refs in parser's private APIs
Replace pointers with references in `sinsp_parser`'s private APIs
wherever possible.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-05-05 12:15:37 +02:00
Federico Di Pierro 2510a2cb20 fix(driver): fixed build of old bpf probe against linux 6.15-rc1.
Also, fixed modern_ebpf running against the new kernel version.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-05 09:42:37 +02:00
Federico Di Pierro 607ee606cd fix(userspace/libsinsp): avoid bogus error in process_recvmsg_ancillary_data_fds().
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-05-01 15:17:14 +02:00
Federico Di Pierro beea29f2fe update(cmake): updated container plugin to 0.2.1.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-29 16:47:09 +02:00
dependabot[bot] dee2c0bc1a chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/download-artifact](https://github.com/actions/download-artifact) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/download-artifact` from 4.2.1 to 4.3.0
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](95815c38cf...d3f86a106a)

Updates `actions/setup-python` from 5.5.0 to 5.6.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](8d9ed9ac5c...a26af69be9)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 4.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-version: 5.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-29 16:46:09 +02:00
Federico Di Pierro e0db900821 fix(ci): fixed drivers_ci fedora container usage.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-29 16:45:06 +02:00
Leonardo Di Giovanna f17cae7076 feat(userspace/libsinsp)!: introduce parser verdict
Introduce `sinsp_parser_verdict` component. This component is provided
by `sinsp` to the `sinsp_parser` component, and is populated by this
latter with information regarding the thread/file descriptors to
remove and/or the observer callbacks to execute. This helps moving the
state out of the sinsp_parser component.

BREAKING CHANGE: update `sinsp_parser` constructor, and
`sinsp_parser::process_event()` and `sinsp_parser::reset()` signatures

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-29 16:14:08 +02:00
Leonardo Di Giovanna f8252c6efa ci: remove duplicate clang line in e2e_ci.yml
Signed-off-by: Leonardo Di Giovanna <41296180+ekoops@users.noreply.github.com>
2025-04-29 15:58:06 +02:00
Leonardo Di Giovanna 52fef902a7 feat(userspace/libsinsp)!: remove unused `sinsp_evt::clone_event()`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-29 15:48:06 +02:00
Leonardo Di Giovanna 5fdd853570 feat(userspace/libsinsp)!: isolate `sinsp_thread_manager` from `sinsp`
Remove `sinsp_thread_manager` dependency on `sinsp` fields by
selectively providing each single dependency the component.

BREAKING CHANGE: update `sinsp_thread_manager` constructor, and
remove `sinsp::get_thread_manager_dyn_fields()` and
`sinsp::get_fdtable_dyn_fields()` public APIs

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-29 15:46:06 +02:00
Leonardo Di Giovanna ca91cb11b0 feat(userspace/libsinsp): use factory in evt proc's `build_fdinfo()`
Use fdinfo factory in `event_processor::build_fdinfo()`. In order to
avoid call loops, extract the fdinfo creation logic in a separate
private fdinfo factory method and provide access to it via the
attorney-client idiom.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-24 12:35:31 +02:00
Leonardo Di Giovanna 1310e55880 refactor(userspace/libsinsp): add const/static to parser's methods
Add const or static qualifiers to parser's methods, wherever possible.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-24 12:21:31 +02:00
Leonardo Di Giovanna 9f139a076a feat(userspace/libsinsp)! use `timestamper` in usergroup mgr
Replace `sinsp::get_lastevent_ts()` and `sinsp::get_new_ts()`
accesses in `sinsp_usergroup_manager` with accesses to `timestamper`
APIs.

BREAKING CHANGE: update `sinsp_usergroup_manager` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-23 18:08:26 +02:00
Leonardo Di Giovanna 7060dfbc8e feat(userspace/libsinsp)!: use `timestamper` in thread mgr
Replace `sinsp::get_lastevent_ts()` accesses in
`sinsp_thread_manager` with `timestamper::get_cached_ts()`
accesses.

BREAKING CHANGE: update `sinsp_thread_manager` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-23 18:07:26 +02:00
Leonardo Di Giovanna 2294a5635d feat(userspace/libsinsp)!: remove unused `sinsp` public APIs
BREAKING CHANGE: remove `sinsp::set_tid_to_remove()`,
`sinsp::set_tid_of_fd_to_remove()`, `sinsp::get_tid_of_fd_to_remove()`
and two `sinsp::get_fds_to_remove()` variants APIs

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-23 18:06:26 +02:00
FedeDP faec8e420a update(driver): update syscalls tables and driver report.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-23 16:34:26 +02:00
Federico Di Pierro 1b9b1ce849 new(ci): add latest_kernel badge to driver release body.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-23 16:33:26 +02:00
Aldo Lacuku c4e073d178 chore(plugin/container): bump container plugin version to 0.2.0
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-04-23 10:55:24 +02:00
Leonardo Di Giovanna 997bf7504e refactor(userspace/libsinsp): add `timestamper` component
Add `timestamper` component handling timestamp caching and
generation. The addition of this component is a preliminary step
needed for decoupling other components like `sinsp_thread_manager`
and `sinsp_usergroup_manager` from `sinsp`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-23 10:40:24 +02:00
Leonardo Di Giovanna 2c56be08ae feat(userspace/libsinsp)!: make `sinsp_parser::erase_fd()` private
BREAKING CHANGE: change `sinsp_parser::erase_fd()` visibility

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-23 10:21:24 +02:00
dependabot[bot] 26bef272a7 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [uraimo/run-on-arch-action](https://github.com/uraimo/run-on-arch-action), [softprops/action-gh-release](https://github.com/softprops/action-gh-release) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `uraimo/run-on-arch-action` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/uraimo/run-on-arch-action/releases)
- [Commits](4141da824f...d94c13912e)

Updates `softprops/action-gh-release` from 2.2.1 to 2.2.2
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](c95fe14893...da05d55257)

Updates `codecov/codecov-action` from 5.4.0 to 5.4.2
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](0565863a31...ad3126e916)

---
updated-dependencies:
- dependency-name: uraimo/run-on-arch-action
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: softprops/action-gh-release
  dependency-version: 2.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-23 10:20:24 +02:00
Leonardo Di Giovanna de00a6bfa2 feat(userspace/libsinsp)!: remove dependency on parser from thread mgr
BREAKING CHANGE: make
`sinsp_thread_manager::remove_main_thread_fdtable()` private and
const, and update `sinsp_thread_manager` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-22 11:26:17 +02:00
Leonardo Di Giovanna 378b3228d9 feat(userspace/libsinsp)!: remove unused `m_ts` from `erase_fd_params`
BREAKING CHANGE: remove `m_ts` field form `erase_fd_params`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-22 11:18:18 +02:00
Leonardo Di Giovanna 274d96b8ab refactor(userspace/libsinsp): use refences in `fd_to_scap()`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-22 11:17:18 +02:00
Leonardo Di Giovanna 902fcdcc32 refactor(userspace/libsinsp): use references in `copy_ipv6_address()`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-22 11:17:18 +02:00
Gerald Combs 24539f5cdd update(userspace): Remove some unused code
sinsp_filter_extract_cache::offset() was unused, so remove it.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs fe047fee26 update(userspace): Make offset extraction per-value instead of per-field
Add support for extracting offsets for each value instead of just the
first one.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs 747bd9d85a fix(userspace): Use an absolute include path
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs 771f070dcb update(userspace): Track offsets as start+length
Wireshark and tcpdump both handle offsets using start+length pairs, so
use that convention here.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs c4c36c377f Update userspace/libsinsp/sinsp_filtercheck.cpp
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs da5a0ca66c update(userspace): Expose offsets in the filtercheck API
Add extraction offsets to the filter cache. Add an offset parameter to
the various extract_nocache functions. Implement offset extraction in
sinsp_filter_check_plugin::extract_nocache, and ignore offsets
elsewhere. Add sinsp_filter_check::extract_with_offsets. Add an offsets
test to plugins.ut.cpp.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs 5631af6237 update(userspace/plugin): Update ss_plugin_field_extract_input
Remove field_offsets from ss_plugin_field_extract_input. We can just
check to see if field_offsets is set. Update some comments.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Gerald Combs 7707102c5d new(userspace/plugin) Add support for start and end field offsets
Add ss_plugin_extract_field_offsets as a companion struct to
ss_plugin_extract_field.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-04-18 09:28:50 +02:00
Leonardo Di Giovanna 54d93c6f34 feat(userspace/libsinsp)!: avoid string copy in `get_field_accessor()`
Avoid field name copy each time
`sinsp_thread_manager::get_field_accessor()` is called by passing a
string const reference.

BREAKING CHANGE: change `sinsp_thread_manager::get_field_accessor()`
signature

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-18 09:18:50 +02:00
Leonardo Di Giovanna 19adaa8211 feat(userspace/libsinsp)!: extract thread mgr accessors/tables logics
Move `sinsp_thread_manager::load_foreign_fields_accessors()` method
logic in sinsp, and provide two new setters
`sinsp_thread_manager::set_foreign_field_accessors()` and
`sinsp_thread_manager::set_foreign_tables()` to enable tables
and accessors setting on thread manager from sinsp.

BREAKING CHANGE: remove
`sinsp_thread_manager::load_foreign_fields_accessors()` method

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-18 09:17:50 +02:00
Leonardo Di Giovanna 7ceeac9a34 feat(userspace/libsinsp)!: reduce threadinfo's params resources waste
Reduce threadinfo's params resources waste by moving them into a
separate struct provided at construction phase and shared among all
threadinfo instances.

BREAKING CHANGE: update `sinsp_threadinfo` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-17 16:39:50 +02:00
Leonardo Di Giovanna 27edc45f52 feat(userspace/libsinsp)!: remove unused `sinsp` public APIs
Remove unused `sinsp::get_fdinfo_factory()` and
`sinsp::get_fdtable_factory()` from `sinsp` public API.

BREAKING CHANGE: remove `sinsp::get_fdinfo_factory()` and
`sinsp::get_fdtable_factory()`

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-17 16:39:50 +02:00
Leonardo Di Giovanna 99db4d773f feat(userspace/libsinsp)!: isolate mutable `sinsp_threadinfo` deps
Remove `sinsp_threadinfo` dependency on `sinsp` fields that are
mutable from the `sinsp_threadinfo` perspective by selectively
providing each single dependency the component needs. In order to
solve a cyclic dependency problem with the thread manager and the
thread info factory, add `sinsp_threadinfo_factory`'s
`set_thread_manager_attorney` inner class following the
attorney-client idiom to limit access to
`sinsp_threadinfo_factory::set_thread_manager` private method.

BREAKING CHANGE: update `sinsp_threadinfo` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-17 16:39:50 +02:00
Leonardo Di Giovanna 87e741787f feat(userspace/libsinsp)!: isolate immutable `sinsp_threadinfo` deps
Remove `sinsp_threadinfo` dependency on `sinsp` fields that are
immutable from the `sinsp_threadinfo` perspective by selectively
providing each single dependency the component needs. In order to
avoid code duplication in the event processor, add
`sinsp_threadinfo_factory`'s `create_unique_attorney` inner class
following the attorney-client idiom to limit access to
`sinsp_threadinfo_factory::create_unique` private method.

BREAKING CHANGE: update `sinsp_threadinfo` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-17 16:39:50 +02:00
Leonardo Di Giovanna 689c7bf530 refactor(libsinsp/userspace): simplify thread mgr reference chains
Remove, in thread manager code, references to thread manager's methods
involving passing through the inspector.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-17 10:53:49 +02:00
Leonardo Di Giovanna 4927c6336c refactor(userspace/libsinsp): remove unneeded `this` lambda capture
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-16 12:21:45 +02:00
Leonardo Di Giovanna ab7eceb811 feat(libsinsp/userspace)!: reduce fdtable's params resources waste
Reduce fdtable's params resources waste by moving them into a
separate struct provided at construction phase and shared among all
fdtable instances.

BREAKING CHANGE: update `sinsp_fdtable` constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-16 12:20:46 +02:00
Federico Di Pierro dd929392e4 fix(userspace/libsinsp): do not throw an error while reading container's plugin IP or USER.
It might happen that a threadinfo has a container_id attached,
but the plugin already removed the container from its cache.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-15 16:16:40 +02:00
Leonardo Di Giovanna 7485bf67c7 fix(userspace/libsinsp): fix type mismatch warning in `parsers.cpp`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 15:54:40 +02:00
Nathan Baker 0253d2ae4d Changed GH action per code review comment
Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2025-04-15 15:50:41 +02:00
Nathan Baker 84bf592ee0 Modify the gh action to avoid build failure
Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2025-04-15 15:50:41 +02:00
Nathan Baker 1a62c2e8dc clang-format
Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2025-04-15 15:50:41 +02:00
Nathan Baker c51e45f183 Added conditional compilation to avoid building Linux code on non-Linux systems
Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2025-04-15 15:50:41 +02:00
Nathan Baker db969a44c1 feat(sinsp-example): Add throughput profiling
Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2025-04-15 15:50:41 +02:00
Leonardo Di Giovanna f84c99466c feat(userspace/libsisnp)!: pass `notify` into `set_group` signature
Pass `notify` as `sinsp_threadinfo::set_group()` flag to enable
external control over thread user update notification.

BREAKING CHANGE: update `sinsp_threadinfo::set_group()`,
`sinsp_threadinfo::init()` signatures and `user_group_updater`
constructor.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 14:15:40 +02:00
Leonardo Di Giovanna aaf688db33 feat(userspace/libsinsp)!: pass `notify` into `set_user` signature
Pass `notify` as `sinsp_threadinfo::set_user()` flag to enable
external control over thread user update notification.

BREAKING CHANGE: update `sinsp_threadinfo::set_user()`,
`sinsp_threadinfo::init()` signatures and `user_group_updater`
constructor.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 14:15:40 +02:00
Leonardo Di Giovanna a358970a29 feat(userspace/libsinsp)!: move server ports accounting in thread mgr
Move bound server ports accounting from
`sinsp_threadinfo::add_fd_from_scap()` to new
`sinsp_thread_manager::add_thread_fd_from_scap()` API.

BREAKING CHANGE: change sinsp_threadinfo::add_fd_from_scap() semantic

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 13:43:39 +02:00
Leonardo Di Giovanna ec8810c38a feat(userspace/libsinsp)!: pass ipv4 server ports as func parameter
Pass `ipv4_server_ports` as
`sinsp_threadinfo::fix_sockets_coming_from_proc()` parameter.

BREAKING CHANGE: update
`sinsp_threadinfo::fix_sockets_coming_from_proc()` signature

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 11:29:39 +02:00
Leonardo Di Giovanna 42cf2c746a feat(userspace/libsinsp)!: pass references to `*_to_string` utils
BREAKING CHANGE: update `*_to_string` signatures

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-15 10:54:38 +02:00
Leonardo Di Giovanna 9faea122ad feat(userspace/libsinsp)!: move `large_envs_enabled` into signature
Pass `large_envs_enabled` as `sinsp_treadinfo::set_env() parameter.

BREAKING CHANGE: update `sinsp_threadinfo::init()`,
`sinsp_threadinfo::set_env()` and parser constructor

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-14 16:02:34 +02:00
Leonardo Di Giovanna a5e675b110 feat(libsinsp)!: move fd filtering logic out of `add_fd_from_scap`
BREAKING CHANGE: update `add_fd_from_scap` signature

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-14 14:45:34 +02:00
Leonardo Di Giovanna f85eca61c1 feat(userspace/libsinsp)!: move host and port res flag into signature
Add `resolve_hostname_and_port` parameter to
`sinsp_threadinfo::fix_sockets_coming_from_proc()` and
`sinsp_thread_manager::fix_sockets_coming_from_proc()` signatures

BREAKING CHANGE: update
`sinsp_threadinfo::fix_sockets_coming_from_proc()` and
`sinsp_thread_manager::fix_sockets_coming_from_proc()` signatures

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-14 14:44:33 +02:00
Federico Di Pierro 8123ddc3b9 chore(userspace/libsinsp): update rawarg_madness test testing the memcpy past end of data issue.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-10 17:52:07 +02:00
Federico Di Pierro a3ce9e8a38 fix(userspace/libsinsp): avoid copying past end of data bytes.
Another edge case of `evt.rawarg.*` fields.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-10 17:52:07 +02:00
Federico Di Pierro 9d82833196 fix(userspace/libsinsp): fixed `flt_cast` impl for big endian systems.
For now, only s390x.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-04-10 17:52:07 +02:00
Leonardo Di Giovanna d45ed9c00e feat(userspace/libsinsp)!: make `sinsp::m_table_registry` private
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-09 15:25:58 +02:00
Leonardo Di Giovanna 1b53c855db refactor(userspace/libsinsp): convert some double pointers to ref
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-09 15:24:58 +02:00
Leonardo Di Giovanna 67ffe77532 fix(ci): fix zig download link
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-09 13:35:58 +02:00
Wiktor Gołgowski 59ad87c23b fix(libsinsp): off-by-one error
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2025-04-09 10:58:58 +02:00
Wiktor Gołgowski c8a48abb61 fix(modern_bpf): only store ancillary data under 64k
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2025-04-09 10:58:58 +02:00
Wiktor Gołgowski 869941a286 fix(libsinsp): retrieve ancillary data only for Unix sockets
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2025-04-09 10:58:58 +02:00
Wiktor Gołgowski 42782ca0f5 fix(libsinsp): protect from malformed ancillary data
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2025-04-09 10:58:58 +02:00
Jason Dellaluce b424690702 fix(libsinsp/filter): support syscall.type in event code search
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-04-08 16:32:51 +02:00
Leonardo Di Giovanna 5df36d44e6 feat(userspace/libsinsp): isolate ifinfo from `sinsp`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-04-08 14:04:50 +02:00
dependabot[bot] f150ed684f chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [mozilla-actions/sccache-action](https://github.com/mozilla-actions/sccache-action) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `mozilla-actions/sccache-action` from 0.0.8 to 0.0.9
- [Release notes](https://github.com/mozilla-actions/sccache-action/releases)
- [Commits](65101d47ea...7d986dd989)

Updates `actions/setup-python` from 5.4.0 to 5.5.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](42375524e2...8d9ed9ac5c)

---
updated-dependencies:
- dependency-name: mozilla-actions/sccache-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-01 11:43:10 +02:00
Federico Di Pierro 7f01ec89c5 fix(driver): fix driver and bpf makefile for linux 6.13.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-28 14:36:40 +01:00
dependabot[bot] 3a828b4bbd chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact) and [actions/cache](https://github.com/actions/cache).


Updates `actions/upload-artifact` from 4.6.1 to 4.6.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](4cec3d8aa0...ea165f8d65)

Updates `actions/download-artifact` from 4.1.9 to 4.2.1
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](cc20338598...95815c38cf)

Updates `actions/cache` from 4.2.2 to 4.2.3
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](d4323d4df1...5a3ec84eff)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-27 08:37:33 +01:00
Grzegorz Nosek 6636a01fc9 fix(build): properly determine relative path to CMAKE_INSTALL_PREFIX
pkgconfig files are installed in CMAKE_INSTALL_LIBDIR/pkgconfig and we
need to find our way back to CMAKE_INSTALL_PREFIX. The correct
(relative) path is as many `../` up, as there are components in
`CMAKE_INSTALL_LIBDIR/pkgconfig` (the default being `lib/pkgconfig`).

Rather than hardcode the two components matching the default path,
figure it out at configure time.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-03-27 08:36:34 +01:00
Grzegorz Nosek c8f8af75f1 fix(build): fix pkgconfig builds again
* use relative path as pkgconfig prefix (using CMAKE_INSTALL_PREFIX
  breaks `make DESTDIR=...` installs)

* install generated uthash.h rather than point into local build
  directory

* fix typos that prevented libscap.pc from specifying dependencies

Note: I was still unable to do a successful build with
ASAN/UBSAN-enabled libsinsp, but that's possibly my fault.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-03-27 08:36:34 +01:00
Luca Guerra 659171784e update(libsinsp): increase async event queue size
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-03-26 19:36:29 +01:00
Federico Di Pierro dc16ffa855 update(cmake): bumped container_plugin.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-24 14:24:17 +01:00
Leonardo Di Giovanna 927d7f73b7 refactor(libscap): use `scap_errprintf` for scap errors handling
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-24 13:21:17 +01:00
Leonardo Di Giovanna d6534c4762 refactor(userspace/libsinsp): isolate fdtable and fdinfo from `sinsp`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-24 12:44:17 +01:00
Mark Stemm ab8e6cbf7c Add a unit test for escaping values containing = characters
This test verifies that a condition expression with a value containing
an `=` character can be printed and parsed again without errors.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2025-03-24 11:11:17 +01:00
Mark Stemm 35d720063f fix(libsinsp): Escape values containing = characters
If a condition expression contains a value with a = character, when
the condition expression is printed as a string using
libsinsp::filter::ast::as_string, the value is not escaped.

This causes problems if you try to parse the condition expression string again.

For example, a condition of ... and not (proc.cmdline contains
"--coreutils-prog-shebang=") and not ... gets printed as ... and
not (proc.cmdline contains --coreutils-prog-shebang=) and not
... which results in an error when trying to parse it again.

The fix is to detect when a value contains a `=` character and escape
the value when found.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2025-03-24 11:11:17 +01:00
Leonardo Di Giovanna 8814a026ec fix(userspace/libsinsp): ignore malformed recvmsg ancillary data
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-24 10:26:17 +01:00
Grzegorz Nosek 98970de65c fix(sinsp): ensure on_accept observer always gets a valid fdinfo
When the fd table is full, evt->get_fd_info is reset to NULL, which
causes a crash when the observer accesses the fdinfo. Revert to
the previous behavior, where we always called the observer with
a valid fdinfo, even if the fd got later dropped.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-03-21 12:03:31 +01:00
Grzegorz Nosek 7e969df817 fix(sinsp): take shared_ptr<sinsp_fdinfo> in sinsp_threadinfo->add_fd
The pointer ends up being converted to a shared_ptr anyway so we can
do it a bit earlier without issues.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-03-21 12:03:31 +01:00
Gerald Combs 70c65156c6 Update .github/workflows/ci.yml
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-03-21 12:00:32 +01:00
Gerald Combs c10380abef fix(scap): Skip over section header block options
Many pcapng block types support optional fields, and the SHB is one of
those types:

https://ietf-opsawg-wg.github.io/draft-ietf-opsawg-pcap/draft-ietf-opsawg-pcapng.html#name-section-header-block

Some software lets you add file-level comments to the SHB. Make sure we
skip over any options in scap_read_section_header.

Add a note to next_event_from_file about the possibility of adding
support for comment options in event blocks.

Add a test capture file which contains comments along with a CI test.
Created by running

    editcap --capture-comment "File-level comment" -a "1:Internal block comment" -a "211:Visible block comment, no padding" -a "213:Visible block comment, padding" curl_google.scap curl_google_comments.scap

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-03-21 12:00:32 +01:00
Leonardo Di Giovanna f2c055d648 feat(userspace/libsinsp)!: remove `sinsp::build_threadinfo()`
Remove inspector's `sinsp::build_threadinfo()` exposed method and
force the other components (i.e.: `sinsp_thread_manager`, `sinsp`,
`sinsp_parser`, etc...) to use the threadinfo factory to create a new
`sinsp_threadinfo` object. Moreover, extract the thread manager's
dynamic fields initialization from thread manager, and pass them to
its constructor from sinsp: this allows to control the dynamic
fields in a single place and inject them both on the thread manager
and on the threadinfo factory. Together, these changes reduces the
number of dependencies of components that want to create a new
threadinfo. This step is needed to get rid of the `sinsp` pointer in
`sinsp_thread_manager`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-19 12:48:20 +01:00
Leonardo Di Giovanna 328c692cb2 refactor(libsinsp): split threadinfo and thread manager components
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-19 10:46:20 +01:00
Leonardo Di Giovanna 9c6d68a0ff feat(userspace/libsinsp)!: remove `sinsp::build_fdinfo()`
Remove inspector's `sinsp::build_fdinfo()` exposed method and force
the other components (i.e.: `sinsp_threadinfo`,
`sinsp_thread_manager`, etc...) to use the fdinfo factory to create a
new `sinsp_fdinfo` object. Moreover, remove the dependency of
`sinsp_fdinfo_factory` from `sinsp_thread_manager`. Together, these
changes reduces the number of dependencies of components that want to
create a new fdinfo. This step is needed to get rid of the `sinsp`
pointer in `fdtable`, `sinsp_thread_manager` and `sinsp_threadinfo`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-19 09:16:20 +01:00
Leonardo Di Giovanna e751d5c90c fix(userspace/libsinsp): store input plugin ref in parser
Store input plugin reference in parser to handle input plugin
reassignments in `sinsp`: indeed, if the input plugin is reassigned
(e.g.: `sinsp::set_input_plugin`), the parser would continue to
use the old input plugin value, as currently it makes a copy of the
provided shared_ptr.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-18 12:33:14 +01:00
Leonardo Di Giovanna 69501f60a3 feat(userspace/libsinsp)!: unexpose `sinsp`'s `m_input_plugin*`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-18 09:09:14 +01:00
Grzegorz Nosek d815a12387 fix(sinsp): restore binary compatibility with pre-3.10 static plugins
API 3.10 changed the layout of the plugin_api struct
in an ABI-incompatible way. This does not matter for shared library
plugins, but statically linked plugins do depend on binary compatibility
between the two structs.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-03-17 14:28:08 +01:00
Leonardo Di Giovanna 15c4369ac7 refactor(libsinsp/fdinfo): export static fields via static method
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-17 11:15:07 +01:00
Leonardo Di Giovanna 1da4ed8a07 refactor(libsinsp/threadinfo): export static fields via static method
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-17 11:15:07 +01:00
Leonardo Di Giovanna 4a082463b8 feat(libsinsp): simplify `define_static_field` duties
Make `define_static_field` constexpr static and directly provide
the field offset. Introduce `OFFSETOF_STATIC_FIELD`,
`DEFINE_STATIC_FIELD_READONLY` and `DEFINE_STATIC_FIELD` macros to
hide the complexicity behind extracting the field type and offset
needed for `define_static_field`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-17 11:15:07 +01:00
Leonardo Di Giovanna 3b6d2dfa6b docs(userspace/libsinsp): add missing licenses
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-17 11:03:06 +01:00
Gerald Combs ed6e4c8010 cleanup: Add .DS_Store to .gitignore
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2025-03-14 10:45:50 +01:00
Federico Di Pierro 5a5a042619 fix(test/libscap,userspace/libscap): fix UBSAN errors in libscap tests.
De-referencing scap_evt fields is undefined behavior since
scap_evt is pragma packed and we may access fields whose address
is not correctly aligned.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-13 18:21:47 +01:00
Federico Di Pierro 6931d0932f chore(ci): enable ubsan in libscap tests CI.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-13 18:21:47 +01:00
Federico Di Pierro eff27490e7 chore(userspace/libsinsp): drop useless assert from logger::add_callback_log().
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-13 10:41:45 +01:00
Leonardo Di Giovanna 01c8fe62ab fix(sinsp/parsers): replace `CMSG_LEN` with custom `PPM_CMSG_LEN`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-12 14:56:43 +01:00
Leonardo Di Giovanna 5a450a6eb6 perf(sinsp/parsers): restructure recvmsg `SCM_RIGHTS` processing
Restructure recvmsg `SCM_RIGHTS` processing to avoid allocations
before sanity checks are performed.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-12 14:55:42 +01:00
Leonardo Di Giovanna ab350a1317 build: remove trailing comma in `sinsp-minimal` cmake preset
Remove trailing comma as some old cmake versions cannot otherwise
parse the `CMakePresets.json` file.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-12 14:53:43 +01:00
Federico Di Pierro 9ef8acd0b5 chore(ci): download assets from latest driverkit release instead of release workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:05:41 +01:00
Federico Di Pierro 7db04d358c chore(cmake): match both release and relwithdebinfo (used by Falco) builds.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
Federico Di Pierro 818d798d14 chore(cmake): use -O3 for protobuf.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
Federico Di Pierro a185f49fdf fix(cmake): honor CMAKE_BUILD_TYPE for re2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
Federico Di Pierro c845d3c980 fix(cmake): properly forward `-O3` optimization to zlib in release mode.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
Federico Di Pierro 028d4ca332 chore(cmake): enforce zlib-lib and zlib-include in protobuf.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
Federico Di Pierro b372c7985b update(ci): bump zig to official 0.14.0 and drop caching
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-03-12 10:01:41 +01:00
dependabot[bot] d761f18a07 chore(deps): Bump the actions group across 1 directory with 5 updates
Bumps the actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | `1.2.1` | `1.2.2` |
| [mozilla-actions/sccache-action](https://github.com/mozilla-actions/sccache-action) | `0.0.7` | `0.0.8` |
| [actions/cache](https://github.com/actions/cache) | `4.2.1` | `4.2.2` |
| [codecov/codecov-action](https://github.com/codecov/codecov-action) | `5.3.1` | `5.4.0` |
| [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) | `7.0.7` | `7.0.8` |



Updates `appleboy/ssh-action` from 1.2.1 to 1.2.2
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](8faa84277b...2ead5e3657)

Updates `mozilla-actions/sccache-action` from 0.0.7 to 0.0.8
- [Release notes](https://github.com/mozilla-actions/sccache-action/releases)
- [Commits](054db53350...65101d47ea)

Updates `actions/cache` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c907a75c2...d4323d4df1)

Updates `codecov/codecov-action` from 5.3.1 to 5.4.0
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](13ce06bfc6...0565863a31)

Updates `peter-evans/create-pull-request` from 7.0.7 to 7.0.8
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](dd2324fc52...271a8d0340)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: mozilla-actions/sccache-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 10:58:35 +01:00
Shane Lawrence b242889591 Enable asan and add buffer overrun test for procfs sockets.
Signed-off-by: Shane Lawrence <shane@lawrence.dev>
2025-03-06 11:19:08 +01:00
Shane Lawrence de3f4cac92 Fix buffer overrun reading sockets from procfs.
Signed-off-by: Shane Lawrence <shane@lawrence.dev>
2025-03-06 11:19:08 +01:00
dependabot[bot] 75d99b6d55 chore(deps): Bump dawidd6/action-download-artifact from 8 to 9
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 8 to 9.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](20319c5641...07ab29fd4a)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 16:19:01 +01:00
dependabot[bot] 7bdc496974 chore(deps): Bump uraimo/run-on-arch-action from 2.8.1 to 3.0.0
Bumps [uraimo/run-on-arch-action](https://github.com/uraimo/run-on-arch-action) from 2.8.1 to 3.0.0.
- [Release notes](https://github.com/uraimo/run-on-arch-action/releases)
- [Commits](5397f9e30a...4141da824f)

---
updated-dependencies:
- dependency-name: uraimo/run-on-arch-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 16:18:02 +01:00
Leonardo Di Giovanna 9dc846f808 refactor(libsinsp): split `sinsp_fdtable` and `sinsp_fdinfo`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-03-01 13:09:42 +01:00
Leonardo Di Giovanna 01b9013d99 refactor(libsinsp/parser): isolate `sinsp_parser` component
Isolate `sinsp_parser` component from sinsp by removing the source
code dependency. Dependencies are now selectively pushed in the parser
constructor and their constness enforced wherever possible.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-28 16:16:39 +01:00
Federico Di Pierro 3d1d4a930d update(cmake): bump container plugin to rc3.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-27 13:22:32 +01:00
Federico Di Pierro 3270510a59 cleanup(userspace/libsinsp): cleanup unused sinsp_cgroup class.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-27 13:22:32 +01:00
Federico Di Pierro 810c97ca9d chore(cmake): allow consumers (ie: Falco) to override container plugin version and hash.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-27 13:22:32 +01:00
Federico Di Pierro f60b1f4b75 update(cmake): bump container-plugin to 0.1.0-rc2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-27 13:22:32 +01:00
Leonardo Di Giovanna 18387556d1 refactor(libsinsp/fdinfo): simplify `lookup_device`
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-27 13:03:32 +01:00
Leonardo Di Giovanna c1e6254c27 refactor(libsinsp): improve ifinfo immutability checks and readability
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-26 17:27:27 +01:00
Leonardo Di Giovanna d971c4063c refactor(libsinsp): simplify `set_net_role_by_guessing` in fdinfo
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-26 14:31:27 +01:00
Leonardo Di Giovanna 5a681cbbfb refactor(libsinsp): move sinsp mode evaluation in helper class
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-26 11:21:26 +01:00
dependabot[bot] c8cc8d1d5c chore(deps): Bump the actions group across 1 directory with 5 updates
Bumps the actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.0` | `4.6.1` |
| [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | `1.2.0` | `1.2.1` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `4.1.8` | `4.1.9` |
| [actions/cache](https://github.com/actions/cache) | `4.2.0` | `4.2.1` |
| [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) | `7.0.6` | `7.0.7` |



Updates `actions/upload-artifact` from 4.6.0 to 4.6.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65c4c4a1dd...4cec3d8aa0)

Updates `appleboy/ssh-action` from 1.2.0 to 1.2.1
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](7eaf76671a...8faa84277b)

Updates `actions/download-artifact` from 4.1.8 to 4.1.9
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](fa0a91b85d...cc20338598)

Updates `actions/cache` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](1bd1e32a3b...0c907a75c2)

Updates `peter-evans/create-pull-request` from 7.0.6 to 7.0.7
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](67ccf781d6...dd2324fc52)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-26 10:59:26 +01:00
Federico Di Pierro 595bb7337f cleanup(userspace/libsinsp): drop wrong ASSERTs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro a5c9a6ba90 cleanup: drop more references.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 718950d72c new(userspace/libsinsp): read `user` and `ip` from container plugin exposed table.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 5163c8814b update(cmake): bumped container plugin to latest release.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 52468b97c7 chore(ci,build): introduce a `ENABLE_E2E_TESTS` cmake option.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 1dc8ce1418 cleanup(ci): drop unused deps.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 9d3bce9e20 cleanup(test/libsinsp_e2e): dropped container-related libsinsp e2e tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro d45d53a1e0 cleanup: drop MINIMAL_BUILD.
Nowadays, it was only filtering out gvisor (and thus protobuf), but we already have the `BUILD_LIBSCAP_GVISOR` flag for that.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 41e0d16272 cleanup(cmake,userspace): drop {grpc,openssl,cares} deps since they are unused.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro ac3b7bff31 new(test/e2e,cmake): initial support for e2e tests with container plugin.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 0b4605a97d fix(userspace/libsinsp/test): let libsinsp unit test build again.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro a1404c87f1 chore(userspace/libsinsp): allow sinsp-example to compile.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 9f0abc470c cleanup(userspace/libsinsp): add a `get_container_id` helper method on threadinfo.
It leverages sinsp state table API to retrieve "container_id" field written by the plugin.
Use it where needed.

Moreover, user_group_manager cannot subscribe to container changes anymore, since container changes are no more in sinsp.
Instead, parse ASYNC event "container_removed" to cleanup user_group tables.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 0a2002ea3a chore(userspace/libsinsp): cleanup sinsp.h
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 4b23e47adc cleanup: dropped libcurl dependency.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 3afd2d329b cleanup(userspace/libsinsp): dropped `TYPE_IS_CONTAINER_HEALTHCHECK`, `TYPE_IS_CONTAINER_LIVENESS_PROBE`, `TYPE_IS_CONTAINER_READINESS_PROBE` extractors.
They are now implemented by the plugin.
Also, dropped threadinfo::m_category, unused.

Finally, dropped `sinsp_observer::on_resolve_container`.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 1a0b3178e2 cleanup(userspace/libsinsp): remove container engines, container manager, container info and dependent classes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 9ab23531a0 cleanup(userspace/libsinsp): drop container_manager from dumper and a couple of unused methods in sinsp.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Federico Di Pierro 3f3e3fb232 cleanup(userspace): initial drop of container_manager from sinsp and container_id from threadinfo.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-26 10:27:25 +01:00
Gerlando Falauto f52bcc383f feat(configure): add sanity check for kmod/ebpf
Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
2025-02-21 22:21:58 +01:00
Gerlando Falauto 51299f7531 chore(configure): add newlines to output for kmod/bpf
Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
2025-02-21 22:21:58 +01:00
Iacopo Rozzo 0d94d2bc55 chore(libsinsp): remove unused plugin table API functions
Clean-up unused functions from the table API.

Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-02-17 10:34:31 +01:00
Federico Di Pierro 618da0378c fix(userspace/libpman): do not use `BPF_PROG_TYPE_TRACING` that may or may not be checkable in `pman_prepare_progs_before_loading`.
Instead, use `BPF_PROG_TYPE_RAW_TRACEPOINT` that works fine for the bpf helper probing.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-17 10:28:31 +01:00
Federico Di Pierro f2dcba93e9 fix(driver/bpf): fixed small verifier bug in old bpf probe.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-17 10:27:32 +01:00
Federico Di Pierro c7b8dba912 fix(userspace/libsinsp): allow plugin filterchecks args to be both index or key.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-14 10:21:15 +01:00
Maxim Cournoyer d4e5c6b2f3 build: Fix shared library build.
* driver/CMakeLists.txt (DRIVER_SOURCES): Add missing headers.
* userspace/libsinsp/test/CMakeLists.txt (unit-test-libsinsp): Link to
libgrpc++ to avoid a missing DSO error.
* userspace/libscap/CMakeLists.txt: Do not hardcode STATIC type for
scap_event_schema and scap_platform libraries, so as to install
them (they are referenced in the pkg-config files).

Fixes: #1820
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2025-02-13 18:31:11 +01:00
Maxim Cournoyer 131cda7626 Refine pkg-config files generation.
The generated pkg-config files of libscap and libsinsp now makes use
of pkg-config Requires and Requires.static fields, which should reduce
over-linking when linking to shared libraries.

* cmake/modules/BuildPkgConfigDependencies.cmake
(add_pkgconfig_library): Add debug messages and fix an issue where
IN_LIST had no effect.
* cmake/modules/libscap.cmake: Move pkgconfig dependency computation
to, pkg-config file configuration to...
* userspace/libscap/CMakeLists.txt: ... here, conditionally
accumulating Requires and Requires.private values.
* userspace/libscap/libscap.pc.in (prefix): Set directly to
CMAKE_INSTALL_PREFIX.
(Requires, Requires.private): New fields.
* userspace/libsinsp/CMakeLists.txt: Separate libraries into
pkg-config Requires and Requires.private lists.  Add the pkg-config
requirements to the ignored link dependencies, since these are now
recorded as Requires in the pkg-config file.
* userspace/libsinsp/libsinsp.pc.in (Requires): Add
@LIBSINSP_REQUIRES@.
(Requires.private): New field.
(Libs): Remove -lsinsp, automatically computed in SINSP_PKG_CONFIG_LIBS.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2025-02-13 18:31:11 +01:00
Maxim Cournoyer 8020b14dc2 build: Install the pman header and a libpman.pc file.
* userspace/libpman/libpman.pc.in: New file.
* userspace/libpman/CMakeLists.txt: Configure and install it along the
libpman header.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2025-02-13 18:31:11 +01:00
Maxim Cournoyer 0ef229ddf3 userspace: Extend CFLAGS of libscap.pc and libsinsp.pc.
This is to so that includes work whether using e.g. #include <scap.h>
or #include <libscap/scap.h>, and likewise for libsinp.

* userspace/libsinsp/libsinsp.pc.in (Cflags): Add include directive
for falcosecurity/driver.
* userspace/libscap/libscap.pc.in: Likewise.  Also add include
directive for uthash.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2025-02-13 18:31:11 +01:00
Federico Di Pierro 51410de9da chore(ci): bump zig version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 16:46:58 +01:00
Federico Di Pierro 1cb96b13bd chore(ci): bump actions/cache version to latest.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 16:46:58 +01:00
Federico Di Pierro 10970f305b chore(driver/modern_bpf,userspace/libpman): properly use `BPF_PROG_TYPE_TRACING` in `pman_prepare_progs_before_loading`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro ad06e92d99 chore(driver/modern_bpf,userspace/libpman): address review comments.
Use anonymous unions in modern bpf driver. Moreover, add some debug prints to `pman_prepare_progs_before_loading`,
and always disable all unused programs autoload.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro 73e96f6b98 chore(ci): run arm64 driverkit workflow on arm64 runner.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro f287b80fe0 fix(driver/modern_bpf): avoid calling `extract_network_args` in apply_dynamic_snaplen at each bpf_loop iteration for sendmmsg and recvmmsg.
This also fixes a verifier issue on clang 14, related to stack length.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro 208e3671f0 fix(driver/modern_bpf): avoid referencing out of scope variables.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro fc9fdc7d1c chore(driver/modern_ebpf): avoid passing unused data to bpf_loop callback.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro 6ca90d8bc8 chore(userspace/libpman): some renamings to better reflect new changes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro 8cf3ac0335 chore(ci): fix s390x drivers ci by symlimking libbpf headers.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Federico Di Pierro 07650ec936 new(driver/modern_bpf,userspace/libpman): support multiple programs for each event.
Try to inject each of them until success.
This allows us to inject `bpf_loop` sendmmsg and recvmmsg programs where supported,
and fallback at just sending first message where it isn't.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-02-11 12:05:58 +01:00
Jason Dellaluce fbd198d9a2 fix(libsinsp): correct state subtable type casting
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-02-11 09:58:57 +01:00
Jason Dellaluce f610b4e536 fix(libsinsp): consistently invalidate cached pointer in thread info table
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-02-11 09:58:57 +01:00
Jason Dellaluce b77d40119f fix(libsinsp): do not make stale fd table pointers readable through state/plugin API
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-02-11 09:58:57 +01:00
Grzegorz Nosek 5e06e37aaa fix(build): make sinsp links to gprc libraries public
This fixes dynamically linked builds of unit-test-libsinsp

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-02-10 12:37:52 +01:00
Grzegorz Nosek ab15441b75 fix(build): make pkgconfig work again
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-02-10 12:37:52 +01:00
Grzegorz Nosek a2a32d79c4 fix(scap): remove a static global from event converter
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-02-10 11:48:52 +01:00
Andrea Terzolo a879a770d0 new(proposal): disable support for syscall enter events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-02-10 10:27:52 +01:00
Iacopo Rozzo e1edffc89a fix(cri): register the container callback for CRI
Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-02-07 16:43:41 +01:00
Iacopo Rozzo e296b0c9a3 feat(cri): make CRI lookup retry parameters configurable
Make the CRI retry lookup configurable, this includes:
- maximum elapsed time
- number of retries
- maximum retry interval

Signed-off-by: Iacopo Rozzo <iacopo@sysdig.com>
2025-02-07 16:43:41 +01:00
dependabot[bot] 86dfa2b8b0 chore(deps): Bump actions/setup-python in the actions group
Bumps the actions group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/setup-python` from 5.3.0 to 5.4.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](0b93645e9f...42375524e2)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-05 22:12:23 +01:00
Roberto Scolaro 356d27a244 fix(bpf): add tail call to sendmmsg filler
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-02-04 17:33:15 +01:00
Leonardo Di Giovanna e1637e484e feat(userspace/libsinsp): improve recvmsg SCM_RIGHTS cmsg handling
Parse all control messages instead of parsing just the first one.
Leverage the new scap_get_fdinfo API to get info only from the file
in procfs associated to the file descriptor, instead of scanning each
time the entire procfs fd directory.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Co-authored-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-02-04 16:29:14 +01:00
Leonardo Di Giovanna aadf3ccd83 feat(userspace/libscap): add API for getting single fd info
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-02-04 16:29:14 +01:00
Federico Di Pierro 5a0302c875 fix(userspace/libsinsp): do not immediately process async events whose timestamp is in the future in case a SCAP_TIMEOUT is received.
Instead, they'll be processed at the future time, as requested by the async event generator.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-31 10:09:51 +01:00
Adam Roberts 3476089033 fix(sinsp): guard against uninitialized use
Signed-off-by: Adam Roberts <4damRob3rts@gmail.com>
2025-01-29 09:02:37 +01:00
Jason Dellaluce 319409a4af fix(libsinsp): do not postpone observing fd erasing
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-01-28 15:42:34 +01:00
Federico Di Pierro ed95fff802 chore(driver): always initialize enum ppm_overlay.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-28 10:43:33 +01:00
Federico Di Pierro ccc3dbbe7f fix(driver): avoid crashing when an offline CPU prior to agent start, is hotplugged.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-28 10:43:33 +01:00
Grzegorz Nosek f0419d5c75 cleanup(sinsp): remove no longer necessary friend declarations
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 7d98d06de4 fix(sinsp): rename base_table::clear to clear_entries
Avoid a naming conflict with sinsp_thread_manager::clear.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 3671817441 fix(sinsp): add explicit instantiations for table_accessor::set
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 0dc54b5e45 cleanup(sinsp): move m_dynamic_fields to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 03c59a256f cleanup(sinsp): move iterate_entries to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 2dc7c44489 cleanup(sinsp): move create_table_entry to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 3f5cb2d771 cleanup(sinsp): move clear to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 2ee2bf2e2c cleanup(sinsp): move entries_count to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek b9193fa604 cleanup(sinsp): move get_entry to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek cd78569329 cleanup(sinsp): move m_static_fields to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek dffe6bc2cb cleanup(sinsp): move m_name to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 3d23849fb9 cleanup(sinsp): move m_this_ptr to built_in_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek b5d7cd573b new(sinsp)!: introduce a new C++ table api
The API defined by libsinsp::state::base_table is about to be
removed (moved to libsinsp::state::built_in_table), so we introduce
a new API that's available for every table (including plugin-provided
tables), using the plugin table API underneath.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek ae00703b98 cleanup(sinsp): rename typeinfo::index to type_id
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek ef96ad1a79 cleanup(sinsp): remove typeinfo::index_t
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 491bb51743 cleanup(sinsp): clean up includes in type_info.h
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 826121cd60 cleanup(sinsp): remove references to sinsp_table_wrapper
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 03a5a25da7 cleanup(sinsp): use sinsp_table_owner where we can
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 5e682b1851 cleanup(sinsp): introduce sinsp_table_owner
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 8a57795f5d cleanup(sinsp): rename sinsp_table_wrapper to table_accessor
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek ec98353f03 cleanup(sinsp): move sinsp_table_wrapper to state/table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek d32ca63ff4 cleanup(sinsp): move get_key_as_data impls to a single place
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek c4fa584cc1 cleanup(sinsp): remove now unused fields from sinsp_table_wrapper
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 10978c1f39 cleanup(sinsp): split write_entry_field across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 4bec9ff5c9 cleanup(sinsp): split read_entry_field across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 2b7d7c3650 cleanup(sinsp): split add_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek cbaa440c40 cleanup(sinsp): split destroy_table_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek e9ea82a313 cleanup(sinsp): split create_table_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 7df0099fa5 cleanup(sinsp): split erase_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek c34de7bbc6 cleanup(sinsp): split clear across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 56d241149f cleanup(sinsp): split iterate_entries across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 5c52e9c442 cleanup(sinsp): split release_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek a4b7246a02 cleanup(sinsp): split get_entry across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 45d14960a8 cleanup(sinsp): split get_name and get_size across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 866149a010 cleanup(sinsp): split add_field across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek f85b385ad2 cleanup(sinsp): split get_field across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek d3797c9d49 cleanup(sinsp): move sinsp_field_accessor_wrapper to libsinsp::state
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 4c5fdd5d54 cleanup(sinsp): split list_fields across table classes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 35ce400328 cleanup(sinsp): move m_field_list to base_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 81956cbe4b cleanup(sinsp): make m_last_owner_err public
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek acc2c3a491 cleanup(sinsp): introduce built_in_table
This is an intermediate class in the hierarchy, that built-in sinsp
tables will inherit from, but plugin-provided table wrappers won't.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 07ae98eb85 cleanup(sinsp): drop sinsp_table_wrapper.m_key_type
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek de3a2fc9cc cleanup(sinsp): prefer direct plugin vtable fields
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 341e15df1e cleanup(sinsp): fold update into set/unset
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
Grzegorz Nosek 27f424e974 cleanup(sinsp): fold sinsp_table_input into sinsp_table_wrapper
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2025-01-28 08:58:33 +01:00
dependabot[bot] 4efe074ed4 chore(deps): Bump codecov/codecov-action in the actions group
Bumps the actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `codecov/codecov-action` from 5.1.2 to 5.3.1
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](1e68e06f1d...13ce06bfc6)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 18:08:32 +01:00
dependabot[bot] 3253ace4ec chore(deps): Bump dawidd6/action-download-artifact from 7 to 8
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 7 to 8.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](80620a5d27...20319c5641)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 16:15:33 +01:00
Jason Dellaluce b30178700f fix(libsinsp/test): remove illegal threat manager memory access in plugin tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-01-24 16:26:14 +01:00
Jason Dellaluce 4bebaedeba fix(libsinsp): do not invalidate thread manager cache when using plugin state api
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2025-01-24 16:26:14 +01:00
Leonardo Di Giovanna 6c46ed3b7f feat: add events dimensions file generator in modern probe
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-01-21 12:09:01 +01:00
Andrea Terzolo 4bec535242 new: extend WRITE_X/PWRITE_X
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-20 20:08:49 +01:00
Angelo Puglisi cb3e5cf113 fix(driver): use configure system to check for mnt_idmap for fs
Kernel 6.3 changed fs functions to `struct mnt_idmap`.
Use the configure system in place of the version check to support driver
build on RHEL 9 (namely 5.14.0-547.el9.x86_64)

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2025-01-20 17:42:49 +01:00
Luca Guerra 02ac6f66b5 cleanup(libs): remove assert() that may trigger
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-20 15:08:49 +01:00
dependabot[bot] e17aca4a62 chore(deps): Bump the actions group with 4 updates
Bumps the actions group with 4 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [softprops/action-gh-release](https://github.com/softprops/action-gh-release), [codecov/codecov-action](https://github.com/codecov/codecov-action) and [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request).


Updates `actions/upload-artifact` from 4.4.3 to 4.6.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b4b15b8c7c...65c4c4a1dd)

Updates `softprops/action-gh-release` from 2.2.0 to 2.2.1
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](7b4da11513...c95fe14893)

Updates `codecov/codecov-action` from 5.1.1 to 5.1.2
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](7f8b4b4bde...1e68e06f1d)

Updates `peter-evans/create-pull-request` from 7.0.5 to 7.0.6
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](5e914681df...67ccf781d6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-20 14:37:48 +01:00
Roberto Scolaro e7a6a225c4 fix(libsinsp/runc): typo
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-20 12:47:48 +01:00
Roberto Scolaro 7e48bed19e fix(libsinsp/runc): augument containerd filter
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-20 11:55:48 +01:00
Roberto Scolaro ce530b524d fix(libsinsp): allow reading scap from stdin
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-20 10:22:47 +01:00
Federico Di Pierro cb93f4b3d7 chore(ci): switch to github-provided arm64 runners.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-17 10:15:32 +01:00
Leonardo Grasso f216920d75 docs(userspace/libsinsp/filter/parser): fix grammar doc
The spaces after the operator tokens were intended to indicate operators that mandate a whitespace character to be followed.

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-01-16 14:20:27 +01:00
Roberto Scolaro b0786f0032 chore(libsinsp/runc): report correct container id with short cid
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-16 13:34:27 +01:00
Leonardo Grasso 8e1b1a3dc7 docs(userspace/libsinsp/filter/parser): update grammar doc
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-01-16 13:15:27 +01:00
Roberto Scolaro bceb3b1d54 fix(libsinsp/container_engine/containerd): avoid cache confusion between containerd sockets
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-16 10:24:28 +01:00
Roberto Scolaro fffc42585a fix(libsinsp/runc): use old logic and fallback for containerd
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-16 10:24:28 +01:00
Roberto Scolaro 3b68c57691 feat(containers): add host-containerd socket
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-16 10:24:28 +01:00
Federico Di Pierro 5891ebdc6a fix(test/libsinsp_e2e): fixed tcp related libsinsp_e2e tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-15 13:10:50 +01:00
Federico Di Pierro d327a3b50e fix(driver/modern_bpf): lower sendmmsg and recvmmsg loop support to 8 to avoid limit size failures.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-14 16:32:46 +01:00
Andrea Terzolo 29b1bfc5fd fix: always initialize `peer_address` in the kmod
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-14 16:32:46 +01:00
Federico Di Pierro 08901d59a2 fix(driver): properly add back fallback to user data when peer socket data is missing.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-14 16:32:46 +01:00
Federico Di Pierro 12ccb73f74 fix(driver): round of small fixes and improvements around unix socket paths handling in drivers.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-14 16:32:46 +01:00
Roberto Scolaro 5a246640bd feat(libsinsp_e2e): add unix_udp_client_server_read test
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-14 16:32:46 +01:00
Federico Di Pierro 8362ae9893 fix(driver/modern_bpf): avoid `bpf_loop()` helper.
We can't use bpf_loop() helper since the `bpf_core_enum_value_exists` check
triggers a verifier failure on kernels prior to 5.13 that hadn't got `PTR_TO_FUNC` support.
See https://lore.kernel.org/bpf/CAGQdkDt9zyQwr5JyftXqL=OLKscNcqUtEteY4hvOkx2S4GdEkQ@mail.gmail.com/T/#u.

Instead, loop up to 16 messages.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 4f9be74442 feature(modern_bpf): add dynamic snaplen handling for recvmmsg/sendmmsg
A new argument had to be added to the apply_dynamic_snaplen function, I
opted for using an auxiliar struct and pass a single pointer to it to
the function. I think this is a bit cleaner, since removing or adding
other arguments can be done by simply adding it to the struct, keeping
the function signature unchanged.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 6553f8b744 chore(driver): Bump minor schema version
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 7f29e95783 chore(modern_bpf): add fields to enum bpf_func_id
The added fields were added in newer kernels and can be used to check
for access of some newer helpers.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 6271309774 feat(kmod): add arguments to recvmmsg and sendmmsg
The current implementation is not complete, only the first message is
processed. In order to allow for multiple messages to be processed the
kmod needs to allow for multiple headers to be added to the ringbuffer
from the filler.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 0b6a2a8250 feat(bpf): add arguments to recvmmsg and sendmmsg
Due to limitations with the verifier, it won't be possible to iterate
over all messages, so the implementation is best effort and only the
first message is actually processed.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio 5fb904cef9 feat(tests): add tests for recvmmsg and sendmmsg
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Mauro Ezequiel Moltrasio ffa00a5cd0 feat(modern_bpf): add arguments to recvmmsg and sendmmsg
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2025-01-14 08:25:44 +01:00
Federico Di Pierro 5952507ff7 chore(userspace/libsinsp): properly ASSERT callback parameters.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Federico Di Pierro 74b585a31d chore(userspace/libsinsp): avoid possible issues with references usage.
Moreover, improved sinsp_observer tests.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Federico Di Pierro b3d802a180 cleanup(userspace/libsinsp): drop hash_combine function.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Federico Di Pierro 8398e680b2 chore(userspace/libsinsp): add small test around sinsp_observer.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Federico Di Pierro ee03c0be62 cleanup(userspace/libsinsp): completely drop `m_program_hash` and `m_program_hashscript` fields from threadinfo.
They are unused and can be eventually directly implemented by consumers, if needed.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Federico Di Pierro bacb5e6c18 cleanup(userspace/libsinsp): avoid calling sinsp_observer methods inline during parsing.
Instead, push them onto a queue owned by the inspector to be later called,
1 by 1, as requested.

This ensures that the whole libsinsp state has been processed,
even by plugins, before sinsp_observer methods are called.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-13 18:12:40 +01:00
Lorenzo Susini 431ba43ecf test(userspace/libsinsp): test proc.ppid and proc.apid[1] when parent is thread
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2025-01-13 16:16:40 +01:00
Lorenzo Susini 1f14fe0ccf test(userspace/libsinsp): test new threadinfo api get_ancestor_process
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2025-01-13 16:16:40 +01:00
Luca Guerra d1d6d847d8 fix(libsinsp): update field descriptions
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-13 16:16:40 +01:00
Luca Guerra ad4ab120fc fix(build): update build flags
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-13 16:16:40 +01:00
Luca Guerra c8a331686f fix(libsinsp/tests): remove incorrect tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-13 16:16:40 +01:00
Luca Guerra 6872415ec1 fix(libsinsp): make proc.pX behave like proc.aX[1]
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-13 16:16:40 +01:00
Andrea Terzolo be080b5af1 fix(driver): add a check on the SCHEMA version compatibility
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-13 13:24:39 +01:00
Roberto Scolaro bd0bb9baf2 chore(libsinsp): substitute class with namespace
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro 8d60b8d0f4 chore(libsinsp): remove unused function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro 8f4dcf9692 refactor(libsinsp): make base transform class pure virtual
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro 983ce5d422 refactor(libsinsp): move transformers in differnt files
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro db715aff31 chore(libsinsp): rename transformers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro fff1a79f28 refactor(libsinp): refactor filter transformers to use interfaces
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-09 10:16:45 +01:00
Roberto Scolaro f535e225ad fix(libsinsp): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro b140f1368a chore(test/libsinsp_e2e): rename before_close to after_capture
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro afbe598395 fix(libsinsp/runc): avoid throwing exception in case of short container id
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro d59a637a43 refactor(libsinsp/container_engine): drop request_rw_size
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 52d8ad28d2 chore(libsinsp): add some comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 1a6b3725ef fix(libsinsp/container): don't add cri sockets to CT_CONTAINERD type
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 1abf87a6f8 refactor(libsinsp/cmake): rearrenge cri grpc generation function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 615c0f7fec fix(libsinsp): fix containerd proto compilation
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 0f6c4f9ffc feat(libsinsp/container_engine/containerd): support image digest retrival
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 14078d1c25 chore(libsinsp): fix linking issue
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 33e05fbbed feat(libsinsp): enable async containerd metadata retrival
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro bd5dd02375 feat(libsinsp_e2e): more granular test settings
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 777136ba3f fix(libsinp): enable multi cri caching + tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Roberto Scolaro 1fe9a1fd96 feat(libsinsp): add support for containerd interface
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2025-01-08 16:22:41 +01:00
Luca Guerra 385822dbab update(cmake): update libelf repo location and revision
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-01-08 09:47:41 +01:00
Andrea Terzolo e111e4302c cleanup: avoid including libscap/strl.h in connect_x
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-07 20:37:36 +01:00
Andrea Terzolo 258b4b4d13 update(driver): take the unix path directly from the kernel
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-07 15:55:35 +01:00
Andrea Terzolo 4a8fd3c772 fix(modern): move args declaration at the beginning
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2025-01-07 15:53:35 +01:00
Federico Aponte 63f9cfbbd8 fix: dangling pointer and mixed-signedness warning
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2025-01-07 10:21:34 +01:00
FedeDP d1881b4ce9 update(driver): update syscalls tables and driver report.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-02 13:00:07 +01:00
Federico Di Pierro 16ece2c90e chore(ci): bump zig version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2025-01-02 11:43:06 +01:00
Luca Guerra 9e08d7ed97 update(libsinsp/tests): add test for string filter formats
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-12-30 12:07:49 +01:00
Luca Guerra 81dad69d9d fix(libsinsp): do not reformat input buffer strings while applying arg filters
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-12-30 12:07:49 +01:00
Dmitrii Dolgov 615ecfb891 Keep event thread after execve
Currently when a thread from a thread group is doing execve, we expect
that the kernel will reassign its tid at the end to the group leader,
and simulate this behavior in the parser accordingly. The final result
is all the threads in the thread group, except the leader, are removed
from the cache.

But looks like under certain circumstances it's possible to end up in a
situation when the kernel is not doing the reassignment, yet the syscall
ends successfully. This leads to a crash, since the parser removes the
thread associated with the execve_x event, which will be accessed later
during post processing -- and everything is expose in use-after-free.
It's hard to reproduce artificially, but there are crash reports from
the field, demonstrating the problem and confirming the patch fixes the
crash. So far the issue was discovered only on ppc64le (Power10 to be
more precise).

To handle this, keep the event thread in place. Note, that tid here
comes from the BPF probe directly, where it's captured via
bpf_get_current_task/_btf. This means that the tid is the one really
reported by the kernel, so keeping it represents the current state
precisely.

Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
2024-12-30 10:41:49 +01:00
Luca Guerra 7b9e76f54e cleanup(libsinsp): remove assert that may trigger under normal circumstances
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-12-20 18:50:55 +01:00
Leonardo Grasso 4eb67f0f50 chore(userspace/libsinsp): cleanup accessors for single CRI unix socket path
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-12-20 11:36:54 +01:00
Leonardo Grasso 0a483af79a update(userspace/libsinsp): sinsp_container_manager can now handle multiple CRI engines simultaneously
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-12-20 11:36:54 +01:00
Leonardo Grasso 3c4a820aba refactor(userspace/libsinsp): make container_engine::cri handle only one CRI path
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-12-20 11:36:54 +01:00
Leonardo Di Giovanna 5b95bc8736 new: make ACCEPT_{E,X} and ACCEPT_5_E converter-managed
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-20 08:43:53 +01:00
Federico Di Pierro 69cfe47bc4 fix(ci): run apt-get update in coverage ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-19 16:29:50 +01:00
Leonardo Di Giovanna aad67bc186 new: extend LISTEN_X
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-19 15:32:50 +01:00
Andrea Terzolo b15675b329 new: extend SOCKET_X
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-18 20:29:45 +01:00
Leonardo Di Giovanna 199a439e88 new: extend BIND_X
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-18 10:38:43 +01:00
Federico Di Pierro 2412ad8f4d chore(userspace/libsinsp): move user group manager on container_id changed refresh to a RAII object.
Also, avoid subscribing to container manager "container removed" callback;
instead, use same RAII object to check whether init pid for the container did exit.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-18 10:35:43 +01:00
Andrea Terzolo 9ee57c8d58 cleanup: remove some duplicate code
since write has the EF_USES_FLAG, we call `set_fd_info` in
`sinsp_parser::reset`

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-17 10:46:38 +01:00
Andrea Terzolo 2574cc6c43 tests: add test for exit events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-17 10:46:38 +01:00
Andrea Terzolo e89dd11e87 update: use fd in the exit event if available
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-17 10:46:38 +01:00
Andrea Terzolo c438eb0f83 fix(converter): always process enter events like in live captures
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-17 10:46:38 +01:00
Andrea Terzolo 204a0d7cd8 fix(sinsp): don't skip event reset for exit events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-17 10:46:38 +01:00
dependabot[bot] e5f2db8f13 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [mozilla-actions/sccache-action](https://github.com/mozilla-actions/sccache-action) and [softprops/action-gh-release](https://github.com/softprops/action-gh-release).


Updates `mozilla-actions/sccache-action` from 0.0.6 to 0.0.7
- [Release notes](https://github.com/mozilla-actions/sccache-action/releases)
- [Commits](9e326ebed9...054db53350)

Updates `softprops/action-gh-release` from 2.1.0 to 2.2.0
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](01570a1f39...7b4da11513)

---
updated-dependencies:
- dependency-name: mozilla-actions/sccache-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 15:14:34 +01:00
Andrea Terzolo 0bdee92186 chore: use ubuntu-22.04
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-16 11:30:32 +01:00
Leonardo Di Giovanna 381c862e38 chore: bump schema version
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-16 10:51:32 +01:00
Leonardo Di Giovanna 19e64eb33c feat(userspace): add `gid` field parsing support for exec* family
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-16 10:51:32 +01:00
Leonardo Di Giovanna ddda902488 feat(drivers): add `gid` field for exec* family
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-16 10:51:32 +01:00
Federico Di Pierro 3126a97bc7 cleanup(userspace): move NOMINMAX definition at compile time for windows buils.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-16 09:35:32 +01:00
Federico Aponte 07a16e9a0c fix: some issues with Clang 18
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-12-13 18:17:18 +01:00
Luca Guerra 34cbe7ed98 update(libscap): use ELF_C_READ_MMAP_PRIVATE if available
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-12-13 14:15:18 +01:00
Luca Guerra cc89773e1f update(build): use elftoolchain/libelf from fork instead of elfutils/libelf
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-12-13 14:15:18 +01:00
Gianmatteo Palmieri 9e3fb93a36 fix(libsinsp): enable metrics collector on all platforms
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-12-12 14:49:13 +01:00
Federico Di Pierro c17f533574 fix(userspace/libsinsp): use `comm` file instead of `status` to get proc comm.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: <andreaterzolo3@gmail.com>
2024-12-12 14:46:13 +01:00
Andrea Terzolo 0b5ccc0a23 chore: update pre-commit stages
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-11 18:03:08 +01:00
Leonardo Di Giovanna 0fd43cbb09 feat(sinsp/threadinfo): expose thread uid and gid as static fields
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2024-12-11 09:51:07 +01:00
dependabot[bot] 1cb5ce35fd chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/cache](https://github.com/actions/cache) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `actions/cache` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](6849a64899...1bd1e32a3b)

Updates `codecov/codecov-action` from 5.0.7 to 5.1.1
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](015f24e681...7f8b4b4bde)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 09:38:07 +01:00
Federico Di Pierro 230ddfb91d cleanup(userspace/libsinsp): drop sinsp `m_suppressed_comms` unused field.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-09 15:52:57 +01:00
Federico Di Pierro 4462fee5d3 fix(userspace/libsinsp): always initialize sinsp_evt with a proper source_idx and source_name.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-09 14:05:57 +01:00
Andrea Terzolo 0b53bd7288 chore: fix windows build
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-06 17:31:47 +01:00
Andrea Terzolo c5a3422b8e cleanup: remove some extra code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-06 12:19:45 +01:00
Andrea Terzolo 7f160ac151 cleanup: refuse `EF_LARGE_PAYLOAD` events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 14af8c804c fix(ci): fix windows CI
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 9667562277 updare: don't use designated initializers
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 09fce6d95b fix(ci): fix CI errors with GNU 8.3.0
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 5c7d1b226e new(tests): add some tests for scap-file conversion
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo be8b242f11 update: introduce scap-file conversion in savefile engine
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 104c8c874c update: print hex representation for bytebuf
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo d4e1214b7a update(tests): adapt old scap-file tests
We cannot rely anymore on the event number to search an event since we
could filter some enter events in the middle

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo d8b043e4e2 update(tests): update some sinsp tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 777575e9e2 new: add READ_X/PREAD_X conversion
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 42a35ab738 new: extend READ_X/PREAD_X
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:38:39 +01:00
Andrea Terzolo 7dcb01f732 new(sinsp-example): add gvisor support
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-05 10:05:38 +01:00
Jason Dellaluce 9bf94631c3 test(libsinsp): improve whitespace coverage tests for filter parser
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-12-04 19:24:35 +01:00
Jason Dellaluce e4a34d8c2b update(libsinsp/filter): parse wider whitespace combinations in filter expressions
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-12-04 19:24:35 +01:00
Andrea Terzolo be9c2de281 revert(tests): fix emscripten build
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-04 17:35:35 +01:00
Federico Di Pierro 82f0d4b88c chore(userspace/libsinsp): move `sinsp_evt_filter` definition to sinsp.cpp.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-12-04 13:37:34 +01:00
Federico Di Pierro c5b5432a3c fix(userspace/libsinsp): let plugins parse events before eventually filtering them out through inspector global filter.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-04 13:37:34 +01:00
Federico Di Pierro 65ee768837 new(userspace/libsinsp): support plugins in sinsp-example.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-04 13:12:34 +01:00
Andrea Terzolo 556d86891a new(tests): introduce a new test helper
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-04 11:31:34 +01:00
Andrea Terzolo 4286d3cf9f cleanup(sinsp): remove some duplicated code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-12-04 11:24:33 +01:00
dependabot[bot] f4a7bb5487 chore(deps): Bump dawidd6/action-download-artifact from 6 to 7
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 6 to 7.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](bf251b5aa9...80620a5d27)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-03 10:32:26 +01:00
Federico Di Pierro 12c8b09a4c fix(userspace/libsinsp): get_user() and get_loginuser() need different static pointer.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-02 18:06:23 +01:00
Federico Di Pierro a36c9ec4b4 cleanup(userspace/libsinsp): clean up unused boolean flag in user group manager.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-02 18:06:23 +01:00
Federico Di Pierro 804c8445af chore(userspace/libsinsp): added filtercheck user tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-02 18:06:23 +01:00
Federico Di Pierro 226ece5fb3 fix(userspace/libsinsp): fixed uid 0 and gid 0 default values.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-12-02 18:06:23 +01:00
Federico Di Pierro 1c4698b6b4 chore(userspace/libsinsp): address review comments.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-29 15:47:04 +01:00
Federico Di Pierro 2c6e763711 fix(userspace/libsinsp): minimize master changes to preserve same behavior.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:47:04 +01:00
Federico Di Pierro 417e523399 cleanup(userspace/libsinsp): drop user and group infos embedded in threadinfo.
Only store `uid`, `gid` and `loginuid` info.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:47:04 +01:00
Federico Di Pierro bb27230c08 fix(userspace/libsinsp): address review comments.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 14dd3dff16 chore(userspace/libsinsp): call plugin dump API from `fdopen` too.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro fa24377375 new(userspace): `dump` API now takes a `ss_plugin_async_event_handler_t` callback.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 9a6726b10d chore(userspace/libsinsp): fixed comment string.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 4723df488a chore(userspace/libsinsp): disable plugin_dump test on emscripten.
Other tests using no_driver engine and async plugin are also disabled on it.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 26a595907a new(userspace): moved `dump` API under async capability.
We now expect `PPME_ASYNCEVENT_E` whose `name` matches one of the
plugin supported ones (get_async_events() API).

The new API is not required for async capability.

Added also a test.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 3215d5e142 chore(userspace/plugin): bumped plugin API version to 3.10.0
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Federico Di Pierro 74d0ec44ab new(userspace): added new plugin API capability to dump plugin state.
Also, ASYNCEVENT_E will not be correctly pre-parsed at init time while reading from captures.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 15:27:04 +01:00
Andrea Terzolo 5094053c30 cleanup: address review comments
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-29 14:54:05 +01:00
Andrea Terzolo bcd89655b5 new(converter): add the scap file converter
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-29 14:54:05 +01:00
Andrea Terzolo 60bab3de56 new(scap): create some helpers method for the converter
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-29 14:54:05 +01:00
Federico Di Pierro a339e9de68 chore(ci): run code coverage job on ubuntu runner.
Also, drop some useless git safe directory set.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-27 15:46:54 +01:00
dependabot[bot] 321e4aa623 chore(deps): Bump codecov/codecov-action from 4.6.0 to 5.0.7
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](b9fd7d16f6...015f24e681)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-27 15:46:54 +01:00
dependabot[bot] 9b649a7e3b chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [appleboy/ssh-action](https://github.com/appleboy/ssh-action) and [softprops/action-gh-release](https://github.com/softprops/action-gh-release).


Updates `appleboy/ssh-action` from 1.1.0 to 1.2.0
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](25ce8cbbcb...7eaf76671a)

Updates `softprops/action-gh-release` from 2.0.9 to 2.1.0
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](e7a8f85e1c...01570a1f39)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-27 12:01:53 +01:00
Andrea Terzolo a99a36573f chore: install bpftool manually
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-26 22:57:50 +01:00
Andrea Terzolo 461039f1bb cleanup: rename some methods/maps
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-26 22:57:50 +01:00
Andrea Terzolo 53b7ce3bd0 cleanup: move custom tail calls in sys_exit
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-26 22:57:50 +01:00
Andrea Terzolo 5d641db82e cleanup: remove an unused header
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-26 22:57:50 +01:00
Andrea Terzolo 23aa5acad8 fix: split sampling logic between enter and exit
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-26 22:57:50 +01:00
Roberto Scolaro eb4990c771 fix(libsinsp/test): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-26 16:57:48 +01:00
Roberto Scolaro ec67447a54 fix(libsinsp): don't filter out procexit events
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-26 16:57:48 +01:00
Andrea Terzolo 55ff79f882 cleanup(sinsp): handle path too long in a better way
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-25 17:13:42 +01:00
Lorenzo Susini 365f1aacf1 update: introduce a description to sinsp_filter_transformer
Co-authored-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-11-25 13:33:40 +01:00
Andrea Terzolo 2e1c5b6838 cleanup(sinsp): remove some duplicated code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-22 11:44:27 +01:00
Angelo Puglisi bb7cf062a5 chore(libsinsp): reduce max proc lookup number log severity
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-11-20 12:58:18 +01:00
Angelo Puglisi 512f9b7fd3 fix(libsinsp): max proc lookup number logging
m_n_proc_lookups was incremented before doing the proc lookup, causing
<Reached max process lookup number, duration=0ms> logs when max is
configured to 1.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-11-19 18:25:18 +01:00
Andrea Terzolo facfcc3e59 ci: disable a flaky test
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-12 15:03:47 +01:00
dependabot[bot] 5ba2918fb1 chore(deps): Bump softprops/action-gh-release in the actions group
Bumps the actions group with 1 update: [softprops/action-gh-release](https://github.com/softprops/action-gh-release).


Updates `softprops/action-gh-release` from 2.0.8 to 2.0.9
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](c062e08bd5...e7a8f85e1c)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 16:56:42 +01:00
Andrea Terzolo 0e177db2dd cleanup: inline some methods
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 7cb90b6387 fix: use `get_syscall_return_value` when allowed
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo a5a387a692 cleanup: use exception instead of assertion
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 68856b01c1 cleanup: remove duplicated logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo f11f920664 cleanup: rewrite `extract_error_count` using new logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 9b250c25d8 cleanup: use the new `get_syscall_return_value`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 4b731f13c5 new: add a new helper in sinsp
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 94a54341ea new: add a new helper in scap
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Andrea Terzolo 1275be3a27 new: add a new helper method `has_return_value`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 17:21:29 +01:00
Roberto Scolaro aeea096881 fix(libsinsp/dns-manager): always include tbb
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-08 15:27:28 +01:00
Roberto Scolaro 92ac60c63f fix(deps): bump tbb and enable its compilation with emscripten
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-08 15:27:28 +01:00
Andrea Terzolo 10d5968225 cleanup: rename a method
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 12:44:28 +01:00
Andrea Terzolo eb77f2a99f cleanup: remove no more used method
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 12:44:28 +01:00
Andrea Terzolo d86ea7b1fe cleanup: remove last usage of `extract_from_null_fd`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 12:44:28 +01:00
Andrea Terzolo d71fbd2e08 cleanup: avoid `extract_from_null_fd` where not needed
Use directly `extract_fdname_from_creator`, see next commits for a
further cleanup

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 12:44:28 +01:00
Andrea Terzolo 4229a9ba94 cleanup: remove unused param
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 12:44:28 +01:00
Andrea Terzolo 75133a657c cleanup(tests): improve test stability
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 1c4ee0ef7b cleanup: remove `ctx`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo df962ed1eb cleanup: don't initialize enums if not needed
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 1ec861119c cleanup: rename some methods
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 6b08736697 update: set sched_switch as UF_ALWAYS_DROP
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 4b2cceddc2 cleanup: simplify droppping logic for tracepoint
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 65a4d32ed3 cleanup: move `hotplug` logic into sys_exit
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo e6f5352805 cleanup: move `sched_p_fork` tail calls
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Andrea Terzolo 76d8373acb cleanup: move `sched_p_exec` tail calls
With this new approach the tail calls are only visible inside the
sched_proc_exec file.

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-08 09:09:27 +01:00
Roberto Scolaro dd8d5083e9 fix(libsinsp/test): fix async_key_value_source flakiness
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-07 18:26:25 +01:00
Roberto Scolaro 34a6c0d2e9 chore(libsinsp): avoid useless allocation
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-11-07 18:26:25 +01:00
Andrea Terzolo ded875b1ab update(sinsp) handle ` (deleted)` in userspace
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-07 14:55:24 +01:00
Andrea Terzolo d79b34d808 update(kmod): remove " (deleted)" handling
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-07 14:55:24 +01:00
Andrea Terzolo 39c0e0dcb9 chore(e2e): fix e2e build without bundled deps
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-05 18:09:11 +01:00
Federico Aponte f500086484 chore: cleanup CMake dependencies
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-11-05 16:11:11 +01:00
Andrea Terzolo 13403215d3 cleanup(tests): add some exception in sinsp test framework
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-11-05 15:32:10 +01:00
Federico Di Pierro 41e4444904 new(userspace/libsinsp): expose `get_owner_last_error` in plugin's capture listening capability.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-05 11:38:09 +01:00
dependabot[bot] f82c68636e chore(deps): Bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](de2c0eb89a...c062e08bd5)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 14:28:04 +01:00
Holger Hoffstätte d7daa63892 fix(driver): include jiffies.h to prevent warning about missing prototype
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2024-11-04 10:51:03 +01:00
Luca Guerra 5f32757478 update(libsinsp): empty transformer storage before filling len()
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Luca Guerra ecf46c0532 update(libsinsp/tests): rewrite transformer test to test list/nonlist cases
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Luca Guerra ce5b4f28ed update(libsinsp): address review, comment, allow t(list) = (t(list[0]), t(list[i]))...
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Luca Guerra 2a244fc4b2 Update userspace/libsinsp/sinsp_filter_transformer.cpp
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Luca Guerra 5664c89774 new(libsinsp/tests): add tests for len() filter transformer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Luca Guerra 68f8121234 new(libsinsp): add len() filter transformer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-31 17:21:42 +01:00
Andrea Terzolo 4d04cad02c cleanup: improve perf `populate_cmdline`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-31 10:14:40 +01:00
Federico Di Pierro 15e24ae7e1 fix(userspace/libsinsp): multiple fixes related to rawargs.
Firstly, properly refresh m_arginfo and m_customfield type and print format
given current event while extracting rawarg values.

Secondly, propelry support PT_FLAGS, PT_ENUMFLAGS, PT_GID and PT_UID types in `rawval_to_json` and `rawval_to_string`.

Lastly, honor PF_HEX print format for 8,16,32bits types.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-30 17:04:38 +01:00
Gianmatteo Palmieri 701e9914b0 fix(libsinsp): expose main thread fd table
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-10-30 09:24:36 +01:00
Gianmatteo Palmieri 0ec8bac857 fix(libsinsp): invalid field_info check
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-10-29 18:01:33 +01:00
dependabot[bot] b4ca436411 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/cache](https://github.com/actions/cache) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/checkout` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](eef61447b9...11bd71901b)

Updates `actions/cache` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](3624ceb22c...6849a64899)

Updates `actions/setup-python` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](f677139bbe...0b93645e9f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-29 14:05:33 +01:00
Federico Di Pierro b296470df4 chore(test/libsinsp_e2e): try to increase sleep time to fix CI on new arm64 runners.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-29 11:17:33 +01:00
Federico Di Pierro 8df7587a09 update(ci): use cncf provided self hosted runners for arm64.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-29 11:17:33 +01:00
Roberto Scolaro d87c96b505 fix(libsinsp): use correct regex for hex numbers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-23 18:16:09 +02:00
Federico Di Pierro b9302048b7 chore(ci): increase timeout to 5minutes for driverkit build in latest-kernel workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 14:16:04 +02:00
Federico Di Pierro 60782554c9 fix(ci): use local zig folder instead of `/usr/local`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 14:16:04 +02:00
Federico Di Pierro 6322a024cc fix(cmake): avoid passing TBB_FLAGS as double quoted, double quoted string.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:19:04 +02:00
Federico Di Pierro 9906a3ea2d fix(ci): fixed create-comment-kernel-testing typo.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:19:04 +02:00
Federico Di Pierro 06239e6e0f chore(ci): bump zig version and improve install-zig action.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:19:04 +02:00
Federico Di Pierro d8ca259e1f chore(userpace/libsinsp): rename `pair.{first,second}` to just `first` and `second`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:02:04 +02:00
Federico Di Pierro b92e4a91c8 chore(userspace/libsinsp): avoid defining new value type.
Instead, rely on a new table entry adapter, `pair_table_entry_adapter`.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:02:04 +02:00
Federico Di Pierro 7786ddb17e chore(userspace/libsinsp): do not return pointers to stack allocated pair_t values.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:02:04 +02:00
Federico Di Pierro 2d4d8d099d new(userspace,test): expose `threadinfo::m_cgroups` to plugin state table API.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-22 12:02:04 +02:00
dependabot[bot] 90c1520c24 chore(deps): Bump uraimo/run-on-arch-action in the actions group
Bumps the actions group with 1 update: [uraimo/run-on-arch-action](https://github.com/uraimo/run-on-arch-action).


Updates `uraimo/run-on-arch-action` from 2.7.2 to 2.8.1
- [Release notes](https://github.com/uraimo/run-on-arch-action/releases)
- [Commits](b0ffb25eb0...5397f9e30a)

---
updated-dependencies:
- dependency-name: uraimo/run-on-arch-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 18:11:00 +02:00
Federico Di Pierro 509bec5de9 fix(ci): create-comment workflows array length check.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 16:57:59 +02:00
Federico Di Pierro bf7828cdd1 cleanup(userspace/libsinsp): drop plugin-specific `suggested_output_formats` API.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-10-21 16:47:59 +02:00
Federico Di Pierro d8c8df8730 chore(userspace/libsinsp): add `EPF_FORMAT_SUGGESTED` filtercheck_field flag.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-10-21 16:47:59 +02:00
Federico Di Pierro b70d0cd01f new(userspace): added new `addOutput` json entry for plugin `get_field()` API.
It suggests to Falco that some fields should be enforced to
all compatible sources output.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 16:47:59 +02:00
Federico Di Pierro f74a4582c4 fix(ci): use `process.exit();` to leave node script in github/action-script.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 15:57:59 +02:00
Federico Di Pierro 3216d09cc2 fix(ci): fixed create-comment-perf workflow when perf CI does not run.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 09:48:58 +02:00
Federico Di Pierro 7d82c99825 fix(ci): fixed create-comment-kernel-testing workflow when kernel-testing CI does not run.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 09:48:58 +02:00
Federico Di Pierro fedfec37fd fix(ci): fixed latest-kernel CI usage of steps/jobs outputs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-21 09:47:59 +02:00
Lorenzo Susini 4403a842c0 chore: address review comments
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini a21525840b format: apply clang format to new container field impl
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini cad87ff9e7 test(userspace/libsinsp): test CRI namespace information parsing
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini 3008d017ac update(userspace/libsinsp): parse and expose namespace info
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini 7b66bc2708 update(userspace/libsinsp): retrieve network,pid,ipc namespace information from CRI runtimes
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini 8db49d3b52 update(userspace/libsinsp): retrieve network,pid,ipc namespace information from docker socket
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Lorenzo Susini cba2ca28dc update(userspace/libsinsp): add network,pid,ipc namespace information to container_info
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-10-18 15:12:48 +02:00
Andrea Terzolo 81776411bc fix(modern): check `cred` field is not NULL before the access
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-17 14:50:43 +02:00
Angelo Puglisi d8d345a4c9 fix(userspace/libsinsp): stringop-overflow on libvirt_lxc
Building with Red Hat g++ 11.2.1-9 we get the following error on string
assignment:
```
[ 34%] Building CXX object libsinsp/CMakeFiles/sinsp.dir/container_engine/libvirt_lxc.cpp.o
In file included from /opt/rh/devtoolset-11/root/usr/include/c++/11/ios:40,
                 from /opt/rh/devtoolset-11/root/usr/include/c++/11/ostream:38,
                 from /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/unique_ptr.h:42,
                 from /opt/rh/devtoolset-11/root/usr/include/c++/11/memory:76,
                 from /code/agent/deps/agent-libs/userspace/libsinsp/container_engine/container_engine_base.h:21,
                 from /code/agent/deps/agent-libs/userspace/libsinsp/container_engine/libvirt_lxc.h:24,
                 from /code/agent/deps/agent-libs/userspace/libsinsp/container_engine/libvirt_lxc.cpp:19:
In static member function 'static constexpr std::char_traits<char>::char_type* std::char_traits<char>::copy(std::char_traits<char>::char_type*, const char_type*, std::size_t)',
    inlined from 'static void std::basic_string<_CharT, _Traits, _Alloc>::_M_copy(_CharT*, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/basic_string.h:3464:21,
    inlined from 'std::basic_string<_CharT, _Traits, _Allocator>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/basic_string.tcc:701:13,
    inlined from 'std::basic_string<_CharT, _Traits, _Allocator>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/basic_string.tcc:689:5,
    inlined from 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/basic_string.h:4461:21,
    inlined from 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/devtoolset-11/root/usr/include/c++/11/bits/basic_string.h:3784:28,
    inlined from 'bool libsinsp::container_engine::libvirt_lxc::match(sinsp_threadinfo*, sinsp_container_info&)' at /code/agent/deps/agent-libs/userspace/libsinsp/container_engine/libvirt_lxc.cpp:51:17:
/opt/rh/devtoolset-11/root/usr/include/c++/11/bits/char_traits.h:437:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing 14 bytes into a region of size 7 overflows the destination [-Werror=stringop-overflow=]
  437 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
```

Let's just do a single assignment, and avoid eventual resize.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-10-16 12:36:37 +02:00
Federico Di Pierro 138e70ef63 new(ci): run latest-kernel CI against arm64 too.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-16 12:34:37 +02:00
Federico Di Pierro 85ec7065ab fix(driver/bpf): fixed a typo in old ebpf probe code for linux >= 6.11.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-16 12:34:37 +02:00
Wiktor Gołgowski c082ec30da fix(userspace/libsinsp): disable HTTP proxy for CRI connection
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2024-10-15 16:31:36 +02:00
dependabot[bot] 86bfd266d6 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `actions/upload-artifact` from 4.4.2 to 4.4.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](84480863f2...b4b15b8c7c)

Updates `codecov/codecov-action` from 4.5.0 to 4.6.0
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](e28ff129e5...b9fd7d16f6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-15 16:16:37 +02:00
Federico Di Pierro c49225da50 fix(userspace/libscap): scap-gvisor does need to depend upon jsoncpp.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-15 11:50:36 +02:00
Federico Di Pierro 3b80aa0a09 chore(ci): bump actions/download-artifact to latest release (v4.1.8).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-10 16:27:18 +02:00
Federico Di Pierro 95a62fd53f fix(ci): fixed build-scap-open-w-extern-bpf-skeleton: we do not rely on centos7 anymore.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-10 16:27:18 +02:00
Federico Di Pierro 6d2bec36b4 fix(ci): fix kernel testing action by using proper tag name.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-10 14:30:18 +02:00
dependabot[bot] 06ab7c43c5 chore(deps): Bump actions/checkout from 3.6.0 to 4.2.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.6.0...eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 10:36:17 +02:00
dependabot[bot] 56d621eb24 chore(deps): Bump actions/upload-artifact from 3.1.3 to 4.4.2
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.3 to 4.4.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3.1.3...84480863f228bb9747b473957fcc9e309aa96097)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 10:35:17 +02:00
dependabot[bot] fa0e07295a chore(deps): Bump actions/deploy-pages from 2.0.4 to 4.0.5
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 2.0.4 to 4.0.5.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](9dbe382482...d6db90164a)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 10:34:17 +02:00
dependabot[bot] 899161bb5d chore(deps): Bump peter-evans/create-pull-request from 5.0.2 to 7.0.5
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.2 to 7.0.5.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](153407881e...5e914681df)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 10:33:17 +02:00
dependabot[bot] 9513ceaa2a chore(deps): Bump actions/upload-pages-artifact from 2.0.0 to 3.0.1
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 2.0.0 to 3.0.1.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](a753861a5d...56afc609e7)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:14:17 +02:00
dependabot[bot] 2e69c093a7 chore(deps): Bump actions/setup-python from 4.7.1 to 5.2.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.7.1 to 5.2.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](65d7f2d534...f677139bbe)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:13:18 +02:00
dependabot[bot] 730f877d7c chore(deps): Bump dorny/paths-filter from 2.11.1 to 3.0.2
Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from 2.11.1 to 3.0.2.
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](4512585405...de90cc6fb3)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:12:17 +02:00
dependabot[bot] 7d86bfb9a5 chore(deps): Bump codecov/codecov-action
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 79066c46f8dcdf8d7355f820dbac958c5b4cb9d3 to e28ff129e5465c2c0dcc6f003fc735cb6ae0c673.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](79066c46f8...e28ff129e5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:10:18 +02:00
dependabot[bot] a5b7b9263f chore(deps): Bump the actions group with 5 updates
Bumps the actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [mshick/add-pr-comment](https://github.com/mshick/add-pr-comment) | `2.8.1` | `2.8.2` |
| [appleboy/ssh-action](https://github.com/appleboy/ssh-action) | `1.0.3` | `1.1.0` |
| [uraimo/run-on-arch-action](https://github.com/uraimo/run-on-arch-action) | `2.5.1` | `2.7.2` |
| [mozilla-actions/sccache-action](https://github.com/mozilla-actions/sccache-action) | `0.0.4` | `0.0.6` |
| [actions/cache](https://github.com/actions/cache) | `4.0.2` | `4.1.1` |


Updates `mshick/add-pr-comment` from 2.8.1 to 2.8.2
- [Release notes](https://github.com/mshick/add-pr-comment/releases)
- [Commits](7c0890544f...b8f338c590)

Updates `appleboy/ssh-action` from 1.0.3 to 1.1.0
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](029f5b4aee...25ce8cbbcb)

Updates `uraimo/run-on-arch-action` from 2.5.1 to 2.7.2
- [Release notes](https://github.com/uraimo/run-on-arch-action/releases)
- [Commits](4ed76f16f0...b0ffb25eb0)

Updates `mozilla-actions/sccache-action` from 0.0.4 to 0.0.6
- [Release notes](https://github.com/mozilla-actions/sccache-action/releases)
- [Commits](2e7f9ec792...9e326ebed9)

Updates `actions/cache` from 4.0.2 to 4.1.1
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c45773b62...3624ceb22c)

---
updated-dependencies:
- dependency-name: mshick/add-pr-comment
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: uraimo/run-on-arch-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: mozilla-actions/sccache-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:08:18 +02:00
Gianmatteo Palmieri 6a586d7ba2 fix(tests): flaky thread pool tests
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-10-09 18:14:14 +02:00
Andrea Terzolo cfd262ec13 cleanup: remove some commits from the blame
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-09 18:08:15 +02:00
cpanato e117af43d3 add initial dependabot config for gh actions
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-10-09 16:59:14 +02:00
cpanato 62fc0fe625 clean up and update ci
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-10-09 16:59:14 +02:00
Roberto Scolaro 371271461b fix(libsinsp_e2e): filter using tid
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
Roberto Scolaro e15d95639a fix(libsinsp_e2e): restore docker socket path after test
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
Roberto Scolaro 31effd860a chore: code formatting
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
Roberto Scolaro c9ec1ccfe7 chore(libsinsp_e2e): drop python2
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
Roberto Scolaro bd390ce1e6 fix(libsinsp_e2e): remove user and group after test
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
therealbobo fde264b4e0 new(test/libsinsp_e2e): add container cri tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-10-08 12:54:09 +02:00
albe19029 973797e32e Fix sys_poll_x on fedora 40
Signed-off-by: albe19029 <103380736+albe19029@users.noreply.github.com>
2024-10-08 12:33:08 +02:00
Federico Di Pierro 2b1e402213 fix(test/libsinsp_e2e): make container_clone_nspid related tests more reliable.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 03f1d30190 chore(test/libsinsp_e2e): improve test reliability.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 634af98cb5 fix(test/libsinsp_e2e): avoid possible heap use after free.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro c8e561895f chore(test/libsinsp_e2e): enlarge drivers' buffer size to avoid event losses.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 132c93ff0a fix(userspace/libpman): try harder to avoid leaking fds.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 25401ed11e fix(test): try harder to avoid event loss.
Default interesting syscalls set now avoids `read` and `pread` to avoid
back-pressure with `eventfd_read` being called at each loop iteration.
Moreover, `event_capture::run()` now accepts a ppm_sc_set parameter
to customize the sc set for the test.

Finally, in rlimit related tests, reset old limits upon leaving.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro cdb0470716 chore(test/libsinsp_e2e): avoid using useless atomics.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro b5a32a41ea fix(test/libsinsp_e2e): only enable generic syscalls in `timestamp` test to avoid drops.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 81800af9a2 chore(test/libsinsp_e2e): try harder to avoid issues in `tcp_client_server_with_connection_before_capturing_starts_ipv4m` test.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro b496e40ba9 fix(driver/modern_bpf): fixed cgroup paths management for path_components > MAX_CGROUP_PATH_POINTERS
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 31b62c4a21 chore(test,userspace): properly reset docker_socket in tests since it is a static.
Rename `m_docker_sock` to `s_docker_sock` to highlight that it is static.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 9d7c1dbb30 chore(test/libsinsp_e2e): disable `get_procs_cpu_from_driver`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro e516759a96 chore(test/libsinsp_e2e): use an atomic for `healthcheck_helper::exited_early`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 7397af87fc fix(userspace/libsinsp, test/libsinsp_e2e): fixed libvirt-lxc container resolving on newer linux systemd systems.
This fixes the `sys_call_test.container_libvirt` running on my machine.
Also, let event_capture always print capture stats for us.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 09c8b3f6ec fix(test/libsinsp_e2e): more fixes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro d82601c11a fix(test/libsinsp_e2e): use an `eventfd` to signal main thread that is time to leave.
The `close` syscall might get lost leading to an infinite loop; instead,
now we ask to the main thread to leave using thread safe eventfd,
and the main thread will dequeue all remaining events until an error
is returned by sinsp::next.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro e688893e48 chore(test/libsinsp/e2e): some renamings to improve readability.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro 0ce5eb565e chore(test/libsinsp_e2e): more fixes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro ff8d8fb8a0 chore(test): run test synchronously on the same thread of capture unless the special `run_callback_async_t` is used.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Federico Di Pierro e2f6a09af5 fix(test/libsinsp_e2e): remove multithreaded usage of sinsp inspector in e2e tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 11:57:04 +02:00
Andrea Terzolo e25d0f09c1 cleanup(drivers): use helper methods
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo a02c23109c fix(tests): fix e2e tests using vpgid
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo a9e323b3cb fix(drivers): fix pgid extraction in kmod and legacy ebpf
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo 3bd1fb3bbd chore: bump schema version
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo a81da2d546 test(sinsp): fix a regression test
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo 3268183e60 cleanup(sinsp): remove duplicated code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo 06cdc9b636 new(tests): add some tests for the new `pgid` field
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo 833fb99d18 new(userspace): add support for new `pgid` kernel field
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Andrea Terzolo 752f70ddf0 new(drivers): add a new `pgid` field
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-10-07 10:06:03 +02:00
Federico Di Pierro 37d4383f18 fix(userspace/libscap): fix build without `USE_ZLIB` macro.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-07 10:00:04 +02:00
Grzegorz Nosek 85713d300f cleanup(build): gvisor no longer has a circular dependency on scap
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 6b72ea2c6e cleanup(build): do not install libbpf headers
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 60b2f538cd fix(build): do not install entire libelf as "headers"
In fact, do not install the headers either, since they're not used
in the public API.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek f5edb00ce2 fix(build): make engines' links public
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek b92171a74d cleanup(build): remove now-unused link
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 7de58c2dad fix(build): make sinsp->cri_* linkage public
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 7a524a97b4 fix(build): link cri_* with grpc
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 6a4bf26b1e fix(build): install cri_* helper libraries and generated headers
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 1fa8ef8231 fix(build): do not expose build directory includes in pkg-config
When using bundled dependencies, we install their headers into
.../include/falcosecurity, so we do not need to generate a fancy
include path. This way we don't leak the build-time include paths
to dependencies in the generated pkgconfig files.

When we're not using bundled dependencies, we still need to add their
include paths to ours though, so keep doing that (for the three
dependencies: tbb, curl, jsoncpp, that are actually used in any
headers).

The elephant in the room is gRPC (with its dependency absl), which we
don't install at all but also have never put in LIBSINSP_INCLUDE_DIRS,
so this patch doesn't make things worse: including pkgconfig-installed
sinsp headers that depend on gRPC didn't work before and doesn't work
now either.

The real fix would be to stop installing them (they're not really
public), but reviewing all headers for public/private status is out
of scope for this PR.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 6c3d18f573 fix(build): fix gvisor .so build
I must be the only one for whom building gvisor in a shared library
fails (or maybe the only one actually trying to do this), but I can't
see how it could compile. We need to:
* privately link the object library with scap_platform_util to pick up
  its includes
* publicly link with gRPC (and other dependencies) to ensure correct
  linking order

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 4abef2b042 fix(build): install libpman
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Grzegorz Nosek 76bd7baf67 fix(build): get pkgconfig libraries recursively
Unify the implementation between libscap and libsinsp, recursively
descend into dependencies to build the whole tree (while avoiding
the scap->scap_engine_gvisor->scap cyclic dependency) and skip
static libraries linked by shared libraries (they do not need to be
linked again when building the final binary).

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-10-02 10:45:40 +02:00
Luca Guerra 6a0df223f6 new(libsinsp): print LIST() in markdown format for list fields
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-10-01 23:17:37 +02:00
Mauro Ezequiel Moltrasio cf6debe721 chore(ci): show diff on failed format
The provided patch is great to fix large formatting errors, however, it
would be nice for CI to also show the diff for smaller changes that
could be directly typed without having to download the patch.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-10-01 18:58:36 +02:00
Federico Di Pierro aeb87935dc fix(userspace/libsinsp): avoid possible UB when calling `back` or `front` without checking string emptiness.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-30 18:15:32 +02:00
Federico Di Pierro 622b7859c4 chore(driver/bpf): properly include sched.h in types.h since it uses `TASK_COMM_LEN`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-30 17:52:32 +02:00
Grzegorz Nosek 8baec4b102 fix(schema): make OPENAT2_E DIRFD_PARAM point to the right param
Signed-off-by: Grzegorz Nosek <root@localdomain.pl>
2024-09-30 10:00:32 +02:00
Federico Di Pierro 73bcad2b1c fix(benchmark): avoid compiler optimizations in benchmarks loops.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-26 14:43:16 +02:00
Luca Guerra 0eb7be3e69 chore(libsinsp): style, lint
Signed-off-by: Luca Guerra <luca@guerra.sh>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-25 12:29:11 +02:00
Federico Di Pierro 09503aaf33 fix(userspace/libsinsp): avoid dereferencing a possible nullptr in parsers
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-25 12:29:11 +02:00
Luca Guerra f87b40fca5 fix(libsinsp-e2e-tests): concurrency
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-09-25 10:59:11 +02:00
Luca Guerra 9b4a0d2757 fix(libsinsp-e2e-tests): stop capture upon stop_capture()
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-09-25 10:59:11 +02:00
Federico Di Pierro f994d959fe chore(userspace/libsinsp): bypass scarf when downloading test fixtures.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-23 17:10:02 +02:00
Federico Di Pierro be502f0421 chore(ci): check linked glibc version on zig.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-23 17:10:02 +02:00
Federico Di Pierro 4160bf061f chore(ci): bump the zig version to latest.
Moreover, use zig version as cache key too.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-23 17:10:02 +02:00
Federico Di Pierro 59890ecb4e chore(ci): keep zig development version alive by using actions/cache.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-23 17:10:02 +02:00
Federico Di Pierro 5371040a68 new(ci): add a zig build job plus a composite action to setup zig.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-23 17:10:02 +02:00
Federico Di Pierro b8c2d0d8a8 chore(userspace/libscap): avoid using popen.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-20 15:52:50 +02:00
Federico Di Pierro 780ef8854d cleanup(userspace/libscap): avoid the usage of non-portable (glibc specific) `__gnu_cxx::stdio_filebuf`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-20 15:52:50 +02:00
Federico Di Pierro b9ec98f1b9 chore(cmake): make abseil-cpp build compatible with gcc-13.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-20 15:38:50 +02:00
Federico Di Pierro bba69d8a26 fix(cmake): add zig workarounds for libelf and grpc cmake modules.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-20 15:38:50 +02:00
Andrea Terzolo 03d6e62d57 Update .clang-tidy
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>

Co-authored-by: Mauro Ezequiel Moltrasio <moltrasiom@hotmail.com>
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-20 11:22:49 +02:00
Andrea Terzolo c5c155f114 chore: update presets and add a basic clang-tidy config
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-20 11:22:49 +02:00
Giles Hutton 6013891169 chore: downgrade flushing log messages to debug
Signed-off-by: Giles Hutton <ghutton@redhat.com>
2024-09-20 10:18:49 +02:00
Federico Di Pierro a9421baa7b update(cmake): updated c-ares to latest 1.33.1 version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-20 10:10:49 +02:00
Federico Di Pierro 933e065c79 chore(test/libsinsp_e2e,ci): port libsinsp_e2e tests to use python3.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-18 14:16:53 +02:00
Federico Di Pierro 3f319bbeb2 chore(ci): bumped perf unit tests threshold to 5% (relative) slowdown.
Same threshold used for google benchmarks.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-18 12:11:53 +02:00
Andrea Terzolo 5919fa9941 fix(libscap): use the correct memory barrier for ARM64
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-13 18:29:37 +02:00
Andrea Terzolo 398964afe2 ci: pin dependencies
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-13 16:30:37 +02:00
Federico Di Pierro 448570d92e fix(test/drivers): fixed s390x `Werror` related failures for drivers tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-13 16:24:36 +02:00
Gianmatteo Palmieri 18a7f4174d chore(sinsp): rename `thread_pool` to `sinsp_thread_pool` to avoid symbol conflicts
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-13 16:00:37 +02:00
Z. Liu acc2d4e7ea chore(libs): fix -Werror=unused-variable
otherwise test will give wrong result if compiler has -Werror flags,
complained with:

  error: unused variable 'g_ppm_class' [-Werror=unused-variable]

Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
2024-09-13 14:15:36 +02:00
Jason Dellaluce 289bb6e0ca fix(libsinsp): solve field-field comparison pointer instability issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-09-13 11:05:37 +02:00
Jason Dellaluce 2103faa343 fix(libsinsp): wrong error message in rhs field comparison checks
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-09-13 11:05:37 +02:00
Federico Di Pierro 16ac62f62b fix(ci): avoid running drivers CI jobs that need secrets in PR coming from forks.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-13 07:45:36 +02:00
Andrea Terzolo ee5ab6dfee fix: fix some warnings as errors
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-13 07:35:36 +02:00
Andrea Terzolo 5b9db23f97 chore: ignore the commit used for formatting
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-11 11:40:31 +02:00
Grzegorz Nosek 6c5c7863f6 fix(ci): build driver tests with -Werror
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-09-11 11:22:31 +02:00
Grzegorz Nosek d0994b08db fix(build): expect_truncated is only used on some architectures
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-09-11 11:22:31 +02:00
Grzegorz Nosek 8bb04d04b9 fix(build): fully initialize send_data/recv_data
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-09-11 11:22:31 +02:00
Gianmatteo Palmieri 0f757221cb fix(sinsp): plugin capture listen capability exception
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-09-11 11:12:31 +02:00
Poiana 215db2d9de chore(libs): apply code formatting
Signed-off-by: Poiana <poiana.bot@gmail.com>
2024-09-11 10:18:30 +02:00
Francesco Furlan dd165076cb ci(semgrep): update semgrep docker image
Signed-off-by: Francesco Furlan <francesco.furlan@sysdig.com>
2024-09-09 16:36:23 +02:00
Luca Guerra efa1df92b5 new(libsinsp/tests): add renameat2 tests for fd.*
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-09-06 10:09:11 +02:00
Federico Di Pierro 7b520a792d fix(userspace/libsinsp): fixed test run on osx by correctly using agnostic `PPM_AT_FDCWD` value instead of the platform dependent one.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-06 10:09:11 +02:00
Federico Di Pierro 4355400350 cleanup(userspace/libsinsp): move parsing logic from sinsp_filtercheck_fspath to parsers.
Simplified a bit the whole logic.
Updated events_fspath tests adding the `PPM_O_DIRECTORY` flag as needed.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Luca Guerra <luca@guerra.sh>
2024-09-06 10:09:11 +02:00
Melissa Kilby 9ec5b02a0e fix(sinsp/parsers): make parse_dirfd safer
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-06 10:09:11 +02:00
Melissa Kilby cfdf65096e fix(sinsp/filtercheck): introduce parse_dirfd_stateless helper for fs.path.* dirfd use cases
Co-authored-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-06 10:09:11 +02:00
Melissa Kilby 6e6dc926c6 update(sinsp/test): expand fs.path.* filterchecks unit tests for correct dirfd handling
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-06 10:09:11 +02:00
Melissa Kilby c089a62873 chore(sinsp/parsers): some clarification comment and remove legacy leftovers
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-06 10:09:11 +02:00
Melissa Kilby 22a81a5f6a fix(sinsp/filtercheck): fix fs.path.* filterchecks missing dirfd handling for relative paths
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-06 10:09:11 +02:00
Andrea Terzolo 0701271f07 update(clang-format): add InsertNewlineAtEOF
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-06 09:34:11 +02:00
Andrea Terzolo be73189501 new: introduce clang-format-ignore
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-06 09:34:11 +02:00
Andrea Terzolo 690f4c4800 chore: scaffolding for enabling code formatting
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-06 09:34:11 +02:00
Grzegorz Nosek eba3e318b3 fix(schema): fix FUTEX_E flags parameter
The correct type is PT_FLAGS, not PT_ENUMFLAGS, as FUTEX_PRIVATE_FLAG
and FUTEX_CLOCK_REALTIME are bitwise-or'ed with the other values.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-09-05 10:49:08 +02:00
Federico Di Pierro 9d2d151119 chore(cmake): honor CMAKE_BUILD_TYPE while building bundled grpc and protobuf.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-05 08:41:07 +02:00
Federico Di Pierro 0c67af00ac chore(userspace/libsinsp): only link libanl if present.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-05 08:40:07 +02:00
Gianmatteo Palmieri 8f6f9dfaef fix(libsinsp): address reviewer thread pool suggestions
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri e0ec81c339 fix(libsinsp): disable thread pool on webassembly
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 476ab41d81 new(libsinsp): capture listening capability
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri ab9e04ebbf fix(test): mock plugin not initialized
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 2904a7abff new(test): add plugin routines test
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri fa4685f581 new(test): add thread pool unit test
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 61892d1701 chore: bump plugin api version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 9750c8fa1c new(libsinsp): add plugin api routine vtable
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri c5d7b5fa2c new(libsinsp): add thread pool implementation
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 3b010979f6 new(libsinsp): add thread pool interface
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 35a797a0f7 new(libsinsp) add inspector thread pool
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 219038d6e1 new(libsinsp): notify plugins of capture open/close
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Gianmatteo Palmieri 5e98440e36 new(cmake): add bs_threadpool dependency
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-09-05 08:09:07 +02:00
Andrea Terzolo b6323796c4 fix: use correct index for libbpf stats
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-05 08:07:07 +02:00
Andrea Terzolo ffd9fe0622 cleanup: rename a parameter
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-09-05 08:07:07 +02:00
Andrea Terzolo 3eca2f1e9b docs(libscap): add a comment
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-05 08:07:07 +02:00
Andrea Terzolo f1a5203bfe cleanup(libscap): always enable global counters when per-cpu ones are enabled
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-05 08:07:07 +02:00
Andrea Terzolo 3080fb7d7a fix(pman): remove a wrong flag
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-05 08:07:07 +02:00
Andrea Terzolo 300e49d266 cleanup(libscap): detach per-CPU counters from global kernel counters
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-05 08:07:07 +02:00
Federico Di Pierro 13746b5bcc fix(userspace/libscap): one more source of UB in source_plugin.c
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-04 11:33:03 +02:00
Federico Di Pierro 36c79e3670 fix(userspace/libsinsp): fixed possible UB in compute_program_hash() method.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-04 11:33:03 +02:00
Andrea Terzolo 741104b4a8 fix(modern): prevent CO-RE relocations when CONFIG_QUOTACTL not defined
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-09-03 11:25:59 +02:00
Federico Di Pierro 1db10b3a42 cleanup(ci): don't run drivers CI job that use secrets on forks.
They would always fail.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-02 09:52:54 +02:00
Federico Di Pierro 2641e573be fix(driver): fixed build against linux 6.11.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-02 09:45:54 +02:00
Andrea Terzolo 5ed00b2a9a new(tests): add some dns tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-29 12:37:37 +02:00
Andrea Terzolo c5a6a68606 cleanup(tests): improve network methods
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-29 12:37:37 +02:00
Andrea Terzolo b93a779c07 new(drivers): add dns snaplen increase
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-29 12:37:37 +02:00
Mauro Ezequiel Moltrasio e2c5174352 chore(modern_bpf): use absolute path for clang executable
This is a very small change that should have no major impact on how the
build works. However, when using ccache, having the clang executable
resolve to the real path completely breaks compilation for the modern
probe.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-08-28 14:03:32 +02:00
Federico Di Pierro 3004d3e65d cleanup(ci): drop benchmarks from main ci.yml now that we have them in perf ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-28 11:10:31 +02:00
Federico Di Pierro f5fe9dea23 fix(ci): only account for mean values in google benchmarks perf CI checks.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-28 11:10:31 +02:00
Andrea Terzolo 02732d6fcc fix(driver/kmod): fix mixed declarations and code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 57dbdb38d9 cleanup(tests): improve some names
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo e2131935ff new(tests): add some tests for network syscalls
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 20ace583ef tests: retrieve the correct errno instead of zeroing it
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo b7565d5282 fix(driver/modern_bpf): extract the tuple even when recv buf is NULL
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 39b2760255 fix(driver/kmod): improve fullport range snaplen logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 2305f55438 fix(driver/ebpf): improve fullport range snaplen logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 84d297c426 fix(driver/modern_bpf): improve fullport range snaplen logic
fallback logic to extract remote port with UDP

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo 04b8c8be1d fix(driver/kmod): correctly manage some fd conversion
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 11:08:32 +02:00
Andrea Terzolo bf3c89bead fix(tests): fix e2e sinsp tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 09:44:31 +02:00
Andrea Terzolo df081b8c0a docs: add a comment
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 09:44:31 +02:00
Andrea Terzolo 8307b4f97f fix(scap): fix scap-file support
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-28 09:44:31 +02:00
Eddy Duer a3f5caaf5e Changes after code review #2
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-08-28 09:44:31 +02:00
Eddy Duer c49107c9c4 Overlay FS flags are now sent in existing flags parameter in the open syscall family
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-08-28 09:44:31 +02:00
Eddy Duer 58c17a8cc8 Changes after code review
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-08-28 09:44:31 +02:00
Eddy Duer eede4010e0 Overlay FS: Add fields proc.is_exe_lower_layer, fd.is_upper_layer and fd.is_lower_layer
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-08-28 09:44:31 +02:00
Jason Dellaluce db631fa6bf fix(libsinsp/state): ensure deep copy semantics and proper memory ownership in dynamic structs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-08-28 09:36:31 +02:00
Andrea Terzolo 89edd36da4 fix(CI): restore e2e sinsp report uploading
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 17:39:27 +02:00
Federico Di Pierro 827eef3987 chore(ci): properly use provided compare python script for google benchmarks results.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-27 17:24:28 +02:00
Federico Di Pierro 7ec9d79be4 chore(benchmark): properly renamed concatenate_paths benchmarks to fix typo.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-27 17:24:28 +02:00
Federico Di Pierro e3f50fcc47 chore(benchmark,ci): avoid registering benchmark with a `Repetitions` value.
Instead, rely on the user running the benchmark to eventually provide `--benchmark_repetitions` CLI arg.
Provide `--benchmark_repetitions` CLI arg for perf CI.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 17:24:28 +02:00
Federico Di Pierro 76c39bd182 new(ci): add google benchmarks tests to perf ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-27 17:24:28 +02:00
Federico Di Pierro a687381686 new(benchmark): added some new sinsp_utils benchmarks.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-27 17:24:28 +02:00
Sahas Panda eb374bccaf feat(libsinsp): Add wrapper for read/write lock
`mutex.h` already has a nice abstraction that allows exclusive access to
an object. This change extends that paradigm to allow similar simple
function calls that allow read/write locking primitives using a
`shared_mutex`.

Signed-off-by: Sahas Panda <sahasranshu.panda@sysdig.com>
2024-08-27 14:56:27 +02:00
Melissa Kilby 434a230ad6 update(cri): cri-dockerd support
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-08-27 12:09:26 +02:00
Andrea Terzolo c7d7530e3b cleanup: use s3 folder for sample.scap
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 10:43:26 +02:00
Andrea Terzolo d770e3c78c cleanup: try to remove the ifdef
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 10:43:26 +02:00
Andrea Terzolo 7b566f527b cleanup(tests): move some scap file tests under the right directory
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 10:43:26 +02:00
Andrea Terzolo bc7482f3e7 new(ci): enable benchmarks in CI
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 10:40:26 +02:00
Andrea Terzolo ab90a58df6 new(sinsp): introduce the first google benchmark
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 10:40:26 +02:00
FedeDP f3ac01e7f8 update(driver): update syscalls tables and driver report.
Signed-off-by: GitHub <noreply@github.com>
2024-08-27 10:26:26 +02:00
Andrea Terzolo 7207f611df chore: add CMakePresets.json file
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-27 09:42:26 +02:00
Federico Di Pierro 33cbe0735a chore(ci): update kernel-testing related matrix comment if already existent.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-26 16:40:25 +02:00
Andrea Terzolo 2b0fa60a54 cleanup(pman): use `==` instead of `>=`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-08-26 15:50:25 +02:00
Andrea Terzolo 58ecab594d new(libpman): add some debugging macros
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-26 15:50:25 +02:00
Andrea Terzolo 6a7fc68beb fix(libpman): try to get a new event after increasing the producer
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-26 15:50:25 +02:00
Federico Di Pierro d3d43cf9e8 fix(userspace/libsinsp): fixed CO_IN filter crafted value.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Luca Guerra <luca@guerra.sh>
2024-08-26 15:03:25 +02:00
Federico Di Pierro 839efecdf6 chore(ci): update perf comment if already existing instead of always writing a new one.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-22 11:02:50 +02:00
Federico Di Pierro d72cedf4c0 chore(ci): disable unstable scap-related perf test from perf PR comment and check.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-22 11:02:50 +02:00
Grzegorz Nosek 7b72eb5806 new(sinsp)!: support linux_hostinfo_platform in sinsp::open_plugin
Rather than passing the mode directly, introduce a new enum that
describes both the mode and the platform to use.

Fixes: #2281
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-08-21 15:32:47 +02:00
Grzegorz Nosek 8512d56ee6 new(scap): introduce linux hostinfo platform
This is a minimal Linux platformm intended to be useful with source
plugins that do not handle syscall data but still want access to some
info about the machine they're running on. Currently collected data
includes:
- machine info
- agent info
- interface list

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-08-21 15:32:47 +02:00
Luca Guerra a356d0831a fix(libsinsp/tests): add synchronization to some async_key_value_source tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-21 09:16:47 +02:00
Luca Guerra c8dfe45e7c fix(libsinsp/tests): explicit const char* on string literal
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-21 09:16:47 +02:00
Luca Guerra 5724d785d2 new(build): add experimental TSan option
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-21 08:35:47 +02:00
Luca Guerra 1407484cc2 update(build): allow tbb to build with a different compiler
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-21 08:35:47 +02:00
Mauro Ezequiel Moltrasio fb6cef6124 cleanup(sinsp): add a set_static_container method
This change splits configuration of the static container data away from
the sinsp constructor and into a separate set_static_container method.

The motivation behind this change is two fold:
- Configuration of other container engines is handled by a call to
  set_container_engine_mask() before starting the inspector, the new
  method is closer to this implementation.
- Enabling metrics collection should not require adopters to pass in 4
  unrelated arguments to the sinsp constructor.

These changes will require some modifications into the Falco main repo,
as far as I can tell they should be relatively straight forward.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-08-20 20:45:45 +02:00
Melissa Kilby 1dc74595ba cleanup(metrics/prometheus): collapse sanitization method
Co-authored-by: Samuel Gaist <samuel.gaist@idiap.ch>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-08-20 18:20:45 +02:00
Melissa Kilby 41b0ea300c cleanup(sinsp/metrics): add prometheus metric and label names sanitization methods
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-08-20 18:20:45 +02:00
Melissa Kilby 032542bb2d cleanup(sinsp/metrics): remove raw_name as label
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-08-20 18:20:45 +02:00
Holger Hoffstätte 9d76298020 fix(userspace/libsinsp): explicitly include <cstdint> to fix build with gcc-15
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2024-08-20 13:11:44 +02:00
Luca Guerra df21b635ef fix(libscap): fix scap_kmod build with HANDLE() macro
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-19 17:53:41 +02:00
Andrea Terzolo 18de8ce6d7 test: add tests for the new per-CPU metrics
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-19 11:56:41 +02:00
Andrea Terzolo 49fd4bc2bb new(scap,pman): add new per-CPU metrics
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-19 11:56:41 +02:00
Melissa Kilby f19c71a0b5 update(sinsp/ifinfo): make overloaded addr_to_string static
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-19 11:16:41 +02:00
Melissa Kilby 8eac96e2b0 update(sinsp/ifinfo): add new public addr_to_string methods
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-08-19 11:16:41 +02:00
Federico Aponte 446d9e1c2d Implement PR review's suggestions
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-08-14 08:42:10 +02:00
Federico Aponte a5e94e9bf0 fix: multiple definitions for scap_engine_handle
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-08-14 08:42:10 +02:00
Andrea Terzolo 874e573b20 new(tests): add a new test for execveat with `AT_EMPTY_PATH`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-12 22:18:06 +02:00
Andrea Terzolo 686dfc029d fix(driver/kmod): always count when an event is dropped for some reason
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-08 20:30:54 +02:00
Andrea Terzolo 124428fd32 fix(driver/kmod): do not count preemptions in `n_evts`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-08 20:30:54 +02:00
Luca Guerra 78d731243e cleanup(ci): update semgrep to 1.84.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-08 20:29:54 +02:00
Luca Guerra 5b40fe6c23 fix(ci): remove spurious strategy statement
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-08 20:28:54 +02:00
seraphGod e98c999566 Fix the issue of subsystem controller files not being present when Calico is present
Signed-off-by: seraphGod <641146617@qq.com>
2024-08-08 18:37:54 +02:00
Federico Di Pierro a118b0f684 chore(ci): add an empty run for scap file before perf'ing it.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-08-08 07:29:52 +02:00
Grzegorz Nosek 5fa87bb71d new(libscap): dump ringbuffer contents after detecting corruption
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-08-07 14:13:48 +02:00
Luca Guerra 2c2e9b0585 update(ci): use codecov flag for libsinsp
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-07 12:01:47 +02:00
Roberto Scolaro ae812eea20 fix(libsinsp): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-08-07 10:15:46 +02:00
Roberto Scolaro 27669e065f refactor(libsinsp): set filterstring optionally
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-08-07 10:15:46 +02:00
Roberto Scolaro 0b723a637d fix(libsinsp): add function to set compiler filter and filter string
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-08-07 10:15:46 +02:00
Luca Guerra 8615f0b692 new(libsinsp/test): add tests for net compare
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-06 18:24:45 +02:00
Luca Guerra bc76185972 fix(libsinsp): check ipvXnet size before comparing
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-06 18:24:45 +02:00
Andrea Terzolo 4a13e1be03 docs(bpf_engine): add some docs and rename some variables
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-08-06 16:38:44 +02:00
Mauro Ezequiel Moltrasio 1feeb37d53 cleanup(metrics): remove duplicated new_metric method
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-08-05 18:03:42 +02:00
Luca Guerra 9bda461036 cleanup(libsinsp): remove unreachable code
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-05 15:32:41 +02:00
Luca Guerra 85320ef836 cleanup(libsinsp): update g_invalidchar for windows
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-05 15:27:42 +02:00
SohamM-Ibm d22f7a4c23 fixes infer_defaults_to_first_non_loopback TC failure on s390x arch
Modifying parse_ipv4_addr function to ensure that the IP address is correctly parsed and combined into a 32-bit integer of the correct byte order for Big-Endian systems.

Modifying the convert_to_string function to extract the bytes in the correct order for Big-Endian systems.

Signed-off-by: Soham Munshi <Soham.Munshi@ibm.com>
2024-08-05 14:24:41 +02:00
Luca Guerra 2e8706349f fix(libsinsp/test): use correct iterator type in plugin tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-08-01 15:32:47 +02:00
Gerald Combs 3ce0a2ddb4 update(ci): Build more jobs in parallel
Pass `--parallel` to `cmake --build`. This requires CMake 3.12, but that
shouldn't be a problem on the affected runners.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-07-31 10:25:44 +02:00
Gerald Combs f960a90079 update(cmake): Use the correct zlib debug library name on Windows
The debug versions of zlib have a "d" in their name, e.g. zlibstaticd.lib.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-07-31 10:12:43 +02:00
Federico Di Pierro 64fe18779b chore(ci): run capture-related perf CI on tmpfs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-25 17:47:17 +02:00
Luca Guerra 5c80f0e44a fix(libsinsp): simplify sinsp_split, modify set_env/args
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-23 18:12:45 +02:00
Andrea Terzolo 77569fdbef fix(driver/kmod): avoid `mixed declarations and code` error
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-07-23 15:24:46 +02:00
Andrea Terzolo d1d07d5134 fix(driver): correctly handle upper_dentry in the kmod
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-23 15:24:46 +02:00
Andrea Terzolo 397bfd4199 cleanup(driver): simplify exe_upper_layer extraction
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-07-23 15:24:46 +02:00
Roberto Scolaro 1243787a17 fix(libsinsp): pass shared_ptr by reference
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-23 14:02:45 +02:00
Luca Guerra 81f451e1d4 fix(libsinsp): fix Falco compilation error on libsinsp_metrics::set_metric_value
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-22 14:05:42 +02:00
Federico Di Pierro 31d1adf92e fix(ci): use semver tag version for kernel-testing action.
Images are not pushed under the hash name.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-22 11:41:41 +02:00
Luca Guerra 88a5eb707a update(libsinsp): raise error severity
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-22 11:34:41 +02:00
Luca Guerra ee4e2c8c4e new(libsinsp/tests): add test for corrupted event
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-22 11:34:41 +02:00
Luca Guerra 796eed70de new(libsinsp): add debug log for corrupted events
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-22 11:34:41 +02:00
Luca Guerra 4e3aebe6f3 fix(ci): exclude non-libsinsp files from libsinsp test coverage
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-19 21:33:35 +02:00
Luca Guerra 7bfbf69dd5 cleanup(ci): pin deps to hashes
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-19 16:27:35 +02:00
Luca Guerra 6ea7fcddf5 new(ci): add codecov report
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-19 15:58:35 +02:00
Luca Guerra 69c9dd934f new(ci): add code coverage
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-19 15:58:35 +02:00
Jason Dellaluce ae6b268d84 refactor(userspace/libsinsp): pass by reference when possible
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-19 11:05:34 +02:00
Jason Dellaluce f4c94e6adb refactor(userspace/libsinsp): reduce cost of shared ptrs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-19 11:05:34 +02:00
Andrea Terzolo 4529462d98 cleanup(tests): remove some headers
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-07-17 17:37:44 +02:00
Roberto Scolaro 9c397a9b69 chore: address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-17 17:37:44 +02:00
Roberto Scolaro dffa3712d4 chore: move PPM_MAX_PATH_SIZE macro to tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-17 17:37:44 +02:00
Roberto Scolaro 5a3ded466e fix(kmod): standardize some enter fillers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-17 17:37:44 +02:00
Roberto Scolaro 2c510895ea chore(tests): add tests for max path
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-17 17:37:44 +02:00
Roberto Scolaro d51e607f03 fix(driver/kmod): don't truncate path at 256
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-17 17:37:44 +02:00
Federico Di Pierro f7b10554e4 chore(ci): cleanup inputs.arch usage in drivers_ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-16 16:27:39 +02:00
Federico Di Pierro ee0a6457a2 fix(ci,test): fixed centos:7 related CI by using vault.centos.org.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-16 16:27:39 +02:00
Roberto Scolaro 60317a6780 chore(engine/bpf): close only used fds
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-16 10:36:38 +02:00
Roberto Scolaro 12f50b4d99 chore(libscap/engine/bpf): reset bpf_map_fds to -1
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-16 10:36:38 +02:00
therealbobo 4a95c308f5 fix(driver/bpf): close maps on cleanup
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-16 10:36:38 +02:00
Jason Dellaluce cbf970779c fix(userspace/libsinsp): adapt regex tests to new test APIs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-15 21:12:37 +02:00
Jason Dellaluce 152b99a5f4 update(userspace/libsinsp): improve and test compile-time filter warnings and euristics
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-15 21:12:37 +02:00
Jason Dellaluce cfd5399679 test(userspace/libsins): add coverage for regex filter operator
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-15 21:12:37 +02:00
Jason Dellaluce 7022182b2f update(userspace/libsinsp): support regex operator in sinsp filters
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-15 21:12:37 +02:00
Andrea Terzolo 0a9ede376f tests(sinsp): fix unix connect test
we need to use match the right tuple according to the endianness.

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-07-15 09:40:07 +02:00
Roberto Scolaro 33de01fb1f chore(cmake/modules): bump zlib to 1.3.1
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-07-15 09:29:07 +02:00
Jason Dellaluce ad46fd69a6 fix(userspace/libsinsp): solve issues with negate comparisons on ip and ipnet checks
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-07-11 14:33:48 +02:00
Mark Stemm d8b5b2e744 Add unit test that verifies fix for binary_check_expr::is_equal
Create two expressions with the same lhs/rhs but different ops, and
ensure that is_equal() returns false.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2024-07-11 11:16:48 +02:00
Mark Stemm 5a84ab40f1 fix(libsinsp): Also compare operators for binary_check_expr
Fix a bug in binary_check_expr::is_equal()--the comparison should also
compare the operators in addition to both sides.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2024-07-11 11:16:48 +02:00
Federico Di Pierro fa26daf65b chore(driver): add comment with commit.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-10 09:19:43 +02:00
Federico Di Pierro fac87101d6 fix(driver): fix build of kmod on linux 6.10.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-10 09:19:43 +02:00
Luca Guerra 3eae0fa5fd fix(libsinsp): use size_type
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-04 09:58:21 +02:00
Luca Guerra 0ec2ad8422 new(libsinsp): add basename() string transformer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-02 10:48:12 +02:00
Luca Guerra a1f8b3bca1 fix(libsinsp): fix empty buffer read in transformer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-01 15:31:10 +02:00
Luca Guerra 9ae98d3ff8 chore(libsinsp): fix unused value for fscanf
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-07-01 14:48:10 +02:00
Gerald Combs 1058afc147 update(cmake): Make sure we link zlib with the correct Windows CRT
Set CMAKE_POLICY_DEFAULT_CMP0091, CMAKE_MSVC_RUNTIME_LIBRARY,
and CMAKE_BUILD_TYPE when we configure zlib, similar to our other
dependencies.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-06-28 20:43:56 +02:00
Federico Di Pierro 372946ee3b chore(ci): renamed create-comment to more meaningful name.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-28 09:50:53 +02:00
Federico Di Pierro d8091ebdc7 chore(ci): avoid name clashing between PR info for perf and for kernel-testing-dev.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-28 09:50:53 +02:00
Federico Di Pierro 52de868822 fix(ci): avoid truncation while saving PR info in drivers ci.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-28 09:50:53 +02:00
Mauro Ezequiel Moltrasio ae5fbf62f1 docs(metrics): add back doxygen comments for metrics v2
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-06-27 16:38:50 +02:00
Mauro Ezequiel Moltrasio 7417269311 chore(metrics): refactor metrics v2 so it uses classes
This is an alternative to the original implementation. Instead of using
capturing lambdas that get called back after some additional work is
done, we use classes and gather data during instantiation of the object.
This approach should be a lot more straight forward and it also doesn't
create unneeded objects when there's no need to do so.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-06-27 16:38:50 +02:00
Gerald Combs fac0ae4424 update(cmake): Build zlib using CMake on Windows
Build zlib using CMake on Windows instead of nmake. The nmakefile passes
"-base:0x5A4C0000" to the linker, which is too small on Arm64 and not
really needed or wanted on any platform these days.

https://github.com/madler/zlib/issues/325

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-06-27 09:21:49 +02:00
Federico Di Pierro fbf88d622a new(ci): create a comment with kernel testing matrixes on PRs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-26 18:29:45 +02:00
Federico Di Pierro 3b68853a35 new(ci): enable kernel testing on PRs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-26 18:29:45 +02:00
Federico Di Pierro 473bf06780 fix(ci): properly use `pages.yml` as workflow target for download artifact action.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 13:46:37 +02:00
Federico Di Pierro ca8e16436b chore(userspace/libsinsp): revert `gmt2local` changes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 13:46:37 +02:00
Federico Di Pierro 81f533e115 chore(userspace/libsinsp): make `thiszone` thread local.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 13:46:37 +02:00
Federico Di Pierro 7eaa316651 fix(userspace/libsinsp): allow `sinsp_stats_v2_collectors` lambdas to return empty value, to be skipped, when requirements are not met.
For now, this means that metrics that require `m_sinsp_stats_v2` will be automatically skipped when it is disabled.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 13:46:37 +02:00
Federico Di Pierro 7ab3eee6bb cleanup(userspace/libsinsp): small perf improvements.
Properly keep a reference on m_sinsp_stats_v2 where needed, instead of fetching it every time.
Moreover, improve perf in `sinsp_utils::ts_to_string`: cache `gmt2local` result instead of fetching it every time as it is an heavy operation.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 13:46:37 +02:00
Federico Di Pierro 5cf446773e fix(ci): fixed heaptrack data path (zst extension).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 11:12:36 +02:00
Federico Di Pierro dc89559dc1 chore(ci): small fix in output names.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 10:33:36 +02:00
Roberto Scolaro 1a7aeba543 new(libsinsp/test): add setre*id parser tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-06-25 10:21:36 +02:00
Roberto Scolaro 721f6952e3 fix: address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-06-25 10:21:36 +02:00
Roberto Scolaro d7d1e7c861 fix: move setre*id args to exit event
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-06-25 10:21:36 +02:00
Roberto Scolaro 67350f1379 new(libsinsp): parse setre*id syscalls
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-06-25 10:21:36 +02:00
Roberto Scolaro 41cfc7b2a3 new: add setre*id syscall family
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-06-25 10:21:36 +02:00
Federico Di Pierro 405ec96b53 chore(ci): use `ionice` to try to make scap file reading tests more stable.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 09:59:36 +02:00
Federico Di Pierro 4b907ea9bc chore(ci): improve threshold checks.
Added a check on new leaks for heaptrack checks;
moreover, changed perf checks to run against
sum of diffs, that is more stable and useful.
Ie: if part of logic gets moved from one method to another,
we expect eg: method_A -> -7%, method_B -> +7%.
Before, this triggered the CI error; now it does not, since the sum is 0.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 09:59:36 +02:00
Federico Di Pierro 3cc9c507c8 new(ci,docs): added heaptrack to our new perf related CI.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-25 09:59:36 +02:00
Federico Aponte c3900a9628 fix: class definitions with duplicate names
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-06-24 16:35:32 +02:00
Andrea Terzolo f286ecb599 fix(libpman): avoid truncated verifier logs
4096 bytes are not enough for long verifier logs, we need to use the
same dimension provided by libbpf (UINT32_MAX >> 8)

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-06-24 10:37:30 +02:00
Federico Di Pierro dcf250a982 chore(ci): properly use correct html tag for interactive svgs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 16:04:20 +02:00
Federico Di Pierro 7711a9b144 chore(ci): directly mkdocs using downloaded svgs instead of inlining them.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 16:04:20 +02:00
Federico Di Pierro 48e858f5ca chore(ci,docs): disable ToC in perf gh pages.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 16:04:20 +02:00
Federico Di Pierro 5902d145a6 chore(ci): store PR info before checking threshold to avoid empty comments.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 11:45:19 +02:00
Federico Di Pierro cfab3dea3b fix(ci): fixed path to generate_inline_svg_md.py script.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 11:45:19 +02:00
Federico Di Pierro d1d7287716 chore(ci): install linux perf too in composite perf action.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 11:45:19 +02:00
Federico Di Pierro adce01a908 fix(ci): fixed deploy-pages job needs.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 11:45:19 +02:00
Luca Guerra 1b81ff0c3d cleanup(libsinsp): introduce param->as<std::string>(), add error for unsupported types
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-21 10:19:18 +02:00
Federico Di Pierro d26bc4cdce chore(ci): increase scap file threshold to 10% since it is a bit unstable.
Also, still do the scap file threshold check even if unit tests check failed.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 10:01:18 +02:00
Federico Di Pierro cb2466fc6d new(ci): move perf CI to a composite action.
It will be ran by perf CI on PRs and pages CI on master.
Also, add a new gh pages section with flamegraphs built from master.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-21 10:01:18 +02:00
Federico Di Pierro 273299c583 new(ci): added perf CI job around scap file read.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-20 14:09:12 +02:00
Jason Dellaluce c5f51cfd24 test(userspace/libsinsp): cover filter caching
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-06-20 11:49:13 +02:00
Jason Dellaluce f319ef8b41 refactor(userspace/libsinsp): polish and enable filter caching
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-06-20 11:49:13 +02:00
Andrea Terzolo 4172892487 fix(sinsp): invalid threads shoudln't be in a pid namespace
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-06-20 11:42:12 +02:00
Federico Di Pierro 3c1264cb5f new(ci): added an initial perf-related CI.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-20 09:29:12 +02:00
Luca Guerra c7bef3ef72 fix(libsinsp): add missing include map
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-19 17:15:08 +02:00
Luca Guerra c1db02a49a cleanup(libsinsp): remove unreachable code in utils.cpp
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-19 11:17:08 +02:00
Lorenzo Susini d1d021fc76 chore: change naming to proc.std{in,out,err} for simplicity
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-06-18 15:25:03 +02:00
Lorenzo Susini 75d1f9c424 test(userspace/libsinsp): test stdin, stdout, stderr type and name fields
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-06-18 15:25:03 +02:00
Lorenzo Susini 57f516886b update(userspace/libsinsp): avoid code duplication when handling proc.fd fields
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-06-18 15:25:03 +02:00
Lorenzo Susini 4d2bc8b4e1 update(userspace/libsinsp): add also proc.fd.*.name fields
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-06-18 15:25:03 +02:00
Lorenzo Susini 1eb1825684 update(userspace/libsinsp): add filter checks to extract process' stdin,stdout,stderr types
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-06-18 15:25:03 +02:00
Andrea Terzolo c3e482cf4d fix(libsinsp): resize the param storage in case of a long path
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-06-18 12:01:02 +02:00
Luca Guerra d0908f9ffa new(test): add test for gvisor config generator
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-17 18:23:00 +02:00
Luca Guerra 570b86c1d7 cleanup(libsinsp): remove misaligned access from sinsp_filtercheck.cpp
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-17 15:53:00 +02:00
Luca Guerra b3154eb84d new(tests): add tests for event result
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-17 15:53:00 +02:00
Luca Guerra 435a391e02 cleanup(tests): move filter compilation functions to sinsp_with_test_input
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-17 15:52:00 +02:00
Jason Dellaluce dbb6d85fde test(userpsace/libsinsp): update subtable tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-06-14 19:16:51 +02:00
Jason Dellaluce fa28969150 update(userspace/libsinsp): export 'fd' field in fdtables
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-06-14 19:16:51 +02:00
Jason Dellaluce 2e87187eda fix(userspace/libsinsp)!: return truthful data in 'type' exported field of fd tables
Note, this is a potential breaking change due to the type of the exported field needing to change.
However, whoever tried to access this information up until now have accessed random byte blobs, so
this is effectively breaking something that never worked since its first release.

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-06-14 19:16:51 +02:00
Luca Guerra f8c50f9da1 new(tests): add tests for contains/icontains
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-14 15:43:50 +02:00
Federico Aponte 19b6911321 Add unit test for NSS users/groups
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-06-14 10:47:50 +02:00
Federico Aponte 3e4c26b6ea fix: Check the NNS user/group earlier
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-06-14 10:47:50 +02:00
Federico Aponte 50e73e0943 fix: Ignore NSS user and group entries
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-06-14 10:47:50 +02:00
Federico Di Pierro e3d0ab81fc fix(driver/bpf): fixed a couple of verifier issues.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-13 10:16:47 +02:00
Luca Guerra 774db6b944 update(tests): add tests for numeric compare
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-13 09:14:47 +02:00
Luca Guerra 8ff0321f0a fix(libsinsp): fix regression in signed comparison
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-06-13 09:14:47 +02:00
Federico Di Pierro 5c5edf2f58 chore(cmake): workaround CI issue for windows.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-06-12 10:02:43 +02:00
Melissa Kilby d2bb6749c8 chore: update test/vm setup
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-06-11 15:35:39 +02:00
Luca Guerra 8fa129caf5 update(build): update c-ares to 1.30.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
Co-authored-by: Teryl Taylor <terylt@ibm.com>
2024-06-11 15:28:40 +02:00
Gerald Combs e3eb9f4485 fix(userspace/libsinsp): Include cri.hpp in container.cpp
Include cri.hpp in container.cpp in order to avoid

```
/usr/bin/ld: /usr/lib/aarch64-linux-gnu/libsinsp.so: undefined reference to `libsinsp::cri::cri_interface<libsinsp::cri::cri_api_v1>::get_cri_runtime_type() const'
collect2: error: ld returned 1 exit status
```

when building with shared libs on Linux.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-06-11 15:17:40 +02:00
Federico Aponte 7472524465 fix: some compiler warnings (func def. w/o decl.)
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-06-04 16:50:13 +02:00
Gianmatteo Palmieri c6ff3d0731 chore(plugin_api): bump version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-06-03 13:20:09 +02:00
Gianmatteo Palmieri 88c81a9db5 fix(libsinsp): resolve get_metrics plugin symbol
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-06-03 13:20:09 +02:00
Gianmatteo Palmieri a5c6e95b9e fix(plugin_api): wrong metrics type enums
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-06-03 13:20:09 +02:00
poiana 58bf3a9313 update(driver): update syscalls tables and driver report.
Signed-off-by: GitHub <noreply@github.com>
2024-06-03 10:22:09 +02:00
Federico Di Pierro 40c079280d update(test/e2e): bump docker-py to 7.1.0 that correctly uses new requests API.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-31 11:04:59 +02:00
Federico Di Pierro 1771f25efc chore(test): bump to requests 2.32.2 with the workaround.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-31 11:04:59 +02:00
dependabot[bot] 40be8fb78e ---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-31 11:04:59 +02:00
Andrea Terzolo 3b93d91e05 cleanup(driver): fix some comments
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-30 18:36:57 +02:00
Federico Di Pierro 1d31ad615f new(userspace/libsinsp): support lxc 4.0 cgroup layout.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-29 13:09:49 +02:00
Federico Di Pierro 62a63997a0 fix(userspace/libsinsp): fixed possible buffer overflow in `sinsp_plugin::get_metrics`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-29 12:53:49 +02:00
Jason Dellaluce e5cec9c29a fix(cmake): solve few compilation issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-29 09:49:49 +02:00
Jason Dellaluce 2973ee8db7 update(cmake): propagate position-independent code option to dependencies
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-29 09:49:49 +02:00
Roberto Scolaro 00b4d19468 fix(test/e2e): pin python requests version
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 070ffb4121 fix(libsinsp_e2e): increase tcp_client_server* tests stability
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro ca9ea7da01 fix(modern_bpf): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 50cd63ec87 fix(bpf): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 44794ad1fc fix(libsinsp_e2e): increase tcp_client_server test stability
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 4019141d78 fix(bpf): fix missing definitions
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 297c9ecf02 fix(modern_bpf): define the compat timespec in struct flavors
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 6697700422 fix(bpf): use CONFIG_COMPAT to exclude ia32 calls
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo e4157c2111 refactor(modern_bpf): split iovec helper in 32/64 bit variants
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 9998f34a26 cleanup(modern_bpf,bpf): use already defined struct
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo bb671faa61 cleanup(bpf): rename 32/64bit bpf helpers
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 8e6dc0b15a fix(libsinsp_e2e): remove flaky test
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo b03fae0d18 fix(modern_bpf): read MAX_UNIX_SOCKET_PATH from sockaddr
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 87ca9c6721 refactor(bpf): split bpf_parse_readv_writev_bufs even more
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 8c4fdc3a61 refactor(bpf): split ia32 bpf_parse_readv_writev_bufs helper
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro b139e75a92 fix(bpf): fix bpf on aarch64
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 004c446841 cleanup(bpf): hide ia32 login in helper function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro be6ab94e7a cleanup(bpf): remove useless ifdefs
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 72ea7618b3 fix(bpf): cast incompatibile pointer
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 03386b4fa8 fix(ci): workaround to avoid random failures of asan
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 63b4e8bb8d fix(libsinsp_e2e): add retry to subprocess class
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 764d618a3f fix(modern_bpf): avoid overflow reading sockaddr_storage
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 76b61c5409 fix(libsinsp_e2e): dump only necessary events
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro fea266dabe update(e2e_ci): bump actions
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 9936fc1f91 fix(bpf,modern_bpf): better 32bit support preadv/pwritev family
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
Roberto Scolaro 02fd7ece74 new(libsinsp_e2e): new misc tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-21 14:12:15 +02:00
therealbobo 4a7ebc4bf2 fix(bpf): better timespec support for ia32
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-05-21 14:12:15 +02:00
Federico Di Pierro f3b0b367ac fix(driver/bpf): fixed old bpf probe with clang-18.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-20 16:16:14 +02:00
1348 changed files with 123384 additions and 97384 deletions

View File

@ -1,16 +1,36 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -8
BreakBeforeBraces: Allman
BasedOnStyle: Google
AccessModifierOffset: -4
BreakBeforeBraces: Attach
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
ColumnLimit: 100
DerivePointerBinding: false
IndentCaseLabels: false
IndentWidth: 4
SpaceAfterTemplateKeyword: false
TabWidth: 4
UseTab: ForIndentation
BreakConstructorInitializers: AfterColon
ColumnLimit: 120
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
DerivePointerAlignment: true
IndentWidth: 8
SortIncludes: false
SpaceAfterTemplateKeyword: false
SortIncludes: Never
SpaceBeforeCtorInitializerColon: false
SpaceBeforeParens: Never
UseTab: Always
InsertNewlineAtEOF: true
---
Language: Proto
DisableFormat: true
---
Language: JavaScript
DisableFormat: true
---
Language: Java
DisableFormat: true

16
.clang-format-ignore Normal file
View File

@ -0,0 +1,16 @@
# All vmlinux autogenerated headers are not formatted
driver/modern_bpf/definitions/aarch64/vmlinux.h
driver/modern_bpf/definitions/ppc64le/vmlinux.h
driver/modern_bpf/definitions/s390x/vmlinux.h
driver/modern_bpf/definitions/x86_64/vmlinux.h
# Autogenerated events dimensions file for modern probe is not formatted
driver/modern_bpf/definitions/events_dimensions.h
# All syscall_compat autogenerated headers are not formatted
driver/syscall_compat_aarch64.h
driver/syscall_compat_loongarch64.h
driver/syscall_compat_ppc64le.h
driver/syscall_compat_riscv64.h
driver/syscall_compat_s390x.h
driver/syscall_compat_x86_64.h
driver/syscall_ia32_64_map.c
driver/syscall_table.c

16
.clang-tidy Normal file
View File

@ -0,0 +1,16 @@
Checks:
- clang-diagnostic-*
- clang-analyzer-*
- clang-analyzer-core.*
- clang-analyzer-cplusplus.*
- clang-analyzer-nullability.*
- clang-analyzer-unix.*
- performance-*
- bugprone-use-after-move
- bugprone-move-forwarding-reference
- cppcoreguidelines-rvalue-reference-param-not-moved
- misc-unused-parameters
WarningsAsErrors: 'bugprone-use-after-move'
# UseColor true causes sarif conversion and reviewdog fail
UseColor: false
ExtraArgsBefore: ['-Wno-unknown-warning-option']

254
.cmake-format.json Normal file
View File

@ -0,0 +1,254 @@
{
"_help_format": "Options affecting formatting.",
"format": {
"_help_disable": [
"Disable formatting entirely, making cmake-format a no-op"
],
"disable": false,
"_help_line_width": [
"How wide to allow formatted cmake files"
],
"line_width": 100,
"_help_tab_size": [
"How many spaces to tab for indent"
],
"tab_size": 4,
"_help_use_tabchars": [
"If true, lines are indented using tab characters (utf-8",
"0x09) instead of <tab_size> space characters (utf-8 0x20).",
"In cases where the layout would require a fractional tab",
"character, the behavior of the fractional indentation is",
"governed by <fractional_tab_policy>"
],
"use_tabchars": true,
"_help_fractional_tab_policy": [
"If <use_tabchars> is True, then the value of this variable",
"indicates how fractional indentions are handled during",
"whitespace replacement. If set to 'use-space', fractional",
"indentation is left as spaces (utf-8 0x20). If set to",
"`round-up` fractional indentation is replaced with a single",
"tab character (utf-8 0x09) effectively shifting the column",
"to the next tabstop"
],
"fractional_tab_policy": "use-space",
"_help_max_subgroups_hwrap": [
"If an argument group contains more than this many sub-groups",
"(parg or kwarg groups) then force it to a vertical layout."
],
"max_subgroups_hwrap": 2,
"_help_max_pargs_hwrap": [
"If a positional argument group contains more than this many",
"arguments, then force it to a vertical layout."
],
"max_pargs_hwrap": 6,
"_help_max_rows_cmdline": [
"If a cmdline positional group consumes more than this many",
"lines without nesting, then invalidate the layout (and nest)"
],
"max_rows_cmdline": 2,
"_help_separate_ctrl_name_with_space": [
"If true, separate flow control names from their parentheses",
"with a space"
],
"separate_ctrl_name_with_space": false,
"_help_separate_fn_name_with_space": [
"If true, separate function names from parentheses with a",
"space"
],
"separate_fn_name_with_space": false,
"_help_dangle_parens": [
"If a statement is wrapped to more than one line, than dangle",
"the closing parenthesis on its own line."
],
"dangle_parens": true,
"_help_dangle_align": [
"If the trailing parenthesis must be 'dangled' on its on",
"line, then align it to this reference: `prefix`: the start",
"of the statement, `prefix-indent`: the start of the",
"statement, plus one indentation level, `child`: align to",
"the column of the arguments"
],
"dangle_align": "prefix",
"_help_min_prefix_chars": [
"If the statement spelling length (including space and",
"parenthesis) is smaller than this amount, then force reject",
"nested layouts."
],
"min_prefix_chars": 4,
"_help_max_prefix_chars": [
"If the statement spelling length (including space and",
"parenthesis) is larger than the tab width by more than this",
"amount, then force reject un-nested layouts."
],
"max_prefix_chars": 10,
"_help_max_lines_hwrap": [
"If a candidate layout is wrapped horizontally but it exceeds",
"this many lines, then reject the layout."
],
"max_lines_hwrap": 2,
"_help_line_ending": [
"What style line endings to use in the output."
],
"line_ending": "unix",
"_help_command_case": [
"Format command names consistently as 'lower' or 'upper' case"
],
"command_case": "canonical",
"_help_keyword_case": [
"Format keywords consistently as 'lower' or 'upper' case"
],
"keyword_case": "unchanged",
"_help_always_wrap": [
"A list of command names which should always be wrapped"
],
"always_wrap": [],
"_help_enable_sort": [
"If true, the argument lists which are known to be sortable",
"will be sorted lexicographicall"
],
"enable_sort": true,
"_help_autosort": [
"If true, the parsers may infer whether or not an argument",
"list is sortable (without annotation)."
],
"autosort": false,
"_help_require_valid_layout": [
"By default, if cmake-format cannot successfully fit",
"everything into the desired linewidth it will apply the",
"last, most agressive attempt that it made. If this flag is",
"True, however, cmake-format will print error, exit with non-",
"zero status code, and write-out nothing"
],
"require_valid_layout": false,
"_help_layout_passes": [
"A dictionary mapping layout nodes to a list of wrap",
"decisions. See the documentation for more information."
],
"layout_passes": {}
},
"_help_markup": "Options affecting comment reflow and formatting.",
"markup": {
"_help_bullet_char": [
"What character to use for bulleted lists"
],
"bullet_char": "*",
"_help_enum_char": [
"What character to use as punctuation after numerals in an",
"enumerated list"
],
"enum_char": ".",
"_help_first_comment_is_literal": [
"If comment markup is enabled, don't reflow the first comment",
"block in each listfile. Use this to preserve formatting of",
"your copyright/license statements."
],
"first_comment_is_literal": false,
"_help_literal_comment_pattern": [
"If comment markup is enabled, don't reflow any comment block",
"which matches this (regex) pattern. Default is `None`",
"(disabled)."
],
"literal_comment_pattern": null,
"_help_fence_pattern": [
"Regular expression to match preformat fences in comments",
"default= ``r'^\\s*([`~]{3}[`~]*)(.*)$'``"
],
"fence_pattern": "^\\s*([`~]{3}[`~]*)(.*)$",
"_help_ruler_pattern": [
"Regular expression to match rulers in comments default=",
"``r'^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'``"
],
"ruler_pattern": "^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$",
"_help_explicit_trailing_pattern": [
"If a comment line matches starts with this pattern then it",
"is explicitly a trailing comment for the preceeding",
"argument. Default is '#<'"
],
"explicit_trailing_pattern": "#<",
"_help_hashruler_min_length": [
"If a comment line starts with at least this many consecutive",
"hash characters, then don't lstrip() them off. This allows",
"for lazy hash rulers where the first hash char is not",
"separated by space"
],
"hashruler_min_length": 10,
"_help_canonicalize_hashrulers": [
"If true, then insert a space between the first hash char and",
"remaining hash chars in a hash ruler, and normalize its",
"length to fill the column"
],
"canonicalize_hashrulers": true,
"_help_enable_markup": [
"enable comment markup parsing and reflow"
],
"enable_markup": true
},
"_help_lint": "Options affecting the linter",
"lint": {
"_help_disabled_codes": [
"a list of lint codes to disable"
],
"disabled_codes": [],
"_help_function_pattern": [
"regular expression pattern describing valid function names"
],
"function_pattern": "[0-9a-z_]+",
"_help_macro_pattern": [
"regular expression pattern describing valid macro names"
],
"macro_pattern": "[0-9A-Z_]+",
"_help_global_var_pattern": [
"regular expression pattern describing valid names for",
"variables with global (cache) scope"
],
"global_var_pattern": "[A-Z][0-9A-Z_]+",
"_help_internal_var_pattern": [
"regular expression pattern describing valid names for",
"variables with global scope (but internal semantic)"
],
"internal_var_pattern": "_[A-Z][0-9A-Z_]+",
"_help_local_var_pattern": [
"regular expression pattern describing valid names for",
"variables with local scope"
],
"local_var_pattern": "[a-z][a-z0-9_]+",
"_help_private_var_pattern": [
"regular expression pattern describing valid names for",
"privatedirectory variables"
],
"private_var_pattern": "_[0-9a-z_]+",
"_help_public_var_pattern": [
"regular expression pattern describing valid names for public",
"directory variables"
],
"public_var_pattern": "[A-Z][0-9A-Z_]+",
"_help_argument_var_pattern": [
"regular expression pattern describing valid names for",
"function/macro arguments and loop variables."
],
"argument_var_pattern": "[a-z][a-z0-9_]+",
"_help_keyword_pattern": [
"regular expression pattern describing valid names for",
"keywords used in functions or macros"
],
"keyword_pattern": "[A-Z][0-9A-Z_]+",
"_help_max_conditionals_custom_parser": [
"In the heuristic for C0201, how many conditionals to match",
"within a loop in before considering the loop a parser."
],
"max_conditionals_custom_parser": 2,
"_help_min_statement_spacing": [
"Require at least this many newlines between statements"
],
"min_statement_spacing": 1,
"_help_max_statement_spacing": [
"Require no more than this many newlines between statements"
],
"max_statement_spacing": 2,
"max_returns": 6,
"max_branches": 12,
"max_arguments": 5,
"max_localvars": 15,
"max_statements": 50
}
}

16
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,16 @@
# These commits altered the blame only to change types
89ec22f38ce06145a10d52fd9be2cb1b872bfd11
4dd9c8a2517dcda5aab0fc7a26197e74bf557fd6
9326b1dd23efd095908a723a1d94acbe91032cab
c8b971ecbff766003c736f01c0455e73dbd0efb3
a5730f7a18e2e81b270105c2f81cf6c6a0201feb
56b6e591cf8bf6849c27adfccc1557835daa1529
93240ff1106f54add1e620e861bdfe890cf99108
5c9b3cd3eb485ff8e4a3c364383f246d79146194
0736581e22da38f260e01b64a9c73a4d66c7c02a
2bea7ba762ed916eaf283066b20ad989b77276a6
# This commit formatted the libs code for the first time.
215db2d9de0cb15061873a2e3bea33f731a54cab
# This commit has completely rewritten the history of file `userspace/libscap/engine/savefile/scap_savefile.c`.
# https://github.com/falcosecurity/libs/commit/a6df8fc90e3be0209c5a5f9bb0443077cd5d0967
a6df8fc90e3be0209c5a5f9bb0443077cd5d0967

View File

@ -20,6 +20,8 @@
> /kind failing-test
> /kind test
> /kind feature
<!--

View File

@ -0,0 +1,92 @@
name: 'libs-perf'
description: 'Run multiple perf tests on libs.'
outputs:
perf_tests:
description: "Unit tests perf.data"
value: ${{ steps.store-outputs.outputs.perf_tests }}
perf_scap:
description: "Scap file perf.data"
value: ${{ steps.store-outputs.outputs.perf_scap }}
heaptrack_tests:
description: "Unit tests heaptrack data"
value: ${{ steps.store-outputs.outputs.heaptrack_tests }}
heaptrack_scap:
description: "Scap file heaptrack data"
value: ${{ steps.store-outputs.outputs.heaptrack_scap }}
gbench_json:
description: "Google benchmarks json data"
value: ${{ steps.store-outputs.outputs.gbench_json }}
runs:
using: "composite"
steps:
- name: Install deps ⛓️
shell: bash
run: |
sudo apt update && sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-tools-common linux-tools-generic linux-tools-`uname -r` heaptrack coreutils util-linux
sudo .github/install-deps.sh
- name: Build
shell: bash
run: |
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=False -DCMAKE_BUILD_TYPE=Debug -DENABLE_BENCHMARKS=True ../
make unit-test-libsinsp -j4
make bench -j4
make sinsp-example -j4
- name: Download scap file
shell: bash
run: |
cd build
wget https://download.falco.org/fixtures/trace-files/traces-positive.zip
unzip traces-positive.zip
- name: Run - perf unit tests
shell: bash
run: |
cd build
sudo perf record --call-graph dwarf -o perf_tests.data -q libsinsp/test/unit-test-libsinsp
# First empty run to stabilize disk IO (scap file read) perf
- name: Run - load scap file
shell: bash
run: |
cd build
sudo ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap &> /dev/null
- name: Run - perf scap file
shell: bash
run: |
cd build
sudo perf record --call-graph dwarf -o perf_scap.data -q ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap
- name: Run - heaptrack unit tests
shell: bash
run: |
cd build
sudo heaptrack -o heaptrack_tests.data libsinsp/test/unit-test-libsinsp
- name: Run - heaptrack scap file
shell: bash
run: |
cd build
sudo heaptrack -o heaptrack_scap.data ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap
- name: Run - gbench
shell: bash
run: |
cd build
./benchmark/bench --benchmark_repetitions=20 --benchmark_report_aggregates_only --benchmark_out=gbench_data.json --benchmark_out_format=json
- name: Set Outputs
id: store-outputs
shell: bash
run: |
cd build
echo "perf_tests=$(realpath perf_tests.data)" >> $GITHUB_OUTPUT
echo "perf_scap=$(realpath perf_scap.data)" >> $GITHUB_OUTPUT
echo "heaptrack_tests=$(realpath heaptrack_tests.data.zst)" >> $GITHUB_OUTPUT
echo "heaptrack_scap=$(realpath heaptrack_scap.data.zst)" >> $GITHUB_OUTPUT
echo "gbench_json=$(realpath gbench_data.json)" >> $GITHUB_OUTPUT

43
.github/actions/install-zig/action.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: 'install-zig'
description: 'Install zig compiler and make it available in PATH.'
runs:
using: "composite"
steps:
- name: Store zig version as local output
shell: bash
id: store
env:
ZIG_VERSION: '0.14.1'
run: |
echo "zig_version=${ZIG_VERSION}" >> "$GITHUB_OUTPUT"
- name: Download zig
shell: bash
run: |
curl -L -o zig.tar.xz https://ziglang.org/download/${{ steps.store.outputs.zig_version }}/zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}.tar.xz
tar -xvf zig.tar.xz
cat > zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-cc <<EOF
#!/bin/bash
exec zig cc -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline "\$@"
EOF
chmod +x zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-cc
cat > zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-c++ <<EOF
#!/bin/bash
exec zig c++ -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline "\$@"
EOF
chmod +x zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-c++
mv zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/ zig
- name: Setup zig
shell: bash
id: zig
run: |
echo "$(pwd)/zig" >> $GITHUB_PATH
echo "CC=zig-cc" >> $GITHUB_ENV
echo "CXX=zig-c++" >> $GITHUB_ENV
echo "AR=zig ar" >> $GITHUB_ENV
echo "RANLIB=zig ranlib" >> $GITHUB_ENV

12
.github/dependabot.yaml vendored Normal file
View File

@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
actions:
update-types:
- "minor"
- "patch"

View File

@ -66,3 +66,8 @@ popd
echo "=== Downloading uthash.h (1.9.8) ==="
wget -P "/usr/include" "https://raw.githubusercontent.com/troydhanson/uthash/v1.9.8/src/uthash.h"
# === BS_thread_pool ===
echo "=== Downloading BS_thread_pool.h (4.1.0) ==="
wget -P "/usr/include" "https://github.com/bshoshany/thread-pool/raw/v4.1.0/include/BS_thread_pool.hpp"

View File

@ -16,30 +16,40 @@ concurrency:
jobs:
build-libs-linux:
name: build-libs-linux-${{ matrix.arch }} 😁 (${{ matrix.name }})
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
name: [system_deps, bundled_deps, system_deps_minimal, sanitizers]
name: [system_deps, bundled_deps, sanitizers, zig]
include:
- name: system_deps
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=True
- name: system_deps_minimal
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=False -DMINIMAL_BUILD=True
- name: sanitizers
cmake_opts: -DUSE_ASAN=On -DUSE_UBSAN=On -DUSE_BUNDLED_DEPS=False
- name: zig
cmake_opts: -DUSE_BUNDLED_DEPS=True
container:
image: debian:buster
steps:
- name: Install deps ⛓️
run: |
apt update && apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-headers-${{ matrix.arch }}
# Use 20250630T203427Z debian apt snapshot as it still contains support for buster.
printf "deb http://snapshot.debian.org/archive/debian/20250630T203427Z buster main\ndeb http://snapshot.debian.org/archive/debian-security/20250630T203427Z buster/updates main\ndeb http://snapshot.debian.org/archive/debian/20250630T203427Z buster-updates main" > /etc/apt/sources.list
apt update && apt install -y --no-install-recommends curl ca-certificates build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-${{ matrix.arch }}
- name: Install a recent version of CMake ⛓️
run: |
curl -L -o /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-linux-$(uname -m).tar.gz
gzip -d /tmp/cmake.tar.gz
tar -xpf /tmp/cmake.tar --directory=/tmp
cp -R /tmp/cmake-3.22.5-linux-$(uname -m)/* /usr
rm -rf /tmp/cmake-3.22.5-linux-$(uname -m)/
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -51,15 +61,39 @@ jobs:
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Install zig
if: matrix.name == 'zig'
uses: ./.github/actions/install-zig
- name: Build and test 🏗️🧪
env:
UBSAN_OPTIONS: print_stacktrace=1
run: |
mkdir -p build
cd build && cmake ${{ matrix.cmake_opts }} ../
cd build && cmake ${{ matrix.cmake_opts }} -DENABLE_THREAD_POOL=ON ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
make run-unit-tests
- name: Test sinsp-example and .scap files
run: |
cd build && make sinsp-example
libsinsp/examples/sinsp-example -s ../test/libsinsp_e2e/resources/captures/curl_google.scap | grep --extended-regexp --invert-match '^(Time spent|Events/ms): ' > /tmp/curl_google.txt
libsinsp/examples/sinsp-example -s ../test/libsinsp_e2e/resources/captures/curl_google_comments.scap | grep --extended-regexp --invert-match '^(Time spent|Events/ms): ' > /tmp/curl_google_comments.txt
diff -u /tmp/curl_google.txt /tmp/curl_google_comments.txt
# On zig, build also sinsp-example and check the glibc linked versions
# to make sure we are actually using the correct glibc version.
- name: Test zig build glibc version
if: matrix.name == 'zig'
run: |
cd build
objdump -T libsinsp/test/unit-test-libsinsp | grep -Eo 'GLIBC_\S+' | sort -u -t "." -k1,1n -k2,2n -k3,3n
linked_glibc=$(objdump -T libsinsp/test/unit-test-libsinsp | grep -Eo 'GLIBC_\S+' | sort -u -t "." -k1,1n -k2,2n -k3,3n | tail -n1 | tr -d ')')
if [ "$linked_glibc" != "GLIBC_2.17" ]; then
echo "Expected glibc 2.17; found $linked_glibc"
exit 1
fi
build-libs-linux-amd64-static:
name: build-libs-linux-amd64-static 🎃
runs-on: ubuntu-latest
@ -68,10 +102,14 @@ jobs:
steps:
- name: Install deps ⛓️
run: |
apk add g++ gcc cmake make git bash perl linux-headers autoconf automake m4 libtool elfutils-dev libelf-static patch binutils bpftool clang
apk add g++ gcc cmake make git bash perl linux-headers autoconf automake m4 libtool elfutils-dev libelf-static patch binutils clang llvm
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && make install
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -82,32 +120,28 @@ jobs:
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DBUILD_BPF=On -DBUILD_DRIVER=Off -DUSE_BUNDLED_DEPS=On -DUSE_BUNDLED_LIBELF=Off -DUSE_SHARED_LIBELF=Off -DBUILD_LIBSCAP_MODERN_BPF=ON -DMUSL_OPTIMIZED_BUILD=On ../
cd build && cmake -DBUILD_BPF=On -DBUILD_DRIVER=Off -DUSE_BUNDLED_DEPS=On -DUSE_BUNDLED_LIBELF=Off -DUSE_SHARED_LIBELF=Off -DBUILD_LIBSCAP_MODERN_BPF=ON -DMUSL_OPTIMIZED_BUILD=On -DENABLE_THREAD_POOL=ON ../
make run-unit-tests -j4
build-shared-libs-linux-amd64:
name: build-shared-libs-linux-amd64 🧐
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Git safe directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Install deps ⛓️
run: |
sudo apt update
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libre2-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-headers-$(uname -r)
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libre2-dev libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-$(uname -r)
sudo .github/install-deps.sh
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DBUILD_SHARED_LIBS=True -DUSE_BUNDLED_DEPS=False -DMINIMAL_BUILD=True -DCMAKE_INSTALL_PREFIX=/tmp/libs-test ../
cd build && cmake -DBUILD_SHARED_LIBS=True -DUSE_BUNDLED_DEPS=False -DCMAKE_INSTALL_PREFIX=/tmp/libs-test -DENABLE_THREAD_POOL=ON ../
make -j4
make run-unit-tests
@ -120,7 +154,7 @@ jobs:
run: |
cd userspace/libsinsp/examples
export PKG_CONFIG_PATH=/tmp/libs-test/lib/pkgconfig
g++ -o sinsp-example test.cpp util.cpp $(pkg-config --cflags --libs libsinsp)
g++ -o sinsp-example *.cpp $(pkg-config --cflags --libs libsinsp)
- name: Test sinsp-example runtime linker
run: |
@ -140,24 +174,22 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.crt }} -DCREATE_TEST_TARGETS=ON -DMINIMAL_BUILD=ON ..
cmake --build . --config Release && make run-unit-tests || libsinsp\test\Release\unit-test-libsinsp.exe
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.crt }} -DCREATE_TEST_TARGETS=ON -DENABLE_THREAD_POOL=ON ..
cmake --build . --config Release --parallel 4 && make run-unit-tests || libsinsp\test\Release\unit-test-libsinsp.exe
build-shared-libs-macos-amd64:
name: build-shared-libs-macos-amd64 😨
strategy:
fail-fast: false
runs-on: macos-latest
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -168,8 +200,8 @@ jobs:
- name: Build 🏗️
run: |
mkdir -p build
cd build && cmake -DBUILD_SHARED_LIBS=True -DUSE_BUNDLED_DEPS=False -DUSE_BUNDLED_VALIJSON=ON -DCMAKE_BUILD_TYPE=Release -DCREATE_TEST_TARGETS=OFF -DMINIMAL_BUILD=ON -DCMAKE_INSTALL_PREFIX=/tmp/libs-test ..
cmake --build . --config Release
cd build && cmake -DBUILD_SHARED_LIBS=True -DUSE_BUNDLED_DEPS=False -DUSE_BUNDLED_VALIJSON=ON -DUSE_BUNDLED_BS_THREADPOOL=ON -DENABLE_THREAD_POOL=ON -DCMAKE_BUILD_TYPE=Release -DCREATE_TEST_TARGETS=OFF -DCMAKE_INSTALL_PREFIX=/tmp/libs-test ..
cmake --build . --config Release --parallel $(getconf _NPROCESSORS_ONLN)
- name: Install
run: |
@ -194,7 +226,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -226,96 +258,15 @@ jobs:
diff -u expected_ldd_out.txt ldd_out.txt
run-e2e-tests-amd64:
name: run-e2e-tests-amd64
strategy:
fail-fast: false
matrix:
name: [system_deps, bundled_deps, asan]
include:
- name: system_deps
cmake_opts: -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DUSE_BUNDLED_DEPS=True
- name: asan
cmake_opts: -DUSE_BUNDLED_DEPS=True -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address
runs-on: ubuntu-22.04
steps:
- name: Install deps ⛓️
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
clang-14 llvm-14 \
git \
clang \
llvm \
pkg-config \
autoconf \
automake \
libtool \
libelf-dev \
wget \
libc-ares-dev \
libbpf-dev \
libcap-dev \
libcurl4-openssl-dev \
libssl-dev \
libtbb-dev \
libjq-dev \
libjsoncpp-dev \
libgrpc++-dev \
protobuf-compiler-grpc \
libgtest-dev \
libprotobuf-dev \
"linux-headers-$(uname -r)"
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
uses: ./.github/workflows/reusable_e2e_tests.yaml
with:
libsversion: ${{ github.sha }}
secrets: inherit
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Install deps ⛓️
run: |
sudo .github/install-deps.sh
- name: Git safe directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Build and test 🏗️🧪
run: |
mkdir -p build && cd build
cmake -DBUILD_BPF=ON \
-DBUILD_LIBSCAP_MODERN_BPF=ON \
-DBUILD_LIBSCAP_GVISOR=OFF \
${{ matrix.cmake_opts }} \
-DUSE_BUNDLED_LIBBPF=ON \
..
make -j$(nproc) sinsp-example driver bpf
sudo make e2e-install-deps
sudo ../test/e2e/scripts/run_tests.sh
- name: Archive test reports
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: failure()
with:
name: ${{ matrix.name }}_report
path: |
${{ github.workspace }}/build/report/
build-libs-emscripten:
name: build-libs-emscripten 🧐
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Install deps ⛓️
run: |
@ -323,14 +274,10 @@ jobs:
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential clang-14 llvm-14 git pkg-config autoconf automake libtool libelf-dev libcap-dev linux-headers-$(uname -r) emscripten
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Git safe directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Build and test 🏗️🧪
run: |
mkdir -p build

View File

@ -0,0 +1,87 @@
# NOTE: This has read-write repo token and access to secrets, so this must
# not run any untrusted code.
# see: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Comment with Kernel testing results on pull requests
on:
workflow_run:
workflows: ["Drivers CI Build"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request'
steps:
- name: 'Download artifact'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr-kernel-testing"
});
if (!Array.isArray(matchArtifacts) || !matchArtifacts.length) {
var process = require('process');
process.exit();
}
var matchArtifact = matchArtifacts[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- name: 'Unpack artifact'
run: |
if [ -f pr.zip ]; then
unzip pr.zip
fi
- name: 'Comment on PR'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Taken from https://github.com/actions/github-script/blob/main/.github/workflows/pull-request-test.yml
script: |
var fs = require('fs');
if (!fs.existsSync('./NR')) {
var process = require('process');
process.exit();
}
var issue_number = Number(fs.readFileSync('./NR'));
var comment_body = fs.readFileSync('./COMMENT');
// Get the existing comments.
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
});
// Find any comment already made by the bot.
const botComment = comments.find(comment => comment.user.id === 41898282 && comment.body.includes('# X64 kernel testing matrix'));
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment_body.toString('utf8')
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: comment_body.toString('utf8')
});
}

View File

@ -0,0 +1,87 @@
# NOTE: This has read-write repo token and access to secrets, so this must
# not run any untrusted code.
# see: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Comment with Perf diff on pull requests
on:
workflow_run:
workflows: ["Perf CI"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request'
steps:
- name: 'Download artifact'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr-perf"
});
if (!Array.isArray(matchArtifacts) || !matchArtifacts.length) {
var process = require('process');
process.exit();
}
var matchArtifact = matchArtifacts[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- name: 'Unpack artifact'
run: |
if [ -f pr.zip ]; then
unzip pr.zip
fi
- name: 'Comment on PR'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Taken from https://github.com/actions/github-script/blob/main/.github/workflows/pull-request-test.yml
script: |
var fs = require('fs');
if (!fs.existsSync('./NR')) {
var process = require('process');
process.exit();
}
var issue_number = Number(fs.readFileSync('./NR'));
var comment_body = fs.readFileSync('./COMMENT');
// Get the existing comments.
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
});
// Find any comment already made by the bot.
const botComment = comments.find(comment => comment.user.id === 41898282 && comment.body.includes('# Perf diff from master'));
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment_body.toString('utf8')
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: comment_body.toString('utf8')
});
}

View File

@ -12,7 +12,6 @@ on:
- 'driver/ppm_events_public.h'
- 'driver/bpf/maps.h'
- 'driver/modern_bpf/maps/maps.h'
jobs:
paths-filter:
@ -20,8 +19,8 @@ jobs:
outputs:
driver_api_changed: ${{ steps.filter.outputs.driver_api }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@ -36,7 +35,7 @@ jobs:
if: needs.paths-filter.outputs.driver_api_changed == 'false'
steps:
- name: Check driver API_VERSION
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096 # v2.8.1
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
message: |
Please double check **driver/API_VERSION** file. See [versioning](https://github.com/falcosecurity/libs/blob/master/driver/README.VERSION.md#api-version-number).

View File

@ -19,8 +19,8 @@ jobs:
outputs:
driver_schema_changed: ${{ steps.filter.outputs.driver_schema }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@ -34,14 +34,14 @@ jobs:
needs: paths-filter
if: needs.paths-filter.outputs.driver_schema_changed == 'false'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check driver SCHEMA_VERSION
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096 # v2.8.1
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
message: |
Please double check **driver/SCHEMA_VERSION** file. See [versioning](https://github.com/falcosecurity/libs/blob/master/driver/README.VERSION.md#schema-version-number).
/hold
- name: Trigger failure

View File

@ -37,7 +37,7 @@ jobs:
- name: Test drivers build on ${{ matrix.name }}
run: |
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 }}
build-drivers-arm64:
strategy:
matrix:
@ -55,7 +55,7 @@ jobs:
kernelrelease: 6.4.1-1.el9.elrepo.aarch64
target: centos
kernelurls: https://download.falco.org/fixtures/libs/kernel-ml-devel-6.4.1-1.el9.elrepo.aarch64.rpm
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
container:
image: falcosecurity/driverkit:latest
steps:

View File

@ -24,8 +24,8 @@ jobs:
libscap: ${{ steps.filter.outputs.libscap }}
libpman: ${{ steps.filter.outputs.libpman }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@ -39,7 +39,7 @@ jobs:
# This job run all engine tests and scap-open
test-scap:
name: test-scap-${{ matrix.arch }} 😆 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
needs: paths-filter
strategy:
matrix:
@ -48,14 +48,14 @@ jobs:
- arch: amd64
enable_gvisor: True
- arch: amd64
enable_gvisor: False
fail-fast: false
enable_gvisor: False
fail-fast: false
steps:
- name: Checkout Libs ⤵️
# We need to skip each step because of https://github.com/orgs/community/discussions/9141.
# This avoids having a skipped job whose name is not the resolved matrix name, like "test-scap-${{ matrix.arch }} 😆 (bundled_deps)"
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -63,29 +63,17 @@ jobs:
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
sudo apt update
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential clang-14 llvm-14 git pkg-config autoconf automake libtool libelf-dev libcap-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential clang llvm git pkg-config autoconf automake libtool libelf-dev libcap-dev linux-headers-$(uname -r)
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && sudo make install
- name: Install kernel headers (actuated)
uses: self-actuated/get-kernel-sources@201eed7d915ac0a6021fb402cde5be7a6b945b59
if: (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') && matrix.arch == 'arm64'
- name: Install kernel headers
if: (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') && matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends linux-headers-$(uname -r)
- name: Build scap-open and drivers 🏗️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=On -DBUILD_DRIVER=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DBUILD_BPF=On -DBUILD_LIBSCAP_GVISOR=${{ matrix.enable_gvisor }} -DCREATE_TEST_TARGETS=On -DENABLE_LIBSCAP_TESTS=On ../
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=On -DBUILD_DRIVER=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DBUILD_BPF=On -DBUILD_LIBSCAP_GVISOR=${{ matrix.enable_gvisor }} -DCREATE_TEST_TARGETS=On -DENABLE_LIBSCAP_TESTS=On -DUSE_ASAN=On -DUSE_UBSAN=On ../
make scap-open driver bpf libscap_test -j6
- name: Run scap-open with modern bpf 🏎️
@ -114,9 +102,16 @@ jobs:
cd build
sudo ./test/libscap/libscap_test
- name: Validate scap-open with modern bpf
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: Andreagit97/bpfvalidator@v0.3.0
with:
args: |
--config=$GITHUB_WORKSPACE/driver/modern_bpf/bpfvalidator_config.yaml --cmd="$GITHUB_WORKSPACE/build/libscap/examples/01-open/scap-open --modern_bpf --num_events 10"
test-drivers:
name: test-drivers-${{ matrix.arch }} 😇 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
needs: paths-filter
strategy:
matrix:
@ -125,7 +120,7 @@ jobs:
steps:
- name: Checkout Libs ⤵️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -133,29 +128,22 @@ jobs:
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
sudo apt update
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git pkg-config autoconf automake libelf-dev libcap-dev clang-14 llvm-14 libtool
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git pkg-config autoconf automake libelf-dev libcap-dev clang llvm libtool linux-headers-$(uname -r)
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && sudo make install
- name: Install kernel headers (actuated)
uses: self-actuated/get-kernel-sources@201eed7d915ac0a6021fb402cde5be7a6b945b59
if: (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') && matrix.arch == 'arm64'
- name: Install kernel headers and gcc
- name: Install multilib compilers for ia32 tests
if: (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') && matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends linux-headers-$(uname -r) gcc-multilib g++-multilib
sudo apt install -y --no-install-recommends gcc-multilib g++-multilib
- name: Build drivers tests 🏗️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF ../
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF ../
make drivers_test driver bpf -j6
- name: Run drivers_test with modern bpf 🏎️
@ -175,18 +163,21 @@ jobs:
run: |
cd build
sudo ./test/drivers/drivers_test -k
test-drivers-ppc64le:
name: test-drivers-ppc64le 😁 (system_deps,custom node)
runs-on: ubuntu-22.04
# Avoid running on forks since this job uses a private secret
# not available on forks, leading to failures.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'falcosecurity/libs'
needs: paths-filter
steps:
- name: Extract branch name
run: echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
- name: Build and test drivers on ppc64le node via ssh
if: needs.paths-filter.outputs.driver_needs_rebuild
uses: appleboy/ssh-action@v1.0.3
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: appleboy/ssh-action@2ead5e36573f08b82fbfce1504f1a4b05a647c6f # v1.2.2
with:
host: ${{ secrets.PPC64LE_HOST }}
username: ${{ secrets.PPC64LE_USERNAME }}
@ -196,10 +187,12 @@ jobs:
command_timeout: 60m
script: |
sudo dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf automake libbpf-devel
# Remove, if present, any libs clone created by a previous job run.
rm -rf libs
git clone -b $GIT_BRANCH $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git libs
cd libs
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF ../
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF -DUSE_BUNDLED_LIBELF=OFF ../
make drivers_test driver bpf -j6
sudo ./test/drivers/drivers_test -m
rc_modern=$?
@ -208,7 +201,7 @@ jobs:
sudo ./test/drivers/drivers_test -k
rc_kmod=$?
exit $(($rc_modern + $rc_bpf +$rc_kmod))
build-drivers-s390x:
name: build-drivers-s390x 😁 (system_deps)
runs-on: ubuntu-22.04
@ -216,11 +209,11 @@ jobs:
steps:
- name: Checkout Libs ⤵️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: uraimo/run-on-arch-action@4ed76f16f09d12e83abd8a49e1ac1e5bf08784d4 # v2.5.1
- uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1
name: Run s390x build 🏗️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
with:
@ -229,29 +222,30 @@ jobs:
githubToken: ${{ github.token }}
install: |
apt update && apt install -y --no-install-recommends ca-certificates cmake build-essential clang llvm git pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libcap-dev libgtest-dev libprotobuf-dev linux-headers-generic
apt update && apt install -y --no-install-recommends ca-certificates cmake build-essential clang llvm git pkg-config autoconf automake libtool libelf-dev wget libtbb-dev libjq-dev libjsoncpp-dev libcap-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-generic
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && make install
cd ../../
git clone https://github.com/libbpf/libbpf.git --branch v1.3.0 --single-branch
cd libbpf/src && BUILD_STATIC_ONLY=y DESTDIR=/ make install
cd libbpf/src && BUILD_STATIC_ONLY=y DESTDIR=/ make install install_uapi_headers
ln -s /usr/lib64/libbpf.a /usr/lib/s390x-linux-gnu/
ln -s /usr/include/bpf /usr/include/s390x-linux-gnu/
# Please note: we cannot inject the BPF probe inside QEMU, so right now, we only build it
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
.github/install-deps.sh
mkdir -p build
cd build && cmake -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=OFF -DMODERN_PROBE_INCLUDE="-I/usr/include/s390x-linux-gnu" -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DENABLE_DRIVERS_TESTS=On -DCREATE_TEST_TARGETS=On -DBUILD_LIBSCAP_GVISOR=OFF ../
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=OFF -DMODERN_PROBE_INCLUDE="-I/usr/include/s390x-linux-gnu" -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DENABLE_DRIVERS_TESTS=On -DCREATE_TEST_TARGETS=On -DBUILD_LIBSCAP_GVISOR=OFF ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make driver bpf drivers_test -j6
build-modern-bpf-skeleton:
needs: paths-filter
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
runs-on: ${{ (inputs.arch == 'aarch64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-latest' }}
runs-on: 'ubuntu-latest'
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
container: fedora:latest
container: fedora:41
steps:
# Always install deps before invoking checkout action, to properly perform a full clone.
- name: Install build dependencies
@ -259,7 +253,7 @@ jobs:
dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf automake libbpf-devel
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build modern BPF skeleton
run: |
@ -268,49 +262,39 @@ jobs:
make ProbeSkeleton -j6
- name: Upload skeleton
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bpf_probe_${{ inputs.arch }}.skel.h
name: bpf_probe_x86_64.skel.h
path: skeleton-build/skel_dir/bpf_probe.skel.h
retention-days: 1
build-scap-open-w-extern-bpf-skeleton:
needs: [paths-filter,build-modern-bpf-skeleton]
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
runs-on: ${{ (inputs.arch == 'aarch64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-latest' }}
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
needs: [paths-filter,build-modern-bpf-skeleton]
runs-on: 'ubuntu-latest'
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
container: centos:7
steps:
# Always install deps before invoking checkout action, to properly perform a full clone.
- name: Install build dependencies
run: |
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++
source /opt/rh/devtoolset-9/enable
yum install -y wget git make m4 rpm-build perl-IPC-Cmd
sudo apt update
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential clang-14 llvm-14 git pkg-config autoconf automake libtool libelf-dev libcap-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
- name: Checkout
# It is not possible to upgrade the checkout action to versions >= v4.0.0 because of incompatibilities with centos 7's libc.
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download skeleton
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bpf_probe_${{ inputs.arch }}.skel.h
name: bpf_probe_x86_64.skel.h
path: /tmp
- name: Install updated cmake
run: |
curl -L -o /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5-linux-$(uname -m).tar.gz
gzip -d /tmp/cmake.tar.gz
tar -xpf /tmp/cmake.tar --directory=/tmp
cp -R /tmp/cmake-3.22.5-linux-$(uname -m)/* /usr
rm -rf /tmp/cmake-3.22.5-linux-$(uname -m)
- name: Prepare project
run: |
mkdir build && cd build
source /opt/rh/devtoolset-9/enable
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_BUNDLED_DEPS=On \
@ -323,5 +307,57 @@ jobs:
- name: Build project
run: |
cd build
source /opt/rh/devtoolset-9/enable
make scap-open -j6
make scap-open -j6
# Only runs on pull request since on master branch it is already triggered by pages CI.
kernel-tests-dev:
needs: paths-filter
# Avoid running on forks since this job uses a private secret
# not available on forks, leading to failures.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'falcosecurity/libs' && (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true')
uses: ./.github/workflows/reusable_kernel_tests.yaml
with:
# Use real branch's HEAD sha, not the merge commit
libsversion: ${{ github.event.pull_request.head.sha }}
secrets: inherit
kernel-tests-pr-info-upload:
needs: kernel-tests-dev
# Avoid running on forks since this job uses a private secret
# not available on forks, leading to failures.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'falcosecurity/libs' && (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true')
runs-on: ubuntu-latest
steps:
- name: Download X64 matrix
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
path: matrix_X64
- name: Download ARM64 matrix
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
path: matrix_ARM64
- name: Save PR info
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
touch ./pr/COMMENT
echo "# X64 kernel testing matrix" >> ./pr/COMMENT
echo "$(head -n $(grep -n -v -m1 '^|' matrix_X64/matrix.md | awk -F':' '{ print $1 }') matrix_X64/matrix.md)" >> ./pr/COMMENT
echo "" >> ./pr/COMMENT
echo "# ARM64 kernel testing matrix" >> ./pr/COMMENT
echo "$(head -n $(grep -n -v -m1 '^|' matrix_ARM64/matrix.md | awk -F':' '{ print $1 }') matrix_ARM64/matrix.md)" >> ./pr/COMMENT
echo Uploading PR info...
cat ./pr/COMMENT
echo ""
- name: Upload PR info as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pr-kernel-testing
path: pr/
retention-days: 1
if-no-files-found: warn

View File

@ -15,14 +15,14 @@ concurrency:
jobs:
build-test-e2e:
name: build-test-e2e-${{ matrix.arch }} 😇 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
matrix:
arch: [amd64, arm64]
fail-fast: false
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -32,9 +32,9 @@ jobs:
ca-certificates \
cmake \
build-essential \
clang-14 llvm-14 \
git \
clang \
llvm \
git \
ccache \
llvm \
pkg-config \
@ -43,38 +43,28 @@ jobs:
libtool \
libelf-dev \
wget \
libc-ares-dev \
libbpf-dev \
libcap-dev \
libcurl4-openssl-dev \
libssl-dev \
libtbb-dev \
libjq-dev \
libjsoncpp-dev \
libgrpc++-dev \
protobuf-compiler-grpc \
libgtest-dev \
libprotobuf-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
libprotobuf-dev \
protobuf-compiler \
linux-headers-$(uname -r)
sudo .github/install-deps.sh
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && sudo make install
- name: Install kernel headers (actuated)
uses: self-actuated/get-kernel-sources@201eed7d915ac0a6021fb402cde5be7a6b945b59
if: matrix.arch == 'arm64'
- name: Install kernel headers and gcc
- name: Install multilib compilers for ia32 tests
if: matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends linux-headers-$(uname -r) gcc-multilib g++-multilib
sudo apt install -y --no-install-recommends gcc-multilib g++-multilib
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
- name: Build e2e tests 🏗️
env:
@ -96,10 +86,11 @@ jobs:
-DUSE_BUNDLED_GTEST=ON \
..
make -j6 libsinsp_e2e_tests
sudo rm -vfr test/libsinsp_e2e/resources/_proc
cd ..
- name: Cache build
uses: actions/cache/save@v3
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: always()
id: cache
with:
@ -109,7 +100,7 @@ jobs:
test-e2e:
name: test-e2e-${{ matrix.arch }}-${{ matrix.driver.name }} 😇 (bundled_deps)
needs: [build-test-e2e]
runs-on: ${{ (matrix.arch == 'arm64' && 'actuated-arm64-8cpu-16gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
matrix:
arch: [amd64, arm64]
@ -117,18 +108,18 @@ jobs:
fail-fast: false
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Restore build
id: cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: build-e2e-${{ matrix.arch }}-${{ github.run_id }}
restore-keys: build-e2e-
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
@ -139,31 +130,25 @@ jobs:
run: |
sudo apt update
- name: Install multilib
- name: Install multilib compilers for ia32 tests
if: matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends gcc-multilib g++-multilib
- name: Install deps
run: |
sudo apt install -y --no-install-recommends clang gcc llvm build-essential cmake
- name: Install kernel headers (actuated)
uses: self-actuated/get-kernel-sources@201eed7d915ac0a6021fb402cde5be7a6b945b59
if: matrix.arch == 'arm64'
- name: Install kernel headers and gcc
if: matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends linux-headers-$(uname -r) gcc-multilib g++-multilib
sudo apt install -y --no-install-recommends clang gcc llvm build-essential cmake python3 quota linux-headers-$(uname -r)
# We have no guarantees that the kernel version is the same for the
# different workers, so we rebuild the drivers.
- name: Rebuild drivers
run: |
cd build
pushd build
make -B driver bpf
cd ..
pushd test/libsinsp_e2e/resources/
sudo tar xzf fake-proc.tar.gz
popd
popd
- name: Run e2e tests with ${{ matrix.driver.name }} 🏎️
if: matrix.arch == 'amd64'
@ -173,7 +158,7 @@ jobs:
cd build/test/libsinsp_e2e/
sudo -E ./libsinsp_e2e_tests ${{ matrix.driver.option }}
# the actuated arm64 workers doesn't have the CONFIG_QFMT_V2 flag
# the arm64 workers don't have the CONFIG_QFMT_V2 flag
# which is needed for the quotactl_ok test (cmd=QQUOTA_ON + id=QFMT_VFS_V0).
- name: Run e2e tests with ${{ matrix.driver.name }} 🏎️
if: matrix.arch == 'arm64'

38
.github/workflows/format.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Format code
on:
pull_request:
push:
branches:
- master
- "release/**"
jobs:
format:
name: format code 🐲
runs-on: ubuntu-22.04
steps:
- name: Checkout repository 🎉
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends ca-certificates pip git
pip install pre-commit
- name: Run pre-commit ©️
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
- name: Generate the git-diff 🚒
if: failure()
run: git diff > format_diff.patch
- name: Upload the git diff artifact 📦
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: format_diff.patch
path: ./format_diff.patch

View File

@ -11,26 +11,23 @@ on:
- cron: '0 8 * * *' # every day at 8am
jobs:
build-latest-kernel:
name: build-latest-kernel
runs-on: ubuntu-latest
container:
image: falcosecurity/driverkit:latest
compute-latest-version:
outputs:
latest_vers: ${{ steps.latest-version.outputs.latest_vers }}
runs-on: 'ubuntu-latest'
steps:
- name: Checkout Archlinux mainline package ⤵️
run: |
apk update && apk add git
git clone https://aur.archlinux.org/linux-mainline.git linux/
- name: Generate driverkit config
id: latest-version
# Note: in case we are building latest mainline,
# we grep the linux-mainline aur PKGBUILD "_tag" line, that is made like: "_tag=v6.4-rc1"
# We then need to extract the part after the "=" and finally remove the starting "v".
run: |
run: |
cd linux/
echo "kernelversion: 1" > dk.yaml
echo "architecture: amd64" >> dk.yaml
echo "driverversion: ${{ github.sha }}" >> dk.yaml
echo "output:" >> dk.yaml
echo " module: mod.ko" >> dk.yaml
@ -45,26 +42,80 @@ jobs:
echo "target: arch" >> dk.yaml
fi
echo "latest_vers=$(grep kernelrelease dk.yaml | awk -F": " '{print $2}')" >> $GITHUB_OUTPUT
- name: Upload driverkit config
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: driverkit_config.yaml
path: linux/dk.yaml
build-latest-kernel-amd64:
needs: 'compute-latest-version'
outputs:
build: ${{ steps.build.outcome }}
runs-on: 'ubuntu-latest'
steps:
- name: Download driverkit config
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: driverkit_config.yaml
- name: Download latest driverkit artifact
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
with:
fileName: driverkit_*_linux_amd64.tar.gz
latest: true
repository: falcosecurity/driverkit
tarBall: false
zipBall: false
extract: true
- name: Test drivers build
id: build
run: |
echo "Testing build of drivers against: ${{ steps.latest-version.outputs.latest_vers }}"
driverkit docker -c linux/dk.yaml -l debug
echo "Testing build of drivers against: ${{ needs.compute-latest-version.outputs.latest_vers }}"
chmod +x driverkit
./driverkit docker -c dk.yaml -l debug --timeout 300
build-latest-kernel-arm64:
needs: 'compute-latest-version'
outputs:
build: ${{ steps.build.outcome }}
runs-on: 'ubuntu-22.04-arm'
steps:
- name: Download driverkit config
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: driverkit_config.yaml
- name: Download latest driverkit artifact
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
with:
fileName: driverkit_*_linux_arm64.tar.gz
latest: true
repository: falcosecurity/driverkit
tarBall: false
zipBall: false
extract: true
- name: Test drivers build
id: build
run: |
echo "Testing build of drivers against: ${{ needs.compute-latest-version.outputs.latest_vers }}"
chmod +x driverkit
./driverkit docker -c dk.yaml -l debug --timeout 300
badge-latest-kernel:
if: always() && github.event_name == 'schedule'
runs-on: 'ubuntu-latest'
needs: [compute-latest-version,build-latest-kernel-amd64,build-latest-kernel-arm64]
steps:
- name: Update README badge
uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
if: always() && github.event_name == 'schedule'
with:
auth: ${{ secrets.FEDEDP_GIST_SECRET }}
gistID: 1cbc5d42edf8e3a02fb75e76625f1072
filename: kernel.json
label: Drivers build
message: ${{ steps.latest-version.outputs.latest_vers }}
color: ${{ steps.build.outcome != 'success' && 'red' || 'brightgreen' }}
message: ${{ needs.compute-latest-version.outputs.latest_vers }}
color: ${{ (needs.build-latest-kernel-amd64.outputs.build != 'success' || needs.build-latest-kernel-arm64.outputs.build != 'success') && 'red' || 'brightgreen' }}

View File

@ -2,7 +2,7 @@ name: Deploy Github Pages
on:
push:
branches: [master]
permissions:
contents: read
pages: write
@ -17,47 +17,128 @@ jobs:
uses: ./.github/workflows/reusable_kernel_tests.yaml
secrets: inherit
perf-libs-master:
runs-on: [ "self-hosted", "linux", "X64" ]
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run perf
id: perf
uses: ./.github/actions/composite-perf
- name: Archive master perf report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: perf_report
retention-days: 30 # 30 days because this is the artifact on master; we need to retain it to be able to properly diff it
path: |
${{ steps.perf.outputs.perf_tests }}
${{ steps.perf.outputs.perf_scap }}
${{ steps.perf.outputs.heaptrack_tests }}
${{ steps.perf.outputs.heaptrack_scap }}
${{ steps.perf.outputs.gbench_json }}
if-no-files-found: error
- name: Checkout Flamegraph ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'brendangregg/FlameGraph'
path: flamegraph
ref: master
- name: Generate svg file - perf unit tests
run: |
sudo perf script --dsos unit-test-libsinsp -i ${{ steps.perf.outputs.perf_tests }} > perf_tests.perf
./flamegraph/stackcollapse-perf.pl perf_tests.perf > perf_tests.folded
./flamegraph/flamegraph.pl perf_tests.folded > perf_tests.svg
- name: Generate svg file - perf scap file
run: |
sudo perf script --dsos sinsp-example -i ${{ steps.perf.outputs.perf_scap }} > perf_scap.perf
./flamegraph/stackcollapse-perf.pl perf_scap.perf > perf_scap.folded
./flamegraph/flamegraph.pl perf_scap.folded > perf_scap.svg
- name: Generate svg file - heaptrack unit tests
run: |
heaptrack_print ${{ steps.perf.outputs.heaptrack_tests }} -F stacks.txt
./flamegraph/flamegraph.pl stacks.txt > heaptrack_tests.svg
rm -rf stacks.txt
- name: Generate svg file - heaptrack scap file
run: |
heaptrack_print ${{ steps.perf.outputs.heaptrack_scap }} -F stacks.txt
./flamegraph/flamegraph.pl stacks.txt > heaptrack_scap.svg
rm -rf stacks.txt
- name: Upload svg files
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: perf_svg
path: '*.svg'
if-no-files-found: error
deploy-pages:
needs: [kernel-tests-master]
needs: [kernel-tests-master,perf-libs-master]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download matrix X64
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
- name: Move X64 matrix under docs
run: mv matrix.md docs/matrix_X64.md
- name: Download matrix ARM64
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
- name: Move ARM64 matrix under docs
run: mv matrix.md docs/matrix_ARM64.md
run: mv matrix.md docs/matrix_ARM64.md
- name: Disable Table Of Content for matrixes pages
run: |
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/matrix_X64.md
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/matrix_ARM64.md
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
- name: Download perf svg files
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: perf_svg
- name: Generate perf pages
run: |
mv perf_tests.svg docs/
echo '<object data="../perf_tests.svg" type="image/svg+xml" id="perf_unit_tests"></object>' > docs/perf_unit_tests.md
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/perf_unit_tests.md
mv perf_scap.svg docs/
echo '<object data="../perf_scap.svg" type="image/svg+xml" id="perf_scap_file"></object>' > docs/perf_scap_file.md
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/perf_scap_file.md
mv heaptrack_tests.svg docs/
echo '<object data="../heaptrack_tests.svg" type="image/svg+xml" id="heaptrack_unit_tests"></object>' > docs/heaptrack_unit_tests.md
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/heaptrack_unit_tests.md
mv heaptrack_scap.svg docs/
echo '<object data="../heaptrack_scap.svg" type="image/svg+xml" id="heaptrack_scap_file"></object>' > docs/heaptrack_scap_file.md
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/heaptrack_scap_file.md
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.x
- run: pip install mkdocs mkdocs-material
- run: mkdocs build
- uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2.0.0
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: 'site'
- id: deployment
uses: actions/deploy-pages@9dbe3824824f8a1377b8e298bafde1a50ede43e5 # v2.0.4
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

168
.github/workflows/perf.yml vendored Normal file
View File

@ -0,0 +1,168 @@
name: Perf CI
on:
pull_request:
workflow_dispatch:
# Checks if any concurrent jobs under the same pull request or branch are being executed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-perf
cancel-in-progress: true
jobs:
perf-libs-linux-amd64:
runs-on: [ "self-hosted", "linux", "X64" ]
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Checkout Google benchmark ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'google/benchmark'
ref: 'v1.9.0'
path: google-benchmark/
- name: Run perf
id: perf
uses: ./.github/actions/composite-perf
- name: Download latest master report
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
with:
branch: master
event: push
name: perf_report
workflow: pages.yml
- name: Diff from master - perf unit tests
run: |
sudo perf diff perf_tests.data ${{ steps.perf.outputs.perf_tests }} -d unit-test-libsinsp -b -o 1 --percentage relative -q &> perf_tests_diff.txt
- name: Diff from master - perf scap file
run: |
sudo perf diff perf_scap.data ${{ steps.perf.outputs.perf_scap }} -d sinsp-example -b -o 1 --percentage relative -q &> perf_scap_diff.txt
- name: Diff from master - heaptrack unit tests
run: |
sudo heaptrack_print heaptrack_tests.data.zst -d ${{ steps.perf.outputs.heaptrack_tests }} &> heaptrack_tests_diff.txt
- name: Diff from master - heaptrack scap file
run: |
sudo heaptrack_print heaptrack_scap.data.zst -d ${{ steps.perf.outputs.heaptrack_scap }} &> heaptrack_scap_diff.txt
- name: Diff from master - gbench
run: |
pip3 install -r google-benchmark/tools/requirements.txt
python3 google-benchmark/tools/compare.py --no-color benchmarks gbench_data.json ${{ steps.perf.outputs.gbench_json }} &> gbench_diff.txt
- name: Archive perf diff
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: perf_diff
path: '*_diff.txt'
if-no-files-found: error
- name: Save PR info
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
touch ./pr/COMMENT
echo "# Perf diff from master - unit tests" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
head -n10 "perf_tests_diff.txt" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
echo "" >> ./pr/COMMENT
# Drop unstable perf results!
# echo "# Perf diff from master - scap file" >> ./pr/COMMENT
# echo "\`\`\`" >> ./pr/COMMENT
# head -n10 "perf_scap_diff.txt" >> ./pr/COMMENT
# echo "\`\`\`" >> ./pr/COMMENT
# echo "" >> ./pr/COMMENT
echo "# Heap diff from master - unit tests" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
tail -n3 "heaptrack_tests_diff.txt" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
echo "" >> ./pr/COMMENT
echo "# Heap diff from master - scap file" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
tail -n3 "heaptrack_scap_diff.txt" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
echo "# Benchmarks diff from master" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
cat "gbench_diff.txt" >> ./pr/COMMENT
echo "\`\`\`" >> ./pr/COMMENT
echo Uploading PR info...
cat ./pr/COMMENT
echo ""
- name: Upload PR info as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pr-perf
path: pr/
retention-days: 1
if-no-files-found: warn
# Check will fail if sum of all differences is >= 1%.
# But we will always comment with the perf diff from master
- name: Check >= 5% threshold - perf unit tests
if: always()
run: |
sum=$(awk '{sum+=sprintf("%f",$2)}END{printf "%.6f\n",sum}' perf_tests_diff.txt | tr ',' '.')
if (( $(echo "$sum >= 5.0" | bc -l) )); then
exit 1
fi
# Check will fail if sum of all differences is >= 1%.
# But we will always comment with the perf diff from master
# CHECK DISABLED: UNSTABLE PERF TEST.
# - name: Check >= 1% threshold - perf scap file
# if: always() # Even if other threshold checks failed
# run: |
# sum=$(awk '{sum+=sprintf("%f",$2)}END{printf "%.6f\n",sum}' perf_scap_diff.txt | tr ',' '.')
# if (( $(echo "$sum >= 1.0" | bc -l) )); then
# exit 1
# fi
# Check will fail if there is any heap memory usage difference >= 1M,
# or if there is new memory leaked.
- name: Check >= 1M threshold or new leaked mem - heaptrack unit tests
if: always() # Even if other threshold checks failed
run: |
tail -n 3 heaptrack_tests_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_tests_diff_above_thresh.txt
if [ -s heaptrack_tests_diff_above_thresh.txt ]; then
exit 1
fi
tail -n 3 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt
if [ -s heaptrack_scap_diff_above_thresh.txt ]; then
exit 2
fi
# Check will fail if there is any heap memory usage difference >= 1M,
# or if there is new memory leaked.
- name: Check >= 1M threshold or new leaked mem - heaptrack scap file
if: always() # Even if other threshold checks failed
run: |
tail -n 3 heaptrack_scap_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_scap_diff_above_thresh.txt
if [ -s heaptrack_scap_diff_above_thresh.txt ]; then
exit 1
fi
tail -n 3 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt
if [ -s heaptrack_scap_diff_above_thresh.txt ]; then
exit 2
fi
# Check will fail if there any google benchmark is slowed more than 5%
- name: Check >= 5% slowdown on google benchmarks
if: always() # Even if other threshold checks failed
run: |
# Remove first 3 lines and last line that are no tests results
tail -n+4 gbench_diff.txt | head -n -1 | while read p; do
test_name=$(echo "$p" | awk '{print $1}')
if [[ "$test_name" =~ _mean$ ]]; then
diff_pct=$(echo "$p" | awk '{print $3}' | tr -d '+')
if (( $(echo "$diff_pct >= 5.0" | bc -l) )); then
exit 1
fi
fi
done

View File

@ -43,13 +43,13 @@ jobs:
# Safeguard: you need to both set "latest" in GH and not have suffixes to overwrite latest
is_latest = '${{ steps.latest_release.outputs.release }}' == tag_name and not is_prerelease
is_driver = "+driver" in tag_name
with open(os.environ['GITHUB_OUTPUT'], 'a') as ofp:
print(f'is_latest={is_latest}'.lower(), file=ofp)
print(f'is_driver={is_driver}'.lower(), file=ofp)
release-body-libs:
needs: [release-settings]
if: ${{ needs.release-settings.outputs.is_latest == 'true' && needs.release-settings.outputs.is_driver == 'false' }} # only for latest releases and not driver ones
@ -58,12 +58,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create release body file
run: |
touch release-body.md
- name: Extract MIN_API version
run: |
MIN_API_VER=$(grep SCAP_MINIMUM_DRIVER_API_VERSION userspace/libscap/scap.h)
@ -72,7 +72,7 @@ jobs:
MIN_API_VER=$(echo $MIN_API_VER | tr -d "(" | tr -d ")")
MIN_API_VER=$(echo $MIN_API_VER | sed -r 's/, /./g')
echo '!'"[MIN_DRIVER_API](https://img.shields.io/badge/MIN_DRIVER_API-${MIN_API_VER}-yellow)" >> release-body.md
- name: Extract MIN_SCHEMA version
run: |
MIN_SCHEMA_VER=$(grep SCAP_MINIMUM_DRIVER_SCHEMA_VERSION userspace/libscap/scap.h)
@ -82,36 +82,36 @@ jobs:
MIN_SCHEMA_VER=$(echo $MIN_SCHEMA_VER | sed -r 's/, /./g')
echo '!'"[MIN_DRIVER_SCHEMA](https://img.shields.io/badge/MIN_DRIVER_SCHEMA-${MIN_SCHEMA_VER}-yellow)" >> release-body.md
echo "" >> release-body.md
- name: Generate release notes
uses: leodido/rn2md@9c351d81278644c0e17b1ca68edbdba305276c73
with:
milestone: ${{ github.event.release.tag_name }}
output: ./notes.md
- name: Merge release notes to pre existent body
run: cat notes.md >> release-body.md
- name: Attach release creator to release body
run: |
echo "" >> release-body.md
echo "#### Release Manager @${{ github.event.release.author.login }}" >> release-body.md
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
tag_name: ${{ github.event.release.tag_name }}
name: ${{ github.event.release.name }}
name: ${{ github.event.release.name }}
kernel-tests-release:
needs: [release-settings]
if: ${{ needs.release-settings.outputs.is_latest == 'true' && needs.release-settings.outputs.is_driver == 'true' }} # only for latest driver releases
if: ${{ needs.release-settings.outputs.is_latest == 'true' && needs.release-settings.outputs.is_driver == 'true' }} # only for latest driver releases
uses: ./.github/workflows/reusable_kernel_tests.yaml
with:
libsversion: ${{ github.event.release.tag_name }}
secrets: inherit
secrets: inherit
release-body-driver:
needs: [release-settings, kernel-tests-release]
if: ${{ needs.release-settings.outputs.is_latest == 'true' && needs.release-settings.outputs.is_driver == 'true' }} # only for latest driver releases
@ -120,12 +120,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone libs repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create release body file
run: |
touch release-body.md
touch release-body.md
- name: Extract API and SCHEMA versions
run: |
touch release-body.md
@ -134,20 +134,41 @@ jobs:
echo '!'"[API](https://img.shields.io/badge/API-${API_VERS}-yellow)" >> release-body.md
echo '!'"[SCHEMA](https://img.shields.io/badge/SCHEMA-${SCHEMA_VERS}-yellow)" >> release-body.md
echo "" >> release-body.md
- name: Push badge to latest kernel release
run: |
wget https://gist.githubusercontent.com/FedeDP/1cbc5d42edf8e3a02fb75e76625f1072/raw/kernel.json
# 6.15-rc2 -> 6.15
# 6.10.6 -> 6.10
# 6.10 -> 6.10
KVER=$(cat kernel.json | jq '.message' | tr -d '"' | grep -oE -- '[0-9]+.[0-9]+')
SUCCESS=$(cat kernel.json | jq '.color' | tr -d '"')
# If latest run was not successful,
# revert back to previous kernel release.
# Of course, the fallback logic is bugged in case minor is 0,
# as we cannot know which was the previous version.
# It should not matter until kernel 7.0 :P
if [[ "$SUCCESS" = "red" ]]; then
n=${KVER//[!0-9]/ }
a=(${n//\./ })
KVER=$(echo "${a[0]}.$((a[1] - 1))")
fi
echo '!'"[Latest Compatible Kernel](https://img.shields.io/badge/KERNEL-${KVER}-brightgreen)" >> release-body.md
echo "" >> release-body.md
- name: Download matrix X64
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
- name: Rename X64 matrix
run: mv matrix.md matrix_X64.md
- name: Download matrix ARM64
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
- name: Rename ARM64 matrix
run: mv matrix.md matrix_ARM64.md
@ -166,23 +187,23 @@ jobs:
sed -i '1s/^/# Driver Testing Matrix amd64\n\n/' matrix_X64.md
sed -i '1s/^/# Driver Testing Matrix arm64\n\n/' matrix_ARM64.md
cat matrix_X64.md matrix_ARM64.md >> release-body.md
- name: Generate release notes
uses: leodido/rn2md@9c351d81278644c0e17b1ca68edbdba305276c73
uses: leodido/rn2md@9c351d81278644c0e17b1ca68edbdba305276c73 # main
with:
milestone: ${{ github.event.release.tag_name }}
output: ./notes.md
- name: Merge release notes to pre existent body
run: cat notes.md >> release-body.md
- name: Attach release creator to release body
run: |
echo "" >> release-body.md
echo "#### Release Manager @${{ github.event.release.author.login }}" >> release-body.md
echo "#### Release Manager @${{ github.event.release.author.login }}" >> release-body.md
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
tag_name: ${{ github.event.release.tag_name }}

View File

@ -0,0 +1,137 @@
name: Run libs e2e tests python framework
on:
workflow_call:
inputs:
container_plugin_artifact_name:
description: 'use a previously built custom container plugin; artifact name to be downloaded, or empty'
type: string
required: false
default: ''
test-docker:
description: "Whether to run tests with docker socket"
type: boolean
required: false
default: true
test-podman:
description: "Whether to run tests with podman socket"
type: boolean
required: false
default: true
libsversion:
description: 'libs version to be tested, eg: master'
type: string
required: false
default: 'master'
libsrepo:
description: 'libs repo to be tested, eg: falcosecurity/libs'
type: string
required: false
default: 'falcosecurity/libs'
jobs:
test-e2e:
if: inputs.test-docker || inputs.test-podman
strategy:
fail-fast: false
matrix:
name: [ system_deps, bundled_deps, asan ]
include:
- name: system_deps
cmake_opts: -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DUSE_BUNDLED_DEPS=True
- name: asan
cmake_opts: -DUSE_BUNDLED_DEPS=True -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address
runs-on: ubuntu-24.04
steps:
- name: Install deps ⛓️
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
git \
clang \
llvm \
pkg-config \
autoconf \
automake \
libtool \
libelf-dev \
wget \
libbpf-dev \
libcap-dev \
libtbb-dev \
libjq-dev \
libjsoncpp-dev \
libgtest-dev \
libprotobuf-dev \
protobuf-compiler \
"linux-headers-$(uname -r)"
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
repository: ${{ inputs.libsrepo }}
ref: ${{ inputs.libsversion }}
- name: Install deps ⛓️
run: |
sudo .github/install-deps.sh
- name: Build tests 🏗️
run: |
mkdir -p build && cd build
cmake -DBUILD_BPF=ON \
-DBUILD_LIBSCAP_MODERN_BPF=ON \
-DBUILD_LIBSCAP_GVISOR=OFF \
-DENABLE_E2E_TESTS=ON \
${{ matrix.cmake_opts }} \
-DUSE_BUNDLED_LIBBPF=ON \
..
make -j$(nproc) sinsp-example driver bpf container_plugin
sudo -E make e2e-install-deps
- name: Download overriding custom container plugin
if: inputs.container_plugin_artifact_name != ''
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ inputs.container_plugin_artifact_name }}
path: build/test/e2e/container_plugin-prefix/src/container_plugin/
- name: Run tests - docker 🧪
if: inputs.test-docker
working-directory: build
run: |
sudo -E ../test/e2e/scripts/run_tests.sh
- name: Archive test reports - docker
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: inputs.test-docker && failure()
with:
name: ${{ matrix.name }}_docker_report
path: |
/tmp/report/
- name: Run tests - podman 🧪
if: inputs.test-podman && always()
working-directory: build
env:
# Set DOCKER_HOST pointing to podman socket
DOCKER_HOST: unix://run/podman/podman.sock
run: |
# Cleanup docker tests generated report folder
sudo rm -rf /tmp/report
# Podman tests require podman socket
sudo systemctl start podman
sudo -E ../test/e2e/scripts/run_tests.sh
- name: Archive test reports - podman
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: inputs.test-podman && failure()
with:
name: ${{ matrix.name }}_podman_report
path: |
/tmp/report/

View File

@ -13,7 +13,7 @@ on:
type: string
required: false
default: 'falcosecurity/libs'
workflow_call:
workflow_call:
inputs:
libsversion:
description: 'libs version to be tested, eg: master'
@ -29,15 +29,17 @@ on:
concurrency:
group: kernel-tests
cancel-in-progress: false
jobs:
test-kernels:
strategy:
fail-fast: false
matrix:
architecture: [X64, ARM64]
runs-on: [ "self-hosted", "linux", "${{matrix.architecture}}" ]
runs-on: [ "self-hosted", "linux", "${{matrix.architecture}}" ]
steps:
# We need to use v0.3.2 instead of the hash because the tagname is
# used by the action to download release tagged images.
- uses: falcosecurity/kernel-testing@v0.3.2
id: kernel_tests
with:
@ -45,12 +47,12 @@ jobs:
libsrepo: ${{ inputs.libsrepo }}
build_matrix: 'true'
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ansible_output_${{matrix.architecture}}
path: ${{ steps.kernel_tests.outputs.ansible_output }}
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: matrix_${{matrix.architecture}}
path: ${{ steps.kernel_tests.outputs.matrix_output }}

View File

@ -11,10 +11,10 @@ jobs:
name: check-insecure-api
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep:1.41.0
image: docker.io/semgrep/semgrep:1.85.0@sha256:b4c2272e0a2e59ca551ff96d3bbae657bd2b7356e339af557b27a96d9e751544
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Scan PR for insecure API usage 🕵️
@ -29,10 +29,10 @@ jobs:
name: check-absolute-include-paths
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep:1.41.0
image: docker.io/semgrep/semgrep:1.85.0@sha256:b4c2272e0a2e59ca551ff96d3bbae657bd2b7356e339af557b27a96d9e751544
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Scan PR for libs relateive include paths 🕵️

46
.github/workflows/test_coverage_ci.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Test Coverage CI
on:
pull_request:
push:
branches:
- master
# Checks if any concurrent jobs under the same pull request or branch are being executed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
unit-test-libsinsp-coverage:
name: unit-test-libsinsp-coverage 🧐
runs-on: 'ubuntu-22.04'
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
run: |
sudo apt-get update && sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libre2-dev libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-$(uname -r) gpg gpg-agent gcovr
sudo .github/install-deps.sh
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=True -DENABLE_COVERAGE=True -DUSE_BUNDLED_DEPS=False ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
make run-unit-tests
- name: Generate libsinsp coverage report
run: |
gcovr --xml -o ./libsinsp.coverage.xml
- name: Upload to codecov
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
with:
fail_ci_if_error: true
files: ./libsinsp.coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
flags: libsinsp

View File

@ -13,18 +13,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: master
path: libs
- name: Bump syscalls
uses: falcosecurity/syscalls-bumper@main
uses: falcosecurity/syscalls-bumper@main # should be pointing to main
with:
repo-root: ${{ github.workspace }}/libs
- name: Create Pull Request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
path: libs
signoff: true

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ cscope.out
tags
third_party
*.vagrant*
.DS_Store

23
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
fail_fast: false
minimum_pre_commit_version: '0'
repos:
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
stages: [pre-commit]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c++, c]
stages: [pre-commit]
- repo: local
hooks:
- id: dco-hook-local
name: DCO hook local
entry: ./tools/local_hooks/dco-pre-commit-msg.sh
language: script
stages: [prepare-commit-msg]

View File

@ -2,33 +2,32 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
# Prior to doing anything, we make sure that we aren't trying to
# run cmake in-tree.
# Prior to doing anything, we make sure that we aren't trying to run cmake in-tree.
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt)
message(FATAL_ERROR
"Looks like you are trying to run CMake from the base source directory.\n"
"** RUNNING CMAKE FROM THE BASE DIRECTORY WILL NOT WORK **\n"
"To Fix:\n"
" 1. Remove the CMakeCache.txt file in this directory. ex: rm CMakeCache.txt\n"
" 2. Create a build directory from here. ex: mkdir build\n"
" 3. cd into that directory. ex: cd build\n"
" 4. Run cmake from the build directory. ex: cmake ..\n"
" 5. Run make from the build directory. ex: make\n"
"Full paste-able example:\n"
"( rm -f CMakeCache.txt; mkdir build; cd build; cmake ..; make )")
message(
FATAL_ERROR
"Looks like you are trying to run CMake from the base source directory.\n"
"** RUNNING CMAKE FROM THE BASE DIRECTORY WILL NOT WORK **\n"
"To Fix:\n"
" 1. Remove the CMakeCache.txt file in this directory. ex: rm CMakeCache.txt\n"
" 2. Create a build directory from here. ex: mkdir build\n"
" 3. cd into that directory. ex: cd build\n"
" 4. Run cmake from the build directory. ex: cmake ..\n"
" 5. Run make from the build directory. ex: make\n"
"Full paste-able example:\n"
"( rm -f CMakeCache.txt; mkdir build; cd build; cmake ..; make )"
)
endif()
cmake_minimum_required(VERSION 3.12)
@ -38,8 +37,8 @@ if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows + CMake >= 3.15 and link
# with the static (MultiThreaded) CRT unless instructed otherwise.
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows + CMake >= 3.15 and link with the static
# (MultiThreaded) CRT unless instructed otherwise.
if(NOT (CMAKE_MSVC_RUNTIME_LIBRARY OR BUILD_SHARED_LIBS))
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
@ -54,16 +53,18 @@ endif()
project(falcosecurity-libs)
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
option(MINIMAL_BUILD "Produce a minimal build with only the essential features (no container metadata)" OFF)
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
option(USE_BUNDLED_DRIVER "Use the driver/ subdirectory in the build process (only available in Linux)" ON)
option(USE_BUNDLED_DRIVER
"Use the driver/ subdirectory in the build process (only available in Linux)" ON
)
option(ENABLE_E2E_TESTS "Enable e2e tests" OFF)
option(ENABLE_DRIVERS_TESTS "Enable driver tests (bpf, kernel module, modern bpf)" OFF)
option(ENABLE_LIBSCAP_TESTS "Enable libscap unit tests" OFF)
option(ENABLE_LIBSINSP_E2E_TESTS "Enable libsinsp e2e tests" OFF)
option(BUILD_SHARED_LIBS "Build libscap and libsinsp as shared libraries" OFF)
option(ENABLE_VM_TESTS "Enable driver sanity tests" OFF)
option(USE_ASAN "Build with AddressSanitizer" OFF)
option(USE_UBSAN "Build with UndefinedBehaviorSanitizer" OFF)
option(USE_TSAN "Build with ThreadSanitizer" OFF)
option(ENABLE_COVERAGE "Build with code coverage" OFF)
option(UBSAN_HALT_ON_ERROR "Halt on error when building with UBSan" ON)
@ -75,8 +76,7 @@ endif()
include(GNUInstallDirs)
# Add path for custom CMake modules.
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(versions)
@ -112,7 +112,7 @@ if(CREATE_TEST_TARGETS)
include(gtest)
endif()
if (BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
get_shared_libs_versions(FALCOSECURITY_SHARED_LIBS_VERSION FALCOSECURITY_SHARED_LIBS_SOVERSION)
message(STATUS "Shared library version: ${FALCOSECURITY_SHARED_LIBS_VERSION}")
message(STATUS "Shared library soversion: ${FALCOSECURITY_SHARED_LIBS_SOVERSION}")
@ -122,14 +122,13 @@ include(libscap)
include(libsinsp)
if(CREATE_TEST_TARGETS)
# Add command to run all unit tests at once via the make system.
# This is preferred vs using ctest's add_test because it will build
# the code and output to stdout.
add_custom_target(run-unit-tests
COMMAND ${CMAKE_MAKE_PROGRAM} run-unit-test-libsinsp
)
# Add command to run all unit tests at once via the make system. This is preferred vs using
# ctest's add_test because it will build the code and output to stdout.
add_custom_target(run-unit-tests COMMAND ${CMAKE_MAKE_PROGRAM} run-unit-test-libsinsp)
add_subdirectory(test/e2e)
if(ENABLE_E2E_TESTS)
add_subdirectory(test/e2e)
endif()
if(ENABLE_DRIVERS_TESTS)
add_subdirectory(test/drivers)
@ -145,8 +144,9 @@ if(CREATE_TEST_TARGETS)
add_subdirectory(test/libsinsp_e2e/resources)
endif()
if(ENABLE_VM_TESTS)
add_subdirectory(test/vm)
endif()
endif()
option(ENABLE_BENCHMARKS "Enable Benchmarks" OFF)
if(ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
endif()

View File

@ -2,17 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
cmake_minimum_required(VERSION 3.12)
@ -20,14 +18,15 @@ cmake_minimum_required(VERSION 3.12)
project(googletest-download NONE)
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG "release-1.12.1"
SOURCE_DIR "${PROJECT_BINARY_DIR}/googletest-src"
BINARY_DIR "${PROJECT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
TEST_COMMAND ""
ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG "release-1.12.1"
SOURCE_DIR "${PROJECT_BINARY_DIR}/googletest-src"
BINARY_DIR "${PROJECT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
TEST_COMMAND ""
)

47
CMakePresets.json Normal file
View File

@ -0,0 +1,47 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
},
{
"name": "scap-drivers",
"inherits": "base",
"displayName": "Build scap drivers and their tests",
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
"binaryDir": "${sourceDir}/build-scap-drivers",
"cacheVariables": {
"USE_BUNDLED_DEPS": "ON",
"ENABLE_DRIVERS_TESTS": "ON",
"MODERN_BPF_DEBUG_MODE": "ON",
"BUILD_LIBSCAP_MODERN_BPF": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"CREATE_TEST_TARGETS": "ON",
"ENABLE_LIBSCAP_TESTS": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
},
{
"name": "sinsp-minimal",
"inherits": "base",
"displayName": "Build minimal sinsp",
"description": "Build sinsp without gvisor and protobuf deps",
"binaryDir": "${sourceDir}/build-sinsp-minimal",
"cacheVariables": {
"USE_BUNDLED_DEPS": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"CREATE_TEST_TARGETS": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
}
]
}

207
Contributing.md Normal file
View File

@ -0,0 +1,207 @@
# How to contribute
## Enforce coding style 💻
### Introduction
This document introduces the coding style that will be applied in this repository.
This coding style involves all the following files: `.c`, `.h`, `.cpp`, `.cmake`, `CMakeLists.txt`. To enforce it we rely on two main tools:
1. `clang-format` version `18.1.8`.
2. `cmake-format` version `0.6.13`.
> __Please note__: tools versions are important! Different versions will enforce slightly different changes on the code. For example `clang-format-18` will produce a slightly different output respect to `clang-format-17` always respecting the imposed style.
The coding style is expressed through the 2 configuration file that you find in this repo: `.clang-format`, `.cmake-format.json`.
### Enforce the style locally
There are many ways to enforce the style locally, here we will describe two of them:
1. Use `pre-commit` framework.
2. Use the repo `Makefile`.
#### 1.Pre-commit framework (suggested if you don't have the 2 tools already installed on your machine)
The `pre-commit` framework allows you to automatically install different `git-hooks` that will run at every new commit. More precisely, if you use the `.pre-commit-config.yaml` in this repo you will install 3 different hooks:
1. The `clang-format` hook: this is a `pre-commit` git hook that runs `clang-format` on your staged changes.
2. The `cmake-format` hook: this is a `pre-commit` git hook that runs `cmake-format` on your staged changes.
3. The `DCO signed-off` hook: this is a `pre-commit-msg` git hook that adds the `DCO` on your commit if not present. This hook is not strictly related to the coding style so we will talk about it in a separate section: [Add DCO signed-off to your commits](#add-dco-signed-off-to-your-commits).
Now let's see what we need to use `pre-commit` framework.
##### Step 1
Install `pre-commit` framework following the [official documentation](https://pre-commit.com/#installation).
> __Please note__: you have to follow only the "Installation" section.
##### Step 2
Once you have installed `pre-commit`, you don't need to install anything else! This is the good point of using a framework like `pre-commit`, all the tools necessary to format your code will be directly managed by the framework. But in order to be ready, you need to install the git hooks in your local repo.
This simple command allows you to install the two `pre-commit` git hooks, `clang-format` and `cmake-format`.
```bash
pre-commit install --install-hooks --hook-type pre-commit --overwrite
```
If you want to install also the `pre-commit-msg` git hook for the DCO you have to type the following command, but be sure to have configured all you need as said in the [dedicated section]((#add-dco-signed-off-to-your-commits))
```bash
pre-commit install --install-hooks --hook-type prepare-commit-msg --overwrite
```
You have done, at every new commit, this hook will check that your patch respects the coding style of this repo!
If you want to detach the git hooks, you can simply type:
```bash
pre-commit uninstall --hook-type prepare-commit-msg
pre-commit uninstall --hook-type pre-commit
```
#### 2.Makefile
##### Step 1
In order to use the repo `Makefile`, you need to install on your local machine the two aforementioned tools:
__clang-format v18.1.8__
One of the easiest ways to install `clang-format` could be directly downloading its static binary from [here](https://github.com/muttleyxd/clang-tools-static-binaries).
There are other ways for example you can download the package for your distro or you can also build it from sources.
__cmake-format v0.6.13__
To install `cmake-format` you can follow the official documentation [here](https://cmake-format.readthedocs.io/en/latest/installation.html).
> __NOTE__: Please check the versions of the two tool with `clang-format --version` and `cmake-format --version`.
##### Step 2
Once you have installed the __right__ versions of the 2 tools, you can simply type `make format-all` from the root directory of the project (`/libs`) to format all your code according to the coding style.
Remember to do that before submitting a new patch upstream! 😁
#### Other solutions
Obviously, you can also install the 2 tools locally and enable some extension of your favorite IDE (like `VScode`) to format your code every time you save your files!
## Add DCO signed-off to your commits 🔏
### Introduction
Another requirement for contributing to the `libs` repository, is applying the [DCO](https://cert-manager.io/docs/contributing/sign-off/) to every commit you want to push upstream.
Before doing this you have to configure your git user `name` and `email` if you haven't already done it. To check your actual `name` and `email` type:
```bash
git config --get user.name
git config --get user.email
```
If they are correct you have done, otherwise, you have to set them:
```bash
git config user.name <full-name>
git config user.email <mail-used_with-GitHub-profile>
```
>__Please note__: If you have problems in doing this you can read the full documentation [here](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git).
### Enforce the DCO locally
Now you are ready to sign your commits! You have two main ways to do this:
1. Manually with `git` tool.
2. Use the `pre-commit-msg` hook quoted before.
### Manually
To do this you just need to remember the `-s` while performing your commits:
```bash
git commit -s
```
or with the inline message:
```bash
git commit -s -m "my first commit"
```
### Use `pre-commit` hook
Here if you have already added the hook in the [previous section](#step-2), you have to do nothing otherwise you have to simply install the DCO hook with:
```bash
pre-commit install --install-hooks --hook-type prepare-commit-msg --overwrite
```
And you have done! Now you don't have to remember the `-s` option every time you commit something, the DCO hook will automatically add the DCO if you forget it! 😄
## Some best practices 📏
### Class variables
To know whether a variable belongs to a `class` or a `function`, we start member variables with `m_`.
Example:
```c
public int32_t m_counter;
```
### Global variables
To know whether the variable is global or not, we start globals with `g_`.
Example:
```c
int g_nplugins;
```
### Capitalization
The naming convention is camel-cased "Unix" style, i.e. always lower case. Words are separated by underscores.
Example:
```c
int32_t g_global_bean_counter;
int32_t count_beans();
```
and not,
```c
int32_t GlobalBeanCounter;
int32_t CountBeans();
```
### Packed Structures
Packed structures should use the GCC and MSVC-style supported `pragma`:
Example:
```c
#pragma pack(push,1)
struct frame_control
{
struct fields....
};
#pragma pack(pop)
```
### 64-bit constants
Put an `LL` at the end of your `64-bit` constants. Without the `LL`, some platform compilers try to interpret the constant on the right-hand side as a `long integer` instead of a `long long` and this could lead to an error at building time.
Example:
```c
x=0X00FF00000000000LL
```

81
Makefile Normal file
View File

@ -0,0 +1,81 @@
#
# Copyright (C) 2024 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# mofidy the following variables to match your paths
CLANG_FORMAT_EXE ?= clang-format
CLANG_FORMAT_VERSION = "$(shell ${CLANG_FORMAT_EXE} --version | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
CLANG_FORMAT_DESIRED_VERSION ="18.1.8"
CMAKE_FORMAT_EXE ?= cmake-format
CMAKE_FORMAT_VERSION = "$(shell ${CMAKE_FORMAT_EXE} --version | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
CMAKE_FORMAT_DESIRED_VERSION = "0.6.13"
PROJECT_ROOT_DIR = $(shell git rev-parse --show-toplevel)
######################
# Clang-format #
######################
.PHONY: clang-format-install
clang-format-install:
ifeq (, $(shell ${CLANG_FORMAT_EXE} --version))
@echo "${CLANG_FORMAT_EXE} is not installed. Please read the 'coding style' doc to get more info."
@exit 1
endif
ifneq ($(CLANG_FORMAT_VERSION), $(CLANG_FORMAT_DESIRED_VERSION))
@echo "${CLANG_FORMAT_EXE} version is not '${CLANG_FORMAT_DESIRED_VERSION}'. Actual version is '${CLANG_FORMAT_VERSION}'"
@exit 1
endif
.PHONY: format-clang
format-clang: clang-format-install
git ls-files --directory ${PROJECT_ROOT_DIR} | grep -E '\.(cpp|h|c)$$' | xargs ${CLANG_FORMAT_EXE} -Werror --style=file:${PROJECT_ROOT_DIR}/.clang-format -i
.PHONY: check-clang
check-clang: clang-format-install
git ls-files --directory ${PROJECT_ROOT_DIR} | grep -E '\.(cpp|h|c)$$' | xargs ${CLANG_FORMAT_EXE} -Werror --style=file:${PROJECT_ROOT_DIR}/.clang-format -n
######################
# Cmake-format #
######################
.PHONY: cmake-format-install
cmake-format-install:
ifeq (, $(shell ${CMAKE_FORMAT_EXE} --version))
@echo "${CMAKE_FORMAT_EXE} is not installed. Please read the 'coding style' doc to get more info."
@exit 1
endif
ifneq ($(CMAKE_FORMAT_VERSION), $(CMAKE_FORMAT_DESIRED_VERSION))
@echo "${CMAKE_FORMAT_EXE} version is not '${CMAKE_FORMAT_DESIRED_VERSION}'. Actual version is '${CMAKE_FORMAT_VERSION}'"
@exit 1
endif
.PHONY: format-cmake
format-cmake: cmake-format-install
git ls-files --directory ${PROJECT_ROOT_DIR} | grep -E '\.(cmake)$$|CMakeLists.txt$$' | xargs ${CMAKE_FORMAT_EXE} --config-files ${PROJECT_ROOT_DIR}/.cmake-format.json -i
.PHONY: check-cmake
check-cmake: cmake-format-install
git ls-files --directory ${PROJECT_ROOT_DIR} | grep -E '\.(cmake)$$|CMakeLists.txt$$' | xargs ${CMAKE_FORMAT_EXE} --config-files ${PROJECT_ROOT_DIR}/.cmake-format.json --check
# Add new formatters here...
.PHONY: format-all
format-all: format-clang format-cmake
.PHONY: check-all
check-all: check-clang check-cmake

3
OWNERS
View File

@ -7,10 +7,11 @@ approvers:
- molter73
- lucaguerra
- jasondellaluce
- incertum
- ekoops
reviewers:
- hbrueckner
emeritus_approvers:
- fntlnz
- leodido
- ldegio
- incertum

View File

@ -11,7 +11,7 @@ This repository contains **libsinsp**, **libscap**, the **kernel module** and th
These components are at the foundation of [Falco](https://github.com/falcosecurity/falco) and other projects that work with the same kind of data.
This component stack mainly operates on syscall events. We monitor syscalls using either a kernel module or an eBPF probe, which we call *drivers*. On top of the drivers, `libscap` manages the data capture process, while `libsinsp` enriches the data, and provides a rich set of API to consume the data. Furthermore, these two libraries also implement a [plugin](https://github.com/falcosecurity/plugins) framework that extends this stack to potentially any other data sources. For further details, please refer to the [official documentation](https://falco.org/docs/).
This component stack mainly operates on syscall events. We monitor syscalls using either a kernel module or an eBPF probe, which we call *drivers*. On top of the drivers, `libscap` manages the data capture process, while `libsinsp` enriches the data, and provides a rich set of API to consume the data. Furthermore, these two libraries also implement a [plugin](https://github.com/falcosecurity/plugins) framework that extends this stack to potentially any other data sources. For further details, please refer to Falco's [official documentation](https://falco.org/docs/).
An image is worth a thousand words, they say:
@ -104,13 +104,13 @@ If you are building this project outside of a Git working directory, or if you w
<details>
<summary>Expand Build Instructions</summary>
For your convenience, we have included the instructions for building the `libs` modules here, in addition to the information available in the [official documentation](https://falco.org/docs/install-operate/source/). These instructions are designed for building and testing `libs` on your own Linux development machine. However, if you intend to adopt CI or build within containers, there are additional considerations to take into account. The official [website]((https://falco.org/docs/install-operate/source/)) continually extends its guidance in this respect.
For your convenience, we have included the instructions for building the `libs` modules here, in addition to the information available in Falco's [official documentation](https://falco.org/docs/install-operate/source/). These instructions are designed for building and testing `libs` on your own Linux development machine. However, if you intend to adopt CI or build within containers, there are additional considerations to take into account. The official [website]((https://falco.org/docs/install-operate/source/)) continually extends its guidance in this respect.
The project utilizes the `cmake` build system, and the key `make` targets are as follows:
* `driver` -> build the kmod
* `bpf` -> build the eBPF probe
* `scap` -> build libscap (`modern_bpf` driver will be bundled into `scap` if enabled)
* `bpf` -> build the legacy `ebpf` probe
* `scap` -> build libscap (`modern_ebpf` driver will be bundled into `scap` if enabled)
* `sinsp` -> build libsinsp (depends upon `scap` target)
* `scap-open` -> build a small example binary for `libscap` to test the drivers (dependent on `scap`)
* `sinsp-example` -> build a small example binary for `libsinsp` to test the drivers and/or `libsinsp` functionality (dependent on `scap` and `sinsp`)
@ -135,7 +135,7 @@ make sinsp
### Build userspace using system deps
To build using the system deps instead, first, make sure to have all the needed packages installed. Refer to the [official documentation](https://falco.org/docs/install-operate/source/).
To build using the system deps instead, first, make sure to have all the needed packages installed. Refer to Falco's [official documentation](https://falco.org/docs/install-operate/source/).
```bash
cmake -DUSE_BUNDLED_DEPS=OFF ../;
@ -146,29 +146,27 @@ make sinsp
### Build driver - kmod
To build the kmod driver, you need your kernel headers installed. Check out the [official documentation](https://falco.org/docs/install-operate/source/).
To build the kmod driver, you need your kernel headers installed. Check out Falco's [official documentation](https://falco.org/docs/install-operate/source/).
```bash
make driver
# Verify the kmod object code was created, uses `.ko` extension.
# Verify the kmod binary object file was created, uses `.ko` extension.
ls -l driver/src/scap.ko;
```
### Build driver - eBPF probe
To build the eBPF probe, you need `clang` and `llvm` packages and you also need your kernel headers installed. Check out the [official documentation](https://falco.org/docs/install-operate/source/).
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/).
```bash
cmake -DBUILD_BPF=ON ../;
make bpf
# Verify the eBPF object code was created, uses `.o` extension.
# Verify the eBPF bytecode file was created, uses `.o` extension.
ls -l driver/bpf/probe.o;
```
>__WARNING__: **clang-7** is the oldest supported version to build our BPF probe.
Initial guidance for CI and building within containers: To build either the kmod or eBPF probe in a container, you will need to make the extracted kernel headers available. The [test/vm](test/vm/) directory contains example [scripts](test/vm/scripts/compile_drivers.sh) demonstrating how to pass them to the `make` command using the argument `KERNELDIR=${EXTRACTED_KERNEL_HEADERS_DIR}`. You can also use the [falcosecurity/driverkit](https://github.com/falcosecurity/driverkit) or explore the scripts within the driverkit repository. The mentioned resources also provide candidate builder containers.
### Build driver - modern eBPF probe
To build the modern eBPF probe, further prerequisites are necessary:
@ -193,13 +191,13 @@ To build the modern eBPF probe, further prerequisites are necessary:
> __NOTE:__ These are not the requirements to use the modern BPF probe, but rather for building it from source.
Regarding the previously discussed bpf drivers, they create a kernel-specific object code (`driver/bpf/probe.o`) for your machine's kernel release (`uname -r`). This object code is then used as an argument for testing with `scap-open` and `sinsp-example` binaries.
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.
However, the modern BPF driver operates differently. It doesn't require kernel headers, and its build isn't tied to your kernel release. This is enabled by the CO-RE (Compile Once - Run Everywhere) feature of the modern BPF driver. CO-RE allows the driver to work on kernels with backported BTF (BPF Type Format) support or kernel versions >= 5.8.
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.
To comprehend how the driver understands kernel data structures without knowledge of the kernel it runs on, there's no black magic involved. We maintain a [vmlinux.h](driver/modern_bpf/definitions/vmlinux.h) file in our project containing all necessary kernel data structure definitions. Additionally, we sometimes rely on macros or functions typically found in system header files, which we redefine in [struct_flavors.h](driver/modern_bpf/definitions/struct_flavors.h).
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.
That being said, the modern BPF driver still produces an object file, which you can create using the target below. Nevertheless, we ultimately include it in `scap` regardless. Hence, when modern BPF is enabled, building `scap` will already cover this step for you.
The modern eBPF driver build process produces an eBPF header skeleton file using `bpftool`. The skeleton file is a C header file that embeds the compiled eBPF program as bytecode.
```bash
cmake \
@ -207,13 +205,15 @@ cmake \
-DBUILD_LIBSCAP_MODERN_BPF=ON ../;
make ProbeSkeleton
# Verify the modern eBPF object code / final composed header file including all `.o` modern_bpf files was created, uses `.h` extension.
# Verify the modern eBPF bytecode / final composed header file including all `.o` modern_ebpf files was created, uses `.h` extension.
ls -l skel_dir/bpf_probe.skel.h;
# Now includes skel_dir/bpf_probe.skel.h in `scap` during the linking process.
make scap
```
Initial guidance for CI and building within containers: The Falco Project, for instance, compiles the final Falco userspace binary within older centos7 [falco-builder](https://falco.org/docs/install-operate/source/#build-using-falco-builder-container) containers with bundled dependencies. This ensures compatibility across supported systems, mainly due to GLIBC versions and other intricacies. However, you won't be able to compile the modern BPF driver on such old systems or builder containers. One solution is to build `skel_dir/bpf_probe.skel.h` in a more recent builder container. For example, you can refer to this [container](test/vm/containers/ubuntu2310.Dockerfile) as a guide. Subsequently, you can provide the modern BPF header file as an artifact to `scap` during building in an older builder container. As an illustrative example, we use `/tmp/skel-dir` containing the `bpf_probe.skel.h` file.
Since modern eBPF is included in `scap`, running `make scap` automatically covers the `make ProbeSkeleton` build step.
You can also split the build process and specify the directory containing the `bpf_probe.skel.h` file.
```bash
cmake \
@ -243,7 +243,7 @@ This repository includes convenient test example binaries for both `scap` and `s
When developing new features, you would run either one depending on what you're working on, in order to test and validate your changes.
> __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 BPF, 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.
> __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.
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).
@ -259,8 +259,7 @@ cmake \
-DCREATE_TEST_TARGETS=ON \
-DENABLE_LIBSCAP_TESTS=ON \
-DENABLE_DRIVERS_TESTS=ON \
-DENABLE_LIBSINSP_E2E_TESTS=ON \
-DENABLE_VM_TESTS=ON ../;
-DENABLE_LIBSINSP_E2E_TESTS=ON ../;
```
> __NOTE:__ The `ENABLE_LIBSINSP_E2E_TESTS` flag enables the new e2e tests for libsinsp. Please keep in mind these tests are currently in heavy development and need some extra steps (see in the section below) to run correctly.
@ -302,9 +301,10 @@ sudo ./test/drivers/drivers_test -m;
The tests mentioned below expand beyond the scope of "unit tests". In this context as well, we are dedicated to making sure they run smoothly on your `localhost` for pre-PR testing, to the best of our ability:
- [test/e2e](test/e2e) - enforced by our CI
- [test/vm](test/vm) - our CI includes comparable tests, but it employs a distinct framework. For current status reports on Falco drivers kernel testing, please visit this [page](https://falcosecurity.github.io/libs/).
As mentioned earlier, The Falco Project's `libs` repository includes numerous CI-powered checks. For the most current information, please refer to the CI definitions under the [workflows](.github/workflows/) directory.
For current status reports on the CI powered Falco drivers kernel testing, please visit this [page](https://falcosecurity.github.io/libs/).
In general, The Falco Project's `libs` repository includes numerous CI-powered checks. For the most current information, please refer to the CI definitions under the [workflows](.github/workflows/) directory.
### [EXPERIMENTAL] Run libsinsp e2e tests

33
benchmark/CMakeLists.txt Normal file
View File

@ -0,0 +1,33 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
message(STATUS "Benchmarks enabled")
include(googleBenchmark)
set(BENCHMARK_SOURCES ./main.cpp)
set(BENCHMARK_DEPENDENCIES sinsp)
set(BENCHMARK_LIBRARIES benchmark::benchmark sinsp)
set(BENCHMARK_INCLUDE PRIVATE "${LIBSINSP_INCLUDE_DIRS}")
file(GLOB_RECURSE SINSP_SUITE "${CMAKE_CURRENT_SOURCE_DIR}/libsinsp/*.cpp")
list(APPEND BENCHMARK_SOURCES ${SINSP_SUITE})
add_compile_options(${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS})
add_link_options(${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS})
add_executable(bench ${BENCHMARK_SOURCES})
target_link_libraries(bench ${BENCHMARK_LIBRARIES})
target_include_directories(bench ${BENCHMARK_INCLUDE})
add_dependencies(bench ${BENCHMARK_DEPENDENCIES})

14
benchmark/README.md Normal file
View File

@ -0,0 +1,14 @@
# Benchmarks
## Build
```bash
cmake -DENABLE_BENCHMARKS=ON ..
make bench
```
## Run
```bash
sudo ./benchmark/bench
```

View File

@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright (C) 2024 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <libsinsp/utils.h>
#include <benchmark/benchmark.h>
static void BM_sinsp_split(benchmark::State& state) {
for(auto _ : state) {
std::string str = "hello,world,";
benchmark::DoNotOptimize(sinsp_split(str, ','));
}
}
BENCHMARK(BM_sinsp_split);
static void BM_sinsp_concatenate_paths_relative_path(benchmark::State& state) {
for(auto _ : state) {
std::string path1 = "/tmp/";
std::string path2 = "foo/bar";
benchmark::DoNotOptimize(sinsp_utils::concatenate_paths(path1, path2));
}
}
BENCHMARK(BM_sinsp_concatenate_paths_relative_path);
static void BM_sinsp_concatenate_paths_empty_path(benchmark::State& state) {
for(auto _ : state) {
std::string path1 = "/tmp/";
std::string path2 = "";
benchmark::DoNotOptimize(sinsp_utils::concatenate_paths(path1, path2));
}
}
BENCHMARK(BM_sinsp_concatenate_paths_empty_path);
static void BM_sinsp_concatenate_paths_absolute_path(benchmark::State& state) {
for(auto _ : state) {
std::string path1 = "/tmp/";
std::string path2 = "/foo/bar";
benchmark::DoNotOptimize(sinsp_utils::concatenate_paths(path1, path2));
}
}
BENCHMARK(BM_sinsp_concatenate_paths_absolute_path);

21
benchmark/main.cpp Normal file
View File

@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright (C) 2024 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <benchmark/benchmark.h>
BENCHMARK_MAIN();

View File

@ -0,0 +1,138 @@
# Get all dependencies for ${lib} and add them to ${LIBDIRS_VAR} and ${LIBS_VAR}. Ignore any
# dependencies in the list ${ignored} to: - avoid infinite recursion - avoid libscap dependencies in
# libsinsp.pc (which requires libscap.pc and pulls them in that way)
function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
message(DEBUG "[add_pkgconfig_library] processing lib \"${lib}\"")
# if it's not a target, it doesn't have dependencies we know or care about
if(NOT TARGET ${lib})
return()
endif()
# get the libraries that ${lib} links to
get_target_property(PKGCONFIG_LIBRARIES ${lib} LINK_LIBRARIES)
if("${PKGCONFIG_LIBRARIES}" STREQUAL "PKGCONFIG_LIBRARIES-NOTFOUND")
return()
endif()
message(DEBUG "[add_pkgconfig_library] LINK_LIBRARIES property: \"${PKGCONFIG_LIBRARIES}\"")
get_property(
target_type
TARGET ${lib}
PROPERTY TYPE
)
message(DEBUG "[add_pkgconfig_library] ignored list: \"${ignored}\"")
foreach(dep ${PKGCONFIG_LIBRARIES})
# XXX: We use a (very) loose match as we are potentially comparing absolute library file
# names (dep) to pkg-config library names to be ignored. The only alternative I can think
# of would be to maintain a map associating pkg-config names to their library file name.
get_filename_component(dep_base ${dep} NAME_WE)
string(REGEX REPLACE "^lib" "" dep_name ${dep_base})
# For CMake imported targets, keep only the suffix, e.g. gRPC::grpc -> grpc.
string(REGEX REPLACE "[^:]*::" "" dep_name ${dep_base})
message(DEBUG "[add_pkgconfig_library] processing dep ${dep}")
string(FIND "${ignored}" "${dep_name}" find_result)
if(NOT ${find_result} EQUAL -1)
message(DEBUG "[add_pkgconfig_library] \"${dep}\" ignored")
continue()
endif()
if(${target_type} STREQUAL "SHARED_LIBRARY")
# for shared libraries, do not add static libraries as dependencies
if(TARGET ${dep})
# skip static libraries which are CMake targets
get_property(
dep_target_type
TARGET ${dep}
PROPERTY TYPE
)
if(NOT ${dep_target_type} STREQUAL "SHARED_LIBRARY")
continue()
endif()
else()
# skip static libraries which are just file paths
get_filename_component(ext ${dep} LAST_EXT)
if("${ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
continue()
endif()
endif()
elseif(${target_type} STREQUAL "STATIC_LIBRARY")
# for static libraries which are not CMake targets, redirect them to
# ${libdir}/${LIBS_PACKAGE_NAME} note that ${libdir} is not a CMake variable, but a
# pkgconfig variable, so we quote it and end up with a literal ${libdir} in the
# pkgconfig file
if(NOT TARGET ${dep})
get_filename_component(filename ${dep} NAME)
set(dep "\${libdir}/${LIBS_PACKAGE_NAME}/${filename}")
else()
get_property(
dep_target_type
TARGET ${dep}
PROPERTY TYPE
)
if(${dep_target_type} STREQUAL "OBJECT_LIBRARY")
# skip object libraries
continue()
endif()
# if the library is imported, use the IMPORTED_LOCATION instead
get_property(
dep_imported_location
TARGET ${dep}
PROPERTY IMPORTED_LOCATION
)
if(NOT ${dep_imported_location} STREQUAL "")
get_filename_component(filename ${dep_imported_location} NAME)
set(dep "\${libdir}/${LIBS_PACKAGE_NAME}/${filename}")
endif()
endif()
endif()
add_pkgconfig_dependency(${LIBDIRS_VAR} ${LIBS_VAR} ${dep} "${ignored}")
endforeach()
# Remove duplicate search paths. We cannot remove duplicates from ${LIBS_VAR} because the order
# of libraries is important.
list(REMOVE_DUPLICATES ${LIBDIRS_VAR})
set(${LIBS_VAR}
${${LIBS_VAR}}
PARENT_SCOPE
)
set(${LIBDIRS_VAR}
${${LIBDIRS_VAR}}
PARENT_SCOPE
)
endfunction()
function(add_pkgconfig_dependency LIBDIRS_VAR LIBS_VAR lib ignored)
if(${lib} IN_LIST ignored)
# already processed, avoid infinite recursion
elseif(${lib} MATCHES "^-")
# We have a flag. Pass it through unchanged.
list(APPEND ${LIBS_VAR} ${lib})
elseif(${lib} MATCHES "/")
# We have a path. Convert it to -L<dir> + -l<lib>.
get_filename_component(lib_dir ${lib} DIRECTORY)
list(APPEND ${LIBDIRS_VAR} -L${lib_dir})
get_filename_component(lib_base ${lib} NAME_WE)
string(REGEX REPLACE "^lib" "" lib_base ${lib_base})
list(APPEND ${LIBS_VAR} -l${lib_base})
else()
# Assume we have a plain library name. Prefix it with "-l". Then recurse into its
# dependencies but ignore the library itself, so we don't end up in an infinite loop with
# cyclic dependencies
list(APPEND ${LIBS_VAR} -l${lib})
list(APPEND ignored ${lib})
add_pkgconfig_library(${LIBDIRS_VAR} ${LIBS_VAR} ${lib} "${ignored}")
endif()
set(${LIBS_VAR}
${${LIBS_VAR}}
PARENT_SCOPE
)
set(${LIBDIRS_VAR}
${${LIBDIRS_VAR}}
PARENT_SCOPE
)
endfunction()

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(BUILD_WARNINGS_AS_ERRORS "Enable building with -Wextra -Werror flags")
@ -32,49 +33,78 @@ if(NOT MSVC)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "-Wall -ggdb")
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "-Og -D_DEBUG")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "-O3 -fno-strict-aliasing -DNDEBUG")
if(MINIMAL_BUILD)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -DMINIMAL_BUILD")
endif()
if(MUSL_OPTIMIZED_BUILD)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -static -Os")
endif()
if(BUILD_WARNINGS_AS_ERRORS)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
set(CMAKE_SUPPRESSED_WARNINGS "-Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough -Wno-format-truncation")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Clang needs these for suppressing these warnings:
# - C++20 array designators used with C++17
# - C99 array designators used in C++
# - avoid complaining about the option above `-Wno-format-truncation`
set(CMAKE_SUPPRESSED_WARNINGS "${CMAKE_SUPPRESSED_WARNINGS} -Wno-c++20-designator -Wno-c99-designator -Wno-unknown-warning-option")
set(CMAKE_SUPPRESSED_WARNINGS
"-Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough -Wno-format-truncation -Wno-deprecated-declarations"
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Clang needs these for suppressing these warnings: - C++20 array designators used with
# C++17 - C99 array designators used in C++ - avoid complaining about the option above
# `-Wno-format-truncation`
set(CMAKE_SUPPRESSED_WARNINGS
"${CMAKE_SUPPRESSED_WARNINGS} -Wno-c++20-designator -Wno-c99-designator -Wno-unknown-warning-option"
)
endif()
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -Werror -Wextra ${CMAKE_SUPPRESSED_WARNINGS}")
set(FALCOSECURITY_LIBS_COMMON_FLAGS
"${FALCOSECURITY_LIBS_COMMON_FLAGS} -Werror -Wextra ${CMAKE_SUPPRESSED_WARNINGS}"
)
endif()
if(USE_ASAN)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fsanitize=address")
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS};-fsanitize=address;-lpthread")
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fsanitize=address"
)
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS};-fsanitize=address;-lpthread"
)
endif()
if(USE_UBSAN)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fsanitize=undefined")
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS};-fsanitize=undefined")
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fsanitize=undefined"
)
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS};-fsanitize=undefined"
)
if(UBSAN_HALT_ON_ERROR)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fno-sanitize-recover=undefined")
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fno-sanitize-recover=undefined"
)
endif()
endif()
if(USE_TSAN)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};-fsanitize=thread"
)
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS};-fsanitize=thread"
)
endif()
if(ENABLE_COVERAGE)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};--coverage")
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS "${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};--coverage")
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};--coverage"
)
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS
"${FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS};--coverage"
)
endif()
if(ENABLE_THREAD_POOL)
set(FALCOSECURITY_LIBS_COMMON_FLAGS
"${FALCOSECURITY_LIBS_COMMON_FLAGS} -DENABLE_THREAD_POOL"
)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FALCOSECURITY_LIBS_COMMON_FLAGS}")
# we need also `-std=c++17` here beacuse `set(CMAKE_CXX_STANDARD 17)` is not enough to enforce c++17
# with some Cmake versions: https://github.com/falcosecurity/libs/pull/950
# we need also `-std=c++17` here beacuse `set(CMAKE_CXX_STANDARD 17)` is not enough to enforce
# c++17 with some Cmake versions: https://github.com/falcosecurity/libs/pull/950
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FALCOSECURITY_LIBS_COMMON_FLAGS} -std=c++17")
set(CMAKE_C_FLAGS_DEBUG "${FALCOSECURITY_LIBS_DEBUG_FLAGS}")
@ -86,9 +116,9 @@ if(NOT MSVC)
add_definitions(-D__STDC_FORMAT_MACROS)
else() # MSVC
set(MINIMAL_BUILD ON)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "-D_CRT_SECURE_NO_WARNINGS -DWIN32 -DMINIMAL_BUILD /EHsc /W3 /Zi /std:c++17")
set(FALCOSECURITY_LIBS_COMMON_FLAGS
"-D_CRT_SECURE_NO_WARNINGS -DWIN32 /EHsc /W3 /Zi /std:c++17"
)
if(CMAKE_VERSION VERSION_LESS 3.15.0)
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "/MTd /Od")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "/MT")
@ -106,8 +136,9 @@ else() # MSVC
set(CMAKE_C_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
# "_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" enables a workaround for windows GH runner issue, see
# https://github.com/actions/runner-images/issues/10004 Also, define NOMINMAX globally.
add_compile_definitions(
_HAS_STD_BYTE=0
WIN32_LEAN_AND_MEAN
_HAS_STD_BYTE=0 WIN32_LEAN_AND_MEAN _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR NOMINMAX
)
endif()

View File

@ -2,43 +2,33 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
# This module is used to understand where the makedev function
# is defined in the glibc in use.
# see 'man 3 makedev'
# Usage:
# In your CMakeLists.txt
# include(FindMakedev)
# This module is used to understand where the makedev function is defined in the glibc in use. see
# 'man 3 makedev' Usage: In your CMakeLists.txt include(FindMakedev)
#
# In your source code:
# In your source code:
#
# #if HAVE_SYS_MKDEV_H
# #include <sys/mkdev.h>
# #endif
# #ifdef HAVE_SYS_SYSMACROS_H
# #include <sys/sysmacros.h>
# #endif
# #if HAVE_SYS_MKDEV_H #include <sys/mkdev.h> #endif #ifdef HAVE_SYS_SYSMACROS_H #include
# <sys/sysmacros.h> #endif
#
include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
check_include_file("sys/mkdev.h" HAVE_SYS_MKDEV_H)
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
if (HAVE_SYS_MKDEV_H)
add_definitions(-DHAVE_SYS_MKDEV_H)
if(HAVE_SYS_MKDEV_H)
add_definitions(-DHAVE_SYS_MKDEV_H)
endif()
if (HAVE_SYS_SYSMACROS_H)
add_definitions(-DHAVE_SYS_SYSMACROS_H)
if(HAVE_SYS_SYSMACROS_H)
add_definitions(-DHAVE_SYS_SYSMACROS_H)
endif()

View File

@ -0,0 +1,29 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
find_path(BS_THREADPOOL_INCLUDE NAMES BS_thread_pool.hpp)
if(BS_THREADPOOL_INCLUDE)
if(NOT bs_threadpool_FIND_QUIETLY)
message(STATUS "Found bs_threadpool: include: ${BS_THREADPOOL_INCLUDE}.")
endif()
else()
if(bs_threadpool_FIND_REQUIRED)
message(FATAL_ERROR "Required component bs_threadpool missing.")
endif()
if(NOT bs_threadpool_FIND_QUIETLY)
message(WARNING "bs_threadpool not found.")
endif()
endif()

View File

@ -2,35 +2,32 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
# This module is used to find where the valijson headers are installed
# on the system. This is required up to v0.6, since package config
# files are not provided. This is fixed in master though, and this
# file shall be automatically ignored for later versions.
# This module is used to find where the valijson headers are installed on the system. This is
# required up to v0.6, since package config files are not provided. This is fixed in master though,
# and this file shall be automatically ignored for later versions.
find_path(VALIJSON_INCLUDE NAMES valijson/validator.hpp validator.hpp)
if (VALIJSON_INCLUDE)
if (NOT valijson_FIND_QUIETLY)
message(STATUS "Found valijson: include: ${VALIJSON_INCLUDE}.")
endif()
if(VALIJSON_INCLUDE)
if(NOT valijson_FIND_QUIETLY)
message(STATUS "Found valijson: include: ${VALIJSON_INCLUDE}.")
endif()
else()
if (valijson_FIND_REQUIRED)
message(FATAL_ERROR "Required component valijson missing.")
endif()
if (NOT valijson_FIND_QUIETLY)
message(WARNING "Valijson not found.")
endif()
if(valijson_FIND_REQUIRED)
message(FATAL_ERROR "Required component valijson missing.")
endif()
if(NOT valijson_FIND_QUIETLY)
message(WARNING "Valijson not found.")
endif()
endif()

View File

@ -2,191 +2,225 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
if(_falcosecurity_get_version_from_git)
return()
return()
endif()
set(_falcosecurity_get_version_from_git TRUE)
if(NOT FALCOSECURITY_RELEASE_BRANCH_REGEX)
set(FALCOSECURITY_RELEASE_BRANCH_REGEX "^release/")
set(FALCOSECURITY_RELEASE_BRANCH_REGEX "^release/")
endif()
function(_falcosecurity_execute_git _out)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${GIT_EXECUTABLE}" ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT res EQUAL 0)
set(out "")
endif()
if(NOT res EQUAL 0)
set(out "")
endif()
set(${_out} "${out}" PARENT_SCOPE)
set(${_out}
"${out}"
PARENT_SCOPE
)
endfunction()
function(_falcosecurity_extract_version version_str x y z found)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" match_result ${version_str})
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" match_result ${version_str})
if(match_result)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" x_val ${match_result})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" y_val ${match_result})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" z_val ${match_result})
set(${x} ${x_val} PARENT_SCOPE)
set(${y} ${y_val} PARENT_SCOPE)
set(${z} ${z_val} PARENT_SCOPE)
set(${found} TRUE PARENT_SCOPE)
else()
set(${found} FALSE PARENT_SCOPE)
endif()
if(match_result)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" x_val ${match_result})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" y_val ${match_result})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" z_val ${match_result})
set(${x}
${x_val}
PARENT_SCOPE
)
set(${y}
${y_val}
PARENT_SCOPE
)
set(${z}
${z_val}
PARENT_SCOPE
)
set(${found}
TRUE
PARENT_SCOPE
)
else()
set(${found}
FALSE
PARENT_SCOPE
)
endif()
endfunction()
# get_version_from_git() provides a basic implementation of the Falco versioning convention.
#
# The primary convention is that all version numbers should be a SemVer2.0-compatible string.
# The version number for the development build must follow a pre-release version pattern.
# To accomplish this, we use Git as the primary data source to construct the version number
# automatically. In this regard, the convention assumes that:
# any Git tag represents an officially released build,
# and each Git commit could potentially be a development build.
# The primary convention is that all version numbers should be a SemVer2.0-compatible string. The
# version number for the development build must follow a pre-release version pattern. To accomplish
# this, we use Git as the primary data source to construct the version number automatically. In this
# regard, the convention assumes that: any Git tag represents an officially released build, and each
# Git commit could potentially be a development build.
#
# With those assumptions, the build system will return a version number based on one of
# the following cases:
# With those assumptions, the build system will return a version number based on one of the
# following cases:
#
# - If the current Git checkout points to an exact Git tag,
# we assume it is an officially released version (either a release or a pre-release).
# * If the current Git checkout points to an exact Git tag, we assume it is an officially released
# version (either a release or a pre-release).
#
# - If we are in a release branch (with the suffix `release/`),
# we assume that each commit (i.e., each development build) represents a potential new patch version.
# * If we are in a release branch (with the suffix `release/`), we assume that each commit (i.e.,
# each development build) represents a potential new patch version.
#
# - If we are in any other branch,
# we assume that each commit (i.e., each development build) represents a potential new minor version.
# * If we are in any other branch, we assume that each commit (i.e., each development build)
# represents a potential new minor version.
#
# - In any other case (for example, if there's no git information available),
# version `0.0.0` will be returned as a fallback.
# * In any other case (for example, if there's no git information available), version `0.0.0` will
# be returned as a fallback.
#
# For the officially released versions, we assume the Git tag will carry on the correct information,
# so we return it as-is.
#
# For development versions, the string is built as follows:
# `<x>.<y>.<z>-<count>+<commit>[suffix]`
# Where:
# - `<x>.<y>.<z>` represents the next version number, reflecting either a patch for release branches
# or a minor version for development branches.
# - `<count>` is the number of commits ahead from either:
# - the latest tag on the branch, for release branches; or
# - the closest common ancestor with the branch holding the latest tagged version,
# for development branches.
# - `<commit>` refers to the first 7 digits of the commit hash.
# - `[suffix]` the value of `match_suffix`, if any.
# For development versions, the string is built as follows: `<x>.<y>.<z>-<count>+<commit>[suffix]`
# Where: - `<x>.<y>.<z>` represents the next version number, reflecting either a patch for release
# branches or a minor version for development branches. - `<count>` is the number of commits ahead
# from either: - the latest tag on the branch, for release branches; or - the closest common
# ancestor with the branch holding the latest tagged version, for development branches. - `<commit>`
# refers to the first 7 digits of the commit hash. - `[suffix]` the value of `match_suffix`, if any.
# Note: all non-alphanumerics will be converted to hyphens.
#
#
# This function sets the resulting version string to a variable in the parent scope.
#
# Arguments:
# - _var Variable to store the resulting version string.
# - match_suffix Only consider Git references with this suffix.
# - exclude_suffix Ignore Git references with this suffix.
# Arguments: - _var Variable to store the resulting version string. - match_suffix Only
# consider Git references with this suffix. - exclude_suffix Ignore Git references with this
# suffix.
function(get_version_from_git _var match_suffix exclude_suffix)
# Release version
# Try to obtain the exact git tag
if(exclude_suffix)
_falcosecurity_execute_git(tag describe --tags --exact-match --match "*${match_suffix}" --exclude "*${exclude_suffix}" HEAD)
else()
_falcosecurity_execute_git(tag describe --tags --exact-match --match "*${match_suffix}" HEAD)
endif()
# Release version Try to obtain the exact git tag
if(exclude_suffix)
_falcosecurity_execute_git(
tag
describe
--tags
--exact-match
--match
"*${match_suffix}"
--exclude
"*${exclude_suffix}"
HEAD
)
else()
_falcosecurity_execute_git(
tag
describe
--tags
--exact-match
--match
"*${match_suffix}"
HEAD
)
endif()
if(tag)
# A tag has been found: use it as the libs version
set(${_var}
"${tag}"
PARENT_SCOPE)
return()
endif()
if(tag)
# A tag has been found: use it as the libs version
set(${_var}
"${tag}"
PARENT_SCOPE
)
return()
endif()
# Otherwise, we are on a dev version
_falcosecurity_execute_git(current_hash rev-parse HEAD)
_falcosecurity_execute_git(current_hash_short rev-parse --short=7 HEAD)
_falcosecurity_execute_git(current_branch rev-parse --abbrev-ref HEAD)
# Otherwise, we are on a dev version
_falcosecurity_execute_git(current_hash rev-parse HEAD)
_falcosecurity_execute_git(current_hash_short rev-parse --short=7 HEAD)
_falcosecurity_execute_git(current_branch rev-parse --abbrev-ref HEAD)
set(dev_version "0.0.0")
set(dev_version "0.0.0")
# dev version / in a `release/M.m.x` branch
if(current_branch MATCHES "${FALCOSECURITY_RELEASE_BRANCH_REGEX}")
# get the latest tag on the release branch
set(_options --match "*.*.*${match_suffix}")
# dev version / in a `release/M.m.x` branch
if(current_branch MATCHES "${FALCOSECURITY_RELEASE_BRANCH_REGEX}")
# get the latest tag on the release branch
set(_options --match "*.*.*${match_suffix}")
if(exclude_suffix)
set(_options ${_options} --exclude "*${exclude_suffix}")
endif()
if(exclude_suffix)
set(_options ${_options} --exclude "*${exclude_suffix}")
endif()
_falcosecurity_execute_git(tag describe --tags ${_options} --abbrev=0 "${current_branch}")
_falcosecurity_execute_git(tag describe --tags ${_options} --abbrev=0 "${current_branch}")
if(tag)
_falcosecurity_extract_version("${tag}" x y z match_found)
if(tag)
_falcosecurity_extract_version("${tag}" x y z match_found)
if(match_found)
math(EXPR z_plus_one "${z} + 1")
set(dev_version "${x}.${y}.${z_plus_one}")
endif()
endif()
endif()
if(match_found)
math(EXPR z_plus_one "${z} + 1")
set(dev_version "${x}.${y}.${z_plus_one}")
endif()
endif()
endif()
# dev version / all other cases (and fallback)
if(dev_version MATCHES "0.0.0")
# get the latest tag that exactly matches a version number, sorted by version number in descending order
_falcosecurity_execute_git(tag for-each-ref --count=1 --sort=-version:refname --format "%(refname:short)" refs/tags/[0-9]*.[0-9]*.[0-9]${match_suffix})
# dev version / all other cases (and fallback)
if(dev_version MATCHES "0.0.0")
# get the latest tag that exactly matches a version number, sorted by version number in
# descending order
_falcosecurity_execute_git(
tag
for-each-ref
--count=1
--sort=-version:refname
--format
"%(refname:short)"
refs/tags/[0-9]*.[0-9]*.[0-9]${match_suffix}
)
if(tag)
_falcosecurity_extract_version("${tag}" x y z match_found)
if(tag)
_falcosecurity_extract_version("${tag}" x y z match_found)
if(match_found)
math(EXPR y_plus_one "${y} + 1")
set(dev_version "${x}.${y_plus_one}.0")
endif()
endif()
endif()
if(match_found)
math(EXPR y_plus_one "${y} + 1")
set(dev_version "${x}.${y_plus_one}.0")
endif()
endif()
endif()
# complete dev version with count and hash
if(NOT dev_version MATCHES "0.0.0")
_falcosecurity_execute_git(tag_commit rev-list -n 1 "${tag}")
_falcosecurity_execute_git(tag_common_ancestor merge-base "${current_hash}" "${tag_commit}")
_falcosecurity_execute_git(commits_count rev-list --count "${tag_common_ancestor}..${current_hash}")
# complete dev version with count and hash
if(NOT dev_version MATCHES "0.0.0")
_falcosecurity_execute_git(tag_commit rev-list -n 1 "${tag}")
_falcosecurity_execute_git(tag_common_ancestor merge-base "${current_hash}" "${tag_commit}")
_falcosecurity_execute_git(
commits_count rev-list --count "${tag_common_ancestor}..${current_hash}"
)
set(dev_version "${dev_version}-${commits_count}+${current_hash_short}")
set(dev_version "${dev_version}-${commits_count}+${current_hash_short}")
if(match_suffix)
string(REGEX REPLACE "[^0-9A-Za-z-]" "-" suffix "${match_suffix}")
set(dev_version "${dev_version}${suffix}")
endif()
endif()
if(match_suffix)
string(REGEX REPLACE "[^0-9A-Za-z-]" "-" suffix "${match_suffix}")
set(dev_version "${dev_version}${suffix}")
endif()
endif()
set(${_var}
"${dev_version}"
PARENT_SCOPE)
set(${_var}
"${dev_version}"
PARENT_SCOPE
)
endfunction()

View File

@ -0,0 +1,47 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
#
# bshoshany/thread-pool (https://github.com/bshoshany/thread-pool)
#
option(USE_BUNDLED_BS_THREADPOOL "Enable building of the bundled bs_threadpool" ${USE_BUNDLED_DEPS})
if(BS_THREADPOOL_INCLUDE)
# we already have bs_threadpool
elseif(NOT USE_BUNDLED_BS_THREADPOOL)
find_package(bs_threadpool REQUIRED)
else()
set(BS_THREADPOOL_SRC "${PROJECT_BINARY_DIR}/bs_threadpool-prefix/src/bs_threadpool")
set(BS_THREADPOOL_INCLUDE "${BS_THREADPOOL_SRC}/include")
message(STATUS "Using bundled bs_threadpool in '${BS_THREADPOOL_SRC}'")
ExternalProject_Add(
bs_threadpool
PREFIX "${PROJECT_BINARY_DIR}/bs_threadpool-prefix"
URL "https://github.com/bshoshany/thread-pool/archive/refs/tags/v4.1.0.tar.gz"
URL_HASH "SHA256=be7abecbc420bb87919eeef729b13ff7c29d5ce547bdae284923296c695415bd"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()
if(NOT TARGET bs_threadpool)
add_custom_target(bs_threadpool)
endif()
include_directories("${BS_THREADPOOL_INCLUDE}")

View File

@ -1,65 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
option(USE_BUNDLED_CARES "Enable building of the bundled c-ares" ${USE_BUNDLED_DEPS})
if(CARES_INCLUDE)
# we already have c-ares
elseif(NOT USE_BUNDLED_CARES)
find_path(CARES_INCLUDE NAMES cares/ares.h ares.h)
find_library(CARES_LIB NAMES cares)
if(CARES_INCLUDE AND CARES_LIB)
message(STATUS "Found c-ares: include: ${CARES_INCLUDE}, lib: ${CARES_LIB}")
else()
message(FATAL_ERROR "Couldn't find system c-ares")
endif()
else()
if(BUILD_SHARED_LIBS)
set(CARES_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(CARES_CPPFLAGS )
set(CARES_STATIC_OPTION )
else()
set(CARES_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CARES_CPPFLAGS -DCARES_STATICLIB)
set(CARES_STATIC_OPTION --disable-shared)
endif()
set(CARES_SRC "${PROJECT_BINARY_DIR}/c-ares-prefix/src/c-ares")
set(CARES_INCLUDE "${CARES_SRC}/target/include/")
set(CARES_LIB "${CARES_SRC}/target/lib/libcares${CARES_LIB_SUFFIX}")
set(CARES_INSTALL_DIR "${CARES_SRC}/target")
if(NOT TARGET c-ares)
message(STATUS "Using bundled c-ares in '${CARES_SRC}'")
ExternalProject_Add(c-ares
PREFIX "${PROJECT_BINARY_DIR}/c-ares-prefix"
URL "https://c-ares.haxx.se/download/c-ares-1.19.1.tar.gz"
URL_HASH "SHA256=321700399b72ed0e037d0074c629e7741f6b2ec2dda92956abe3e9671d3e268e"
CONFIGURE_COMMAND CPPFLAGS=${CARES_CPPFLAGS} ./configure ${CARES_STATIC_OPTION} --prefix=${CARES_INSTALL_DIR}
BUILD_COMMAND make
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${CARES_INCLUDE} ${CARES_LIB}
INSTALL_COMMAND make install)
install(FILES "${CARES_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${CARES_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
endif()
if(NOT TARGET c-ares)
add_custom_target(c-ares)
endif()
include_directories("${CARES_INCLUDE}")

View File

@ -2,38 +2,50 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
# Computes API/SCHEMA major, minor, patch and git commit
macro(compute_versions api_version_path schema_version_path)
# API VERSION
file(STRINGS ${api_version_path} DRIVER_API_VERSION LIMIT_COUNT 1)
string(REGEX MATCHALL "[0-9]+" DRIVER_API_COMPONENTS "${DRIVER_API_VERSION}")
list(GET DRIVER_API_COMPONENTS 0 PPM_API_CURRENT_VERSION_MAJOR)
list(GET DRIVER_API_COMPONENTS 1 PPM_API_CURRENT_VERSION_MINOR)
list(GET DRIVER_API_COMPONENTS 2 PPM_API_CURRENT_VERSION_PATCH)
message(STATUS "Driver API version ${PPM_API_CURRENT_VERSION_MAJOR}.${PPM_API_CURRENT_VERSION_MINOR}.${PPM_API_CURRENT_VERSION_PATCH}")
# SCHEMA VERSION
file(STRINGS ${schema_version_path} DRIVER_SCHEMA_VERSION LIMIT_COUNT 1)
string(REGEX MATCHALL "[0-9]+" DRIVER_SCHEMA_COMPONENTS "${DRIVER_SCHEMA_VERSION}")
list(GET DRIVER_SCHEMA_COMPONENTS 0 PPM_SCHEMA_CURRENT_VERSION_MAJOR)
list(GET DRIVER_SCHEMA_COMPONENTS 1 PPM_SCHEMA_CURRENT_VERSION_MINOR)
list(GET DRIVER_SCHEMA_COMPONENTS 2 PPM_SCHEMA_CURRENT_VERSION_PATCH)
message(STATUS "Driver schema version ${PPM_SCHEMA_CURRENT_VERSION_MAJOR}.${PPM_SCHEMA_CURRENT_VERSION_MINOR}.${PPM_SCHEMA_CURRENT_VERSION_PATCH}")
# API VERSION
file(STRINGS ${api_version_path} DRIVER_API_VERSION LIMIT_COUNT 1)
string(REGEX MATCHALL "[0-9]+" DRIVER_API_COMPONENTS "${DRIVER_API_VERSION}")
list(GET DRIVER_API_COMPONENTS 0 PPM_API_CURRENT_VERSION_MAJOR)
list(GET DRIVER_API_COMPONENTS 1 PPM_API_CURRENT_VERSION_MINOR)
list(GET DRIVER_API_COMPONENTS 2 PPM_API_CURRENT_VERSION_PATCH)
message(
STATUS
"Driver API version ${PPM_API_CURRENT_VERSION_MAJOR}.${PPM_API_CURRENT_VERSION_MINOR}.${PPM_API_CURRENT_VERSION_PATCH}"
)
# GIT COMMIT
if(NOT DEFINED GIT_COMMIT)
execute_process(COMMAND git rev-parse HEAD OUTPUT_VARIABLE GIT_COMMIT ERROR_QUIET WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
string(STRIP "${GIT_COMMIT}" GIT_COMMIT)
# SCHEMA VERSION
file(STRINGS ${schema_version_path} DRIVER_SCHEMA_VERSION LIMIT_COUNT 1)
string(REGEX MATCHALL "[0-9]+" DRIVER_SCHEMA_COMPONENTS "${DRIVER_SCHEMA_VERSION}")
list(GET DRIVER_SCHEMA_COMPONENTS 0 PPM_SCHEMA_CURRENT_VERSION_MAJOR)
list(GET DRIVER_SCHEMA_COMPONENTS 1 PPM_SCHEMA_CURRENT_VERSION_MINOR)
list(GET DRIVER_SCHEMA_COMPONENTS 2 PPM_SCHEMA_CURRENT_VERSION_PATCH)
message(
STATUS
"Driver schema version ${PPM_SCHEMA_CURRENT_VERSION_MAJOR}.${PPM_SCHEMA_CURRENT_VERSION_MINOR}.${PPM_SCHEMA_CURRENT_VERSION_PATCH}"
)
# GIT COMMIT
if(NOT DEFINED GIT_COMMIT)
execute_process(
COMMAND git rev-parse HEAD
OUTPUT_VARIABLE GIT_COMMIT
ERROR_QUIET
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
string(STRIP "${GIT_COMMIT}" GIT_COMMIT)
endmacro()

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2025 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
include(ExternalProject)
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} PLUGINS_SYSTEM_NAME)
set(CONTAINER_LIBRARY
"${CMAKE_CURRENT_BINARY_DIR}/container_plugin-prefix/src/container_plugin/libcontainer.so"
)
if(NOT CONTAINER_VERSION)
set(CONTAINER_VERSION "0.3.4")
endif()
if(NOT CONTAINER_HASH)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(CONTAINER_HASH "658f96c4b4a56d1bf945a788d60571076f808ae1bcc877c4ba3625b0fd752d8d")
else() # arm64
set(CONTAINER_HASH "34a153aca0164843a169193aba092a3063b24bca9ef80fd4f1d1f1919aba3bde")
endif()
endif()
if(NOT TARGET container_plugin)
message(STATUS "Fetching container plugin ${CONTAINER_VERSION} in '${CONTAINER_LIBRARY}'")
ExternalProject_Add(
container_plugin
URL "https://download.falco.org/plugins/stable/container-${CONTAINER_VERSION}-${PLUGINS_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}.tar.gz"
URL_HASH "SHA256=${CONTAINER_HASH}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()

View File

@ -1,114 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
option(USE_BUNDLED_CURL "Enable building of the bundled curl" ${USE_BUNDLED_DEPS})
include(openssl)
include(zlib)
if(CURL_INCLUDE_DIRS)
# we already have curl
elseif(NOT USE_BUNDLED_CURL)
find_package(CURL REQUIRED)
message(STATUS "Found CURL: include: ${CURL_INCLUDE_DIRS}, lib: ${CURL_LIBRARIES}")
else()
if(BUILD_SHARED_LIBS)
set(CURL_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(CURL_STATIC_OPTION )
else()
set(CURL_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CURL_STATIC_OPTION --disable-shared)
endif()
set(CURL_BUNDLE_DIR "${PROJECT_BINARY_DIR}/curl-prefix/src/curl")
set(CURL_INCLUDE_DIRS "${CURL_BUNDLE_DIR}/include/")
set(CURL_LIBRARIES "${CURL_BUNDLE_DIR}/lib/.libs/libcurl${CURL_LIB_SUFFIX}")
if(NOT USE_BUNDLED_OPENSSL)
set(CURL_SSL_OPTION "--with-ssl")
else()
set(CURL_SSL_OPTION "--with-ssl=${OPENSSL_INSTALL_DIR}")
message(STATUS "Using SSL for curl in '${OPENSSL_INSTALL_DIR}'")
endif()
if(NOT USE_BUNDLED_ZLIB)
set(CURL_ZLIB_OPTION "--with-zlib")
else()
set(CURL_ZLIB_OPTION "--with-zlib=${ZLIB_SRC}")
message(STATUS "Using zlib for curl in '${ZLIB_SRC}'")
endif()
message(STATUS "Using bundled curl in '${CURL_BUNDLE_DIR}'")
if(NOT TARGET curl)
ExternalProject_Add(
curl
PREFIX "${PROJECT_BINARY_DIR}/curl-prefix"
DEPENDS openssl zlib
URL "https://github.com/curl/curl/releases/download/curl-8_7_1/curl-8.7.1.tar.bz2"
URL_HASH "SHA256=05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76"
CONFIGURE_COMMAND
./configure
${CURL_SSL_OPTION}
${CURL_ZLIB_OPTION}
${CURL_STATIC_OPTION}
--enable-optimize
--disable-curldebug
--disable-rt
--enable-http
--disable-ftp
--disable-file
--disable-ldap
--disable-ldaps
--disable-rtsp
--disable-telnet
--disable-tftp
--disable-pop3
--disable-imap
--disable-smb
--disable-smtp
--disable-gopher
--disable-sspi
--disable-ntlm-wb
--disable-tls-srp
--without-winssl
--without-polarssl
--without-cyassl
--without-nss
--without-axtls
--without-librtmp
--without-winidn
--without-libidn2
--without-libpsl
--without-nghttp2
--without-libssh2
--with-ca-path=/etc/ssl/certs/
--disable-threaded-resolver
--without-brotli
--without-zstd
BUILD_COMMAND make
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${CURL_LIBRARIES}
INSTALL_COMMAND "")
install(FILES "${CURL_LIBRARIES}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${CURL_INCLUDE_DIRS}curl" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING PATTERN "*.h")
endif()
endif()
if(NOT TARGET curl)
add_custom_target(curl)
endif()
include_directories("${CURL_INCLUDE_DIRS}")

View File

@ -23,9 +23,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()
# gVisor is currently only supported on Linux x86_64
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
option(BUILD_LIBSCAP_GVISOR "Build gVisor support" ON)
if (BUILD_LIBSCAP_GVISOR)
if(BUILD_LIBSCAP_GVISOR)
set(HAS_ENGINE_GVISOR On)
endif()
endif()

View File

@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
# Disable the Google Benchmark requirement on Google Test
set(BENCHMARK_ENABLE_TESTING OFF)
include(FetchContent)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.9.0
)
FetchContent_MakeAvailable(googlebenchmark)

View File

@ -1,222 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
option(USE_BUNDLED_GRPC "Enable building of the bundled grpc" ${USE_BUNDLED_DEPS})
if(GRPC_INCLUDE)
# we already have grpc
elseif(NOT USE_BUNDLED_GRPC)
# gRPC
find_package(gRPC CONFIG)
if(gRPC_FOUND)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(GPR_LIB gRPC::gpr)
set(GRPC_LIB gRPC::grpc)
set(GRPCPP_LIB gRPC::grpc++)
# gRPC C++ plugin
get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()
# gRPC include dir + properly handle grpc{++,pp}
get_target_property(GRPC_INCLUDE gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES)
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h PATHS ${GRPC_INCLUDE})
if(NOT GRPCXX_INCLUDE)
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h PATHS ${GRPC_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
else()
# Fallback to manually find libraries;
# Some distro, namely Ubuntu focal, do not install gRPC config cmake module
find_library(GPR_LIB NAMES gpr)
if(GPR_LIB)
message(STATUS "Found gpr lib: ${GPR_LIB}")
else()
message(FATAL_ERROR "Couldn't find system gpr")
endif()
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h)
if(GRPCXX_INCLUDE)
set(GRPC_INCLUDE ${GRPCXX_INCLUDE})
else()
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h)
set(GRPC_INCLUDE ${GRPCPP_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
find_library(GRPC_LIB NAMES grpc)
find_library(GRPCPP_LIB NAMES grpc++)
if(GRPC_INCLUDE AND GRPC_LIB AND GRPCPP_LIB)
message(STATUS "Found grpc: include: ${GRPC_INCLUDE}, C lib: ${GRPC_LIB}, C++ lib: ${GRPCPP_LIB}")
else()
message(FATAL_ERROR "Couldn't find system grpc")
endif()
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()
endif()
else()
include(cares)
include(protobuf)
include(zlib)
include(openssl)
if(BUILD_SHARED_LIBS)
set(GRPC_OPENSSL_STATIC_LIBS_OPTION FALSE)
else()
set(GRPC_OPENSSL_STATIC_LIBS_OPTION TRUE)
endif()
include(re2)
set(GRPC_SRC "${PROJECT_BINARY_DIR}/grpc-prefix/src/grpc")
set(GRPC_INSTALL_DIR "${GRPC_SRC}/target")
set(GRPC_INCLUDE
"${GRPC_INSTALL_DIR}/include"
"${GRPC_SRC}/third_party/abseil-cpp")
set(GPR_LIB "${GRPC_SRC}/libgpr.a")
set(GRPC_LIB "${GRPC_SRC}/libgrpc.a")
set(GRPCPP_LIB "${GRPC_SRC}/libgrpc++.a")
set(GRPC_CPP_PLUGIN "${GRPC_SRC}/grpc_cpp_plugin")
set(GRPC_MAIN_LIBS "")
list(APPEND GRPC_MAIN_LIBS
"${GPR_LIB}"
"${GRPC_LIB}"
"${GRPCPP_LIB}"
"${GRPC_SRC}/libgrpc++_alts.a"
"${GRPC_SRC}/libgrpc++_error_details.a"
"${GRPC_SRC}/libgrpc++_reflection.a"
"${GRPC_SRC}/libgrpc++_unsecure.a"
"${GRPC_SRC}/libgrpc_plugin_support.a"
"${GRPC_SRC}/libgrpc_unsecure.a"
"${GRPC_SRC}/libgrpcpp_channelz.a"
)
get_filename_component(PROTOC_DIR ${PROTOC} PATH)
if(NOT TARGET grpc)
message(STATUS "Using bundled grpc in '${GRPC_SRC}'")
# fixme(leogr): this workaround is required to inject the missing deps (built by gRCP cmakefiles)
# into target_link_libraries later
# note: the list below is manually generated starting from the output of pkg-config --libs grpc++
set(GRPC_LIBRARIES "")
list(APPEND GRPC_LIBRARIES
"${GRPC_SRC}/libaddress_sorting.a"
"${GRPC_SRC}/libupb.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_hash.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_city.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_low_level_hash.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/container/libabsl_raw_hash_set.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/container/libabsl_hashtablez_sampler.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/status/libabsl_statusor.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/status/libabsl_status.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cord.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_functions.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/profiling/libabsl_exponential_biased.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/types/libabsl_bad_variant_access.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_str_format_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/synchronization/libabsl_synchronization.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/synchronization/libabsl_graphcycles_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_stacktrace.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_symbolize.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_debugging_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_demangle_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_malloc_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_time.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_civil_time.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_strings.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_strings_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_base.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_spinlock_wait.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/numeric/libabsl_int128.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_log_severity.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_time_zone.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cord_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_info.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_handle.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_pool_urbg.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_hwaes.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_hwaes_impl.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_slow.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_seed_material.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_platform.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_seed_gen_exception.a"
)
ExternalProject_Add(grpc
PREFIX "${PROJECT_BINARY_DIR}/grpc-prefix"
DEPENDS openssl protobuf c-ares zlib re2
GIT_REPOSITORY https://github.com/grpc/grpc.git
GIT_TAG v1.44.0
GIT_SUBMODULES "third_party/abseil-cpp"
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${GRPC_INSTALL_DIR}
-DCMAKE_BUILD_TYPE:STRING=Release
-DgRPC_INSTALL:BOOL=OFF
# disable unused stuff
-DgRPC_BUILD_TESTS:BOOL=OFF
-DgRPC_BUILD_CSHARP_EXT:BOOL=OFF
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN:BOOL=OFF
-DgRPC_BUILD_GRPC_NODE_PLUGIN:BOOL=OFF
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN:BOOL=OFF
-DgRPC_BUILD_GRPC_PHP_PLUGIN:BOOL=OFF
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN:BOOL=OFF
-DgRPC_BUILD_GRPC_RUBY_PLUGIN:BOOL=OFF
# deps provided by us
# https://github.com/grpc/grpc/blob/v1.32.0/cmake/modules/Findc-ares.cmake
-DgRPC_CARES_PROVIDER:STRING=package
-Dc-ares_DIR:PATH=${CARES_SRC}
-Dc-ares_INCLUDE_DIR:PATH=${CARES_INCLUDE}
-Dc-ares_LIBRARY:PATH=${CARES_LIB}
# https://cmake.org/cmake/help/v3.6/module/FindProtobuf.html
-DgRPC_PROTOBUF_PROVIDER:STRING=package
-DCMAKE_CXX_FLAGS:STRING=-I${PROTOBUF_INCLUDE}
-DProtobuf_INCLUDE_DIR:PATH=${PROTOBUF_INCLUDE}
-DProtobuf_LIBRARY:PATH=${PROTOBUF_LIB}
-DProtobuf_PROTOC_LIBRARY:PATH=${PROTOC_LIB}
-DProtobuf_PROTOC_EXECUTABLE:PATH=${PROTOC}
# https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html
-DgRPC_SSL_PROVIDER:STRING=package
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_INSTALL_DIR}
-DOPENSSL_USE_STATIC_LIBS:BOOL=${GRPC_OPENSSL_STATIC_LIBS_OPTION}
# https://cmake.org/cmake/help/v3.6/module/FindZLIB.html
-DgRPC_ZLIB_PROVIDER:STRING=package
-DZLIB_ROOT:STRING=${ZLIB_SRC}
# RE2
-DgRPC_RE2_PROVIDER:STRING=package
-Dre2_DIR:PATH=${RE2_DIR}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${GRPC_LIB} ${GRPCPP_LIB} ${GPR_LIB} ${GRPC_LIBRARIES}
# Keep installation files into the local ${GRPC_INSTALL_DIR}
# since here is the case when we are embedding gRPC
UPDATE_COMMAND ""
INSTALL_COMMAND DESTDIR= ${CMAKE_MAKE_PROGRAM} install
)
install(FILES ${GRPC_MAIN_LIBS} DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES ${GRPC_LIBRARIES} DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${GRPC_SRC}/target/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
endif()
if(NOT TARGET grpc)
add_custom_target(grpc)
endif()
include_directories("${GRPC_INCLUDE}")

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_GTEST "Enable building of the bundled gtest" ${USE_BUNDLED_DEPS})
@ -17,41 +18,60 @@ option(USE_BUNDLED_GTEST "Enable building of the bundled gtest" ${USE_BUNDLED_DE
if(GTEST_INCLUDE_DIR)
# we already have gtest
elseif(NOT USE_BUNDLED_GTEST)
find_path(GTEST_INCLUDE_DIR PATH_SUFFIXES gtest NAMES gtest.h)
find_path(
GTEST_INCLUDE_DIR
PATH_SUFFIXES gtest
NAMES gtest.h
)
find_library(GTEST_LIB NAMES gtest)
find_library(GTEST_MAIN_LIB NAMES gtest_main)
if(GTEST_INCLUDE_DIR AND GTEST_LIB AND GTEST_MAIN_LIB)
message(STATUS "Found gtest: include: ${GTEST_INCLUDE_DIR}, lib: ${GTEST_LIB}, main lib: ${GTEST_MAIN_LIB}")
if(GTEST_INCLUDE_DIR
AND GTEST_LIB
AND GTEST_MAIN_LIB
)
message(
STATUS
"Found gtest: include: ${GTEST_INCLUDE_DIR}, lib: ${GTEST_LIB}, main lib: ${GTEST_MAIN_LIB}"
)
else()
message(FATAL_ERROR "Couldn't find system gtest")
endif()
else()
# https://github.com/google/googletest/tree/main/googletest#incorporating-into-an-existing-cmake-project
# Download and unpack googletest at configure time
configure_file(CMakeListsGtestInclude.cmake ${PROJECT_BINARY_DIR}/googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
configure_file(
CMakeListsGtestInclude.cmake ${PROJECT_BINARY_DIR}/googletest-download/CMakeLists.txt
)
execute_process(
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download )
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download
)
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
execute_process(
COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download )
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download
)
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${PROJECT_BINARY_DIR}/googletest-src
${PROJECT_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# Add googletest directly to our build. This defines the gtest and gtest_main targets.
add_subdirectory(
${PROJECT_BINARY_DIR}/googletest-src ${PROJECT_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL
)
set(GTEST_INCLUDE_DIR "${gtest_SOURCE_DIR}/include")
set(GTEST_MAIN_LIB "gtest_main")
install(DIRECTORY "${GTEST_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(
DIRECTORY "${GTEST_INCLUDE_DIR}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()
if(NOT TARGET gtest)

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_JSONCPP "Enable building of the bundled jsoncpp" ${USE_BUNDLED_DEPS})
@ -44,66 +45,70 @@ else()
message(STATUS "Using bundled jsoncpp in '${JSONCPP_SRC}'")
if(NOT WIN32)
ExternalProject_Add(
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH
"SHA256=f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2"
CMAKE_ARGS
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
BUILD_BYPRODUCTS ${JSONCPP_LIB}
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH "SHA256=f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2"
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
BUILD_BYPRODUCTS ${JSONCPP_LIB}
)
else()
# see: https://cmake.org/cmake/help/latest/policy/CMP0091.html
if(CMAKE_VERSION VERSION_LESS 3.15.0)
ExternalProject_Add(
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH
"SHA256=f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2"
CMAKE_ARGS
-DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
CMAKE_ARGS -DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
)
else()
ExternalProject_Add(
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH
jsoncpp
PREFIX "${PROJECT_BINARY_DIR}/jsoncpp-prefix"
URL "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
URL_HASH
"SHA256=f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2"
CMAKE_ARGS
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DBUILD_OBJECT_LIBS=Off
${JSONCPP_STATIC_OPTION}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=Off
-DJSONCPP_WITH_POST_BUILD_UNITTEST=Off
-DCMAKE_INSTALL_PREFIX=${JSONCPP_SRC}
-DCMAKE_INSTALL_LIBDIR=lib
)
endif()
endif()
install(FILES "${JSONCPP_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${JSONCPP_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(
FILES "${JSONCPP_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
install(
DIRECTORY "${JSONCPP_INCLUDE}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()
endif()

View File

@ -2,57 +2,79 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_LIBBPF "Enable building of the bundled libbpf" ${USE_BUNDLED_DEPS})
if(LIBBPF_INCLUDE)
# we already have libbpf
if(TARGET lbpf)
# we already have libbpf
elseif(NOT USE_BUNDLED_LIBBPF)
find_path(LIBBPF_INCLUDE bpf/libbpf.h)
find_library(LIBBPF_LIB NAMES bpf)
if(LIBBPF_INCLUDE AND LIBBPF_LIB)
message(STATUS "Found libbpf: include: ${LIBBPF_INCLUDE}, lib: ${LIBBPF_LIB}")
else()
message(FATAL_ERROR "Couldn't find system libbpf")
endif()
include(zlib)
include(libelf)
find_path(LIBBPF_INCLUDE bpf/libbpf.h)
find_library(LIBBPF_LIB NAMES bpf)
if(LIBBPF_INCLUDE AND LIBBPF_LIB)
add_library(lbpf STATIC IMPORTED GLOBAL)
set_target_properties(lbpf PROPERTIES IMPORTED_LOCATION ${LIBBPF_LIB})
target_include_directories(lbpf INTERFACE $<BUILD_INTERFACE:${LIBBPF_INCLUDE}>)
target_link_libraries(lbpf INTERFACE elf ${ZLIB_LIB})
message(STATUS "Found libbpf: include: ${LIBBPF_INCLUDE}, lib: ${LIBBPF_LIB}")
else()
message(FATAL_ERROR "Couldn't find system libbpf")
endif()
else()
include(zlib)
include(libelf)
set(LIBBPF_SRC "${PROJECT_BINARY_DIR}/libbpf-prefix/src")
set(LIBBPF_BUILD_DIR "${LIBBPF_SRC}/libbpf-build")
set(LIBBPF_INCLUDE "${LIBBPF_BUILD_DIR}/root/usr/include")
set(LIBBPF_LIB "${LIBBPF_BUILD_DIR}/root/usr/lib64/libbpf.a")
ExternalProject_Add(
libbpf
PREFIX "${PROJECT_BINARY_DIR}/libbpf-prefix"
DEPENDS zlib libelf
URL "https://github.com/libbpf/libbpf/archive/refs/tags/v1.3.0.tar.gz"
URL_HASH
"SHA256=11db86acd627e468bc48b7258c1130aba41a12c4d364f78e184fd2f5a913d861"
CONFIGURE_COMMAND mkdir -p build root
BUILD_COMMAND make BUILD_STATIC_ONLY=y OBJDIR=${LIBBPF_BUILD_DIR}/build DESTDIR=${LIBBPF_BUILD_DIR}/root NO_PKG_CONFIG=1 "EXTRA_CFLAGS=-fPIC -I${LIBELF_INCLUDE} -I${ZLIB_INCLUDE}" "LDFLAGS=-Wl,-Bstatic" "EXTRA_LDFLAGS=-L${LIBELF_SRC}/libelf/libelf -L${ZLIB_SRC}" -C ${LIBBPF_SRC}/libbpf/src install install_uapi_headers
INSTALL_COMMAND ""
UPDATE_COMMAND ""
BUILD_BYPRODUCTS ${LIBBPF_LIB}
)
message(STATUS "Using bundled libbpf: include'${LIBBPF_INCLUDE}', lib: ${LIBBPF_LIB}")
install(FILES "${LIBBPF_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${LIBBPF_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
include(zlib)
include(libelf)
set(LIBBPF_SRC "${PROJECT_BINARY_DIR}/libbpf-prefix/src")
set(LIBBPF_BUILD_DIR "${LIBBPF_SRC}/libbpf-build")
set(LIBBPF_INCLUDE "${LIBBPF_BUILD_DIR}/root/usr/include")
set(LIBBPF_LIB "${LIBBPF_BUILD_DIR}/root/usr/lib64/libbpf.a")
if(NOT TARGET libbpf)
add_custom_target(libbpf)
endif()
get_target_property(LIBELF_INCLUDE_DIR elf INCLUDE_DIRECTORIES)
include_directories(${LIBBPF_INCLUDE})
foreach(dir ${LIBELF_INCLUDE_DIR})
string(APPEND LIBELF_COMPILER_STRING "-I${dir} ")
endforeach()
ExternalProject_Add(
libbpf
PREFIX "${PROJECT_BINARY_DIR}/libbpf-prefix"
DEPENDS zlib elf
URL "https://github.com/libbpf/libbpf/archive/refs/tags/v1.3.0.tar.gz"
URL_HASH "SHA256=11db86acd627e468bc48b7258c1130aba41a12c4d364f78e184fd2f5a913d861"
CONFIGURE_COMMAND mkdir -p build root
BUILD_COMMAND
make BUILD_STATIC_ONLY=y OBJDIR=${LIBBPF_BUILD_DIR}/build
DESTDIR=${LIBBPF_BUILD_DIR}/root NO_PKG_CONFIG=1
"EXTRA_CFLAGS=-fPIC ${LIBELF_COMPILER_STRING} -I${ZLIB_INCLUDE}" "LDFLAGS=-Wl,-Bstatic"
"EXTRA_LDFLAGS=-L${LIBELF_SRC}/libelf/libelf -L${ZLIB_SRC}" -C ${LIBBPF_SRC}/libbpf/src
install install_uapi_headers
INSTALL_COMMAND ""
UPDATE_COMMAND ""
BUILD_BYPRODUCTS ${LIBBPF_LIB}
)
add_library(lbpf STATIC IMPORTED GLOBAL)
set_target_properties(lbpf PROPERTIES IMPORTED_LOCATION ${LIBBPF_LIB})
file(MAKE_DIRECTORY ${LIBBPF_INCLUDE}) # necessary to make target_include_directories() work
target_include_directories(lbpf INTERFACE $<BUILD_INTERFACE:${LIBBPF_INCLUDE}>)
add_dependencies(lbpf libbpf)
target_link_libraries(lbpf INTERFACE elf ${ZLIB_LIB})
message(STATUS "Using bundled libbpf: include'${LIBBPF_INCLUDE}', lib: ${LIBBPF_LIB}")
install(
FILES "${LIBBPF_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()

View File

@ -2,71 +2,74 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
include_guard()
option(USE_BUNDLED_LIBELF "Enable building of the bundled libelf" ${USE_BUNDLED_DEPS})
option(USE_SHARED_LIBELF "When not using bundled libelf, link it dynamically" ON)
if(LIBELF_INCLUDE)
# we already have LIBELF
if(TARGET elf)
# we already have libelf
elseif(NOT USE_BUNDLED_LIBELF)
find_path(LIBELF_INCLUDE elf.h PATH_SUFFIXES elf)
if(BUILD_SHARED_LIBS OR USE_SHARED_LIBELF)
set(LIBELF_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(LIBELF_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
find_library(LIBELF_LIB NAMES libelf${LIBELF_LIB_SUFFIX})
if(LIBELF_LIB)
message(STATUS "Found LIBELF: include: ${LIBELF_INCLUDE}, lib: ${LIBELF_LIB}")
else()
message(FATAL_ERROR "Couldn't find system libelf")
endif()
# We add a custom target, in this way we can always depend on `libelf`
# without distinguishing between "bundled" and "not-bundled" case
add_custom_target(libelf)
find_path(LIBELF_INCLUDE elf.h PATH_SUFFIXES elf)
if(BUILD_SHARED_LIBS OR USE_SHARED_LIBELF)
set(LIBELF_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(LIBELF_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
# Zig workaround: since it won't look up in /usr/lib/..., add an HINT
if(CMAKE_C_COMPILER MATCHES "zig")
find_library(
LIBELF_LIB
NAMES libelf${LIBELF_LIB_SUFFIX}
HINTS /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/
)
else()
find_library(LIBELF_LIB NAMES libelf${LIBELF_LIB_SUFFIX})
endif()
if(LIBELF_LIB)
# Zig workaround: avoid include whole /usr/include because it would include also system
# glibc headers breaking the build since we are targeting the build against our boostrapped
# zig.
if(CMAKE_C_COMPILER MATCHES "zig")
message(STATUS "Enabling zig workaround for libelf")
configure_file(${LIBELF_INCLUDE}/libelf.h libelf/libelf.h COPYONLY)
configure_file(${LIBELF_INCLUDE}/elf.h libelf/elf.h COPYONLY)
configure_file(${LIBELF_INCLUDE}/gelf.h libelf/gelf.h COPYONLY)
set(LIBELF_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/libelf)
endif()
message(STATUS "Found LIBELF: include: ${LIBELF_INCLUDE}, lib: ${LIBELF_LIB}")
else()
message(FATAL_ERROR "Couldn't find system libelf")
endif()
if(BUILD_SHARED_LIBS OR USE_SHARED_LIBELF)
add_library(elf SHARED IMPORTED GLOBAL)
else()
add_library(elf STATIC IMPORTED GLOBAL)
endif()
set_target_properties(elf PROPERTIES IMPORTED_LOCATION ${LIBELF_LIB})
target_include_directories(elf INTERFACE ${LIBELF_INCLUDE})
else()
if(BUILD_SHARED_LIBS)
set(LIBELF_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(LIBELF_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
set(LIBELF_SRC "${PROJECT_BINARY_DIR}/libelf-prefix/src")
set(LIBELF_INCLUDE "${LIBELF_SRC}/libelf/libelf")
set(LIBELF_LIB "${LIBELF_SRC}/libelf/libelf/libelf${LIBELF_LIB_SUFFIX}")
ExternalProject_Add(
libelf
PREFIX "${PROJECT_BINARY_DIR}/libelf-prefix"
DEPENDS zlib
URL "https://sourceware.org/elfutils/ftp/0.189/elfutils-0.189.tar.bz2"
URL_HASH "SHA256=39bd8f1a338e2b7cd4abc3ff11a0eddc6e690f69578a57478d8179b4148708c8"
CONFIGURE_COMMAND ./configure LDFLAGS=-L${ZLIB_SRC} "CFLAGS=-I${ZLIB_INCLUDE}" --enable-deterministic-archives --disable-debuginfod --disable-libdebuginfod --without-zstd
BUILD_IN_SOURCE 1
BUILD_COMMAND make -C lib libeu.a
COMMAND make -C libelf libelf${LIBELF_LIB_SUFFIX}
INSTALL_COMMAND ""
UPDATE_COMMAND ""
BUILD_BYPRODUCTS ${LIBELF_LIB}
)
message(STATUS "Using bundled libelf: include'${LIBELF_INCLUDE}', lib: ${LIBELF_LIB}")
install(FILES "${LIBELF_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${LIBELF_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
include(FetchContent)
FetchContent_Declare(
libelf_elftoolchain
URL https://github.com/falcosecurity/elftoolchain/releases/download/libelf-r4073-0/libelf-r4073-0.tar.gz
URL_HASH SHA256=adfeb3033c23ca579902f2bce7d9ffeec662f97d3846bb74e57fb65d70f6f056
)
FetchContent_MakeAvailable(libelf_elftoolchain)
get_target_property(LIBELF_INCLUDE elf INCLUDE_DIRECTORIES)
# We add a custom target, in this way we can always depend on `libelf`
# without distinguishing between "bundled" and "not-bundled" case
if(NOT TARGET libelf)
add_custom_target(libelf)
message(STATUS "Using bundled libelf: include'${LIBELF_INCLUDE}'")
endif()
include_directories(${LIBELF_INCLUDE})

View File

@ -2,141 +2,140 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
if(NOT HAVE_LIBSCAP)
set(HAVE_LIBSCAP On)
set(HAVE_LIBSCAP On)
if(NOT LIBS_DIR)
get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
endif()
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
include(GNUInstallDirs)
include(ExternalProject)
include(uthash)
include(CheckSymbolExists)
check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
check_symbol_exists(strlcat "string.h" HAVE_STRLCAT)
if(HAVE_STRLCPY)
message(STATUS "Existing strlcpy found, will *not* use local definition")
else()
message(STATUS "No strlcpy found, will use local definition")
endif()
if(HAVE_STRLCAT)
message(STATUS "Existing strlcat found, will *not* use local definition")
else()
message(STATUS "No strlcat found, will use local definition")
endif()
add_definitions(-DPLATFORM_NAME="${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
get_filename_component(DRIVER_CONFIG_DIR ${CMAKE_BINARY_DIR}/driver/src ABSOLUTE)
else()
# This doesn't install all of the driver headers but seems to be sufficient for
# non-Linux platforms.
get_filename_component(DRIVER_CONFIG_DIR ${PROJECT_SOURCE_DIR}/driver ABSOLUTE)
endif()
get_filename_component(LIBSCAP_INCLUDE_DIR ${LIBS_DIR}/userspace/libscap ABSOLUTE)
set(LIBSCAP_INCLUDE_DIRS ${LIBSCAP_INCLUDE_DIR} ${PROJECT_BINARY_DIR} ${DRIVER_CONFIG_DIR})
function(set_scap_target_properties target)
set_target_properties(${target} PROPERTIES
VERSION ${FALCOSECURITY_SHARED_LIBS_VERSION}
SOVERSION ${FALCOSECURITY_SHARED_LIBS_SOVERSION}
)
endfunction()
add_subdirectory(${LIBS_DIR}/userspace/libscap ${PROJECT_BINARY_DIR}/libscap)
set(LIBSCAP_INSTALL_LIBS)
# All of the targets in userspace/libscap
get_directory_property(libscap_subdirs DIRECTORY ${LIBS_DIR}/userspace/libscap SUBDIRECTORIES)
set(libscap_subdir_targets)
foreach(libscap_subdir ${LIBS_DIR}/userspace/libscap ${libscap_subdirs})
get_directory_property(subdir_targets DIRECTORY ${libscap_subdir} BUILDSYSTEM_TARGETS)
list(APPEND libscap_subdir_targets ${subdir_targets})
endforeach()
set(install_lib_type STATIC_LIBRARY)
if (BUILD_SHARED_LIBS)
set(install_lib_type SHARED_LIBRARY)
endif()
# Installation targets only
foreach(libscap_subdir_target ${libscap_subdir_targets})
get_target_property(cl_target_type ${libscap_subdir_target} TYPE)
if (${cl_target_type} STREQUAL ${install_lib_type})
list(APPEND LIBSCAP_INSTALL_LIBS ${libscap_subdir_target})
if(NOT LIBS_DIR)
get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
endif()
endforeach()
# Installation targets and their dependencies
set(libscap_link_libraries)
set(libscap_link_libdirs)
foreach(libscap_install_lib ${LIBSCAP_INSTALL_LIBS})
list(APPEND libscap_link_libraries ${libscap_install_lib})
get_target_property(install_lib_link_libraries ${libscap_install_lib} LINK_LIBRARIES)
foreach (install_lib_link_library ${install_lib_link_libraries})
if (NOT ${install_lib_link_library} IN_LIST libscap_subdir_targets)
if(${install_lib_link_library} MATCHES "/")
# We have a path. Convert it to -L<dir> + -l<lib>.
get_filename_component(scap_lib_dir ${install_lib_link_library} DIRECTORY)
list(APPEND libscap_link_libdirs -L${scap_lib_dir})
get_filename_component(scap_lib_base ${install_lib_link_library} NAME_WE)
string(REGEX REPLACE "^lib" "" scap_lib_base ${scap_lib_base})
list(APPEND libscap_link_libraries ${scap_lib_base})
else()
list(APPEND libscap_link_libraries ${install_lib_link_library})
endif()
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
include(GNUInstallDirs)
include(ExternalProject)
include(uthash)
include(CheckSymbolExists)
check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
check_symbol_exists(strlcat "string.h" HAVE_STRLCAT)
include(BuildPkgConfigDependencies)
if(HAVE_STRLCPY)
message(STATUS "Existing strlcpy found, will *not* use local definition")
else()
message(STATUS "No strlcpy found, will use local definition")
endif()
if(HAVE_STRLCAT)
message(STATUS "Existing strlcat found, will *not* use local definition")
else()
message(STATUS "No strlcat found, will use local definition")
endif()
add_definitions(-DPLATFORM_NAME="${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
get_filename_component(DRIVER_CONFIG_DIR ${CMAKE_BINARY_DIR}/driver/src ABSOLUTE)
else()
# This doesn't install all of the driver headers but seems to be sufficient for non-Linux
# platforms.
get_filename_component(DRIVER_CONFIG_DIR ${PROJECT_SOURCE_DIR}/driver ABSOLUTE)
endif()
get_filename_component(LIBSCAP_INCLUDE_DIR ${LIBS_DIR}/userspace/libscap ABSOLUTE)
set(LIBSCAP_INCLUDE_DIRS ${LIBSCAP_INCLUDE_DIR} ${PROJECT_BINARY_DIR} ${DRIVER_CONFIG_DIR})
function(set_scap_target_properties target)
set_target_properties(
${target} PROPERTIES VERSION ${FALCOSECURITY_SHARED_LIBS_VERSION}
SOVERSION ${FALCOSECURITY_SHARED_LIBS_SOVERSION}
)
endfunction()
add_subdirectory(${LIBS_DIR}/userspace/libscap ${PROJECT_BINARY_DIR}/libscap)
set(LIBSCAP_INSTALL_LIBS)
# All of the targets in userspace/libscap
get_directory_property(libscap_subdirs DIRECTORY ${LIBS_DIR}/userspace/libscap SUBDIRECTORIES)
set(libscap_subdir_targets)
foreach(libscap_subdir ${LIBS_DIR}/userspace/libscap ${libscap_subdirs})
get_directory_property(subdir_targets DIRECTORY ${libscap_subdir} BUILDSYSTEM_TARGETS)
list(APPEND libscap_subdir_targets ${subdir_targets})
endforeach()
set(install_lib_type STATIC_LIBRARY)
if(BUILD_SHARED_LIBS)
set(install_lib_type SHARED_LIBRARY)
endif()
# Installation targets only
foreach(libscap_subdir_target ${libscap_subdir_targets})
get_target_property(cl_target_type ${libscap_subdir_target} TYPE)
if(${cl_target_type} STREQUAL ${install_lib_type})
list(APPEND LIBSCAP_INSTALL_LIBS ${libscap_subdir_target})
endif()
endforeach()
endforeach()
list(REMOVE_DUPLICATES libscap_link_libraries)
set(libscap_link_flags)
foreach(libscap_link_library ${libscap_link_libraries})
list(APPEND libscap_link_flags "-l${libscap_link_library}")
endforeach()
string(REPLACE ";" " " LIBSCAP_LINK_LIBRARIES_FLAGS "${libscap_link_flags}")
string(REPLACE ";" " " LIBSCAP_LINK_LIBDIRS_FLAGS "${libscap_link_libdirs}")
configure_file(${LIBS_DIR}/userspace/libscap/libscap.pc.in ${PROJECT_BINARY_DIR}/libscap/libscap.pc @ONLY)
install(TARGETS ${LIBSCAP_INSTALL_LIBS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "scap" OPTIONAL)
install(DIRECTORY "${LIBSCAP_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "scap"
FILES_MATCHING PATTERN "*.h"
PATTERN "*examples*" EXCLUDE
PATTERN "*doxygen*" EXCLUDE)
install(DIRECTORY "${DRIVER_CONFIG_DIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/driver"
COMPONENT "scap"
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "${LIBS_DIR}/userspace/plugin" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
install(
TARGETS ${LIBSCAP_INSTALL_LIBS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "scap"
OPTIONAL
)
install(
DIRECTORY "${LIBSCAP_INCLUDE_DIR}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "scap"
FILES_MATCHING PATTERN "*.h")
install(FILES ${PROJECT_BINARY_DIR}/libscap/scap_config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/libscap)
install(FILES ${PROJECT_BINARY_DIR}/libscap/scap_strl_config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/libscap)
install(FILES ${PROJECT_BINARY_DIR}/libscap/libscap.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
FILES_MATCHING
PATTERN "*.h"
PATTERN "*examples*" EXCLUDE
PATTERN "*doxygen*" EXCLUDE
)
install(
DIRECTORY "${DRIVER_CONFIG_DIR}/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/driver"
COMPONENT "scap"
FILES_MATCHING
PATTERN "*.h"
)
install(
DIRECTORY "${LIBS_DIR}/userspace/plugin"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "scap"
FILES_MATCHING
PATTERN "*.h"
)
if(USE_BUNDLED_UTHASH)
install(FILES ${UTHASH_INCLUDE}/uthash.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/libscap
)
endif()
install(FILES ${PROJECT_BINARY_DIR}/libscap/scap_config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/libscap
)
install(FILES ${PROJECT_BINARY_DIR}/libscap/scap_strl_config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/libscap
)
install(FILES ${PROJECT_BINARY_DIR}/libscap/libscap.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif()

View File

@ -2,92 +2,89 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
if(NOT HAVE_LIBSINSP)
set(HAVE_LIBSINSP On)
set(HAVE_LIBSINSP On)
if(NOT LIBS_DIR)
get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
endif()
if(NOT LIBS_DIR)
get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
endif()
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
option(ENABLE_THREAD_POOL "Enable inspector thread pool" OFF)
if(DEFINED LIBSINSP_USER_AGENT)
add_definitions(-DLIBSINSP_USER_AGENT="${LIBSINSP_USER_AGENT}")
endif()
if(DEFINED LIBSINSP_USER_AGENT)
add_definitions(-DLIBSINSP_USER_AGENT="${LIBSINSP_USER_AGENT}")
endif()
include(ExternalProject)
include(libscap)
if (NOT EMSCRIPTEN)
include(tbb)
endif()
if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD AND NOT EMSCRIPTEN)
include(cares)
include(curl)
endif()
include(jsoncpp)
include(valijson)
include(re2)
include(ExternalProject)
include(libscap)
if(NOT EMSCRIPTEN)
include(tbb)
endif()
include(jsoncpp)
include(valijson)
include(re2)
set(LIBSINSP_INCLUDE_DIRS ${LIBS_DIR} ${LIBS_DIR}/userspace ${LIBSCAP_INCLUDE_DIRS} ${DRIVER_CONFIG_DIR})
if(ENABLE_THREAD_POOL AND NOT EMSCRIPTEN)
include(bs_threadpool)
endif()
if (NOT EMSCRIPTEN)
get_filename_component(TBB_ABSOLUTE_INCLUDE_DIR ${TBB_INCLUDE_DIR} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${TBB_ABSOLUTE_INCLUDE_DIR})
endif()
set(LIBSINSP_INCLUDE_DIRS)
get_filename_component(JSONCPP_ABSOLUTE_INCLUDE_DIR ${JSONCPP_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JSONCPP_ABSOLUTE_INCLUDE_DIR})
if(NOT USE_BUNDLED_TBB AND NOT EMSCRIPTEN)
list(APPEND LIBSINSP_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
endif()
get_filename_component(VALIJSON_ABSOLUTE_INCLUDE_DIR ${VALIJSON_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${VALIJSON_ABSOLUTE_INCLUDE_DIR})
if(NOT USE_BUNDLED_JSONCPP)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JSONCPP_INCLUDE})
endif()
get_filename_component(RE2_ABSOLUTE_INCLUDE_DIR ${RE2_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${RE2_ABSOLUTE_INCLUDE_DIR})
function(set_sinsp_target_properties target)
set_target_properties(
${target} PROPERTIES VERSION ${FALCOSECURITY_SHARED_LIBS_VERSION}
SOVERSION ${FALCOSECURITY_SHARED_LIBS_SOVERSION}
)
endfunction()
if(NOT MINIMAL_BUILD AND NOT EMSCRIPTEN AND NOT APPLE)
get_filename_component(CARES_ABSOLUTE_INCLUDE_DIR ${CARES_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${CARES_ABSOLUTE_INCLUDE_DIR})
endif()
if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD AND NOT EMSCRIPTEN)
get_filename_component(CURL_ABSOLUTE_INCLUDE_DIR ${CURL_INCLUDE_DIRS} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${CURL_ABSOLUTE_INCLUDE_DIR})
endif()
function(set_sinsp_target_properties target)
set_target_properties(${target} PROPERTIES
VERSION ${FALCOSECURITY_SHARED_LIBS_VERSION}
SOVERSION ${FALCOSECURITY_SHARED_LIBS_SOVERSION}
add_subdirectory(${LIBS_DIR}/userspace/libsinsp ${CMAKE_BINARY_DIR}/libsinsp)
install(
TARGETS sinsp
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT "sinsp"
)
install(
DIRECTORY "${LIBS_DIR}/userspace/libsinsp"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "sinsp"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*third_party*" EXCLUDE
PATTERN "*examples*" EXCLUDE
PATTERN "*doxygen*" EXCLUDE
PATTERN "*scripts*" EXCLUDE
PATTERN "*test*" EXCLUDE
)
install(
DIRECTORY "${LIBS_DIR}/userspace/async"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "sinsp"
FILES_MATCHING
PATTERN "*.h"
)
install(FILES ${PROJECT_BINARY_DIR}/libsinsp/libsinsp.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endfunction()
add_subdirectory(${LIBS_DIR}/userspace/libsinsp ${CMAKE_BINARY_DIR}/libsinsp)
install(TARGETS sinsp
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "sinsp")
install(DIRECTORY "${LIBS_DIR}/userspace/libsinsp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h"
PATTERN "*third_party*" EXCLUDE
PATTERN "*examples*" EXCLUDE
PATTERN "*doxygen*" EXCLUDE
PATTERN "*scripts*" EXCLUDE
PATTERN "*test*" EXCLUDE)
install(DIRECTORY "${LIBS_DIR}/userspace/async" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h")
install(FILES ${PROJECT_BINARY_DIR}/libsinsp/libsinsp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()

View File

@ -1,62 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
option(USE_BUNDLED_OPENSSL "Enable building of the bundled OpenSSL" ${USE_BUNDLED_DEPS})
if(OPENSSL_INCLUDE_DIR)
# we already have openssl
elseif(NOT USE_BUNDLED_OPENSSL)
find_package(OpenSSL REQUIRED)
message(STATUS "Found OpenSSL: include: ${OPENSSL_INCLUDE_DIR}, lib: ${OPENSSL_LIBRARIES}")
else()
if(BUILD_SHARED_LIBS)
set(OPENSSL_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(OPENSSL_SHARED_OPTION shared)
else()
set(OPENSSL_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(OPENSSL_SHARED_OPTION no-shared)
endif()
set(OPENSSL_BUNDLE_DIR "${PROJECT_BINARY_DIR}/openssl-prefix/src/openssl")
set(OPENSSL_INSTALL_DIR "${OPENSSL_BUNDLE_DIR}/target")
set(OPENSSL_INCLUDE_DIR "${PROJECT_BINARY_DIR}/openssl-prefix/src/openssl/include/")
set(OPENSSL_LIBRARY_SSL "${OPENSSL_INSTALL_DIR}/lib/libssl${OPENSSL_LIB_SUFFIX}")
set(OPENSSL_LIBRARY_CRYPTO "${OPENSSL_INSTALL_DIR}/lib/libcrypto${OPENSSL_LIB_SUFFIX}")
set(OPENSSL_LIBRARIES ${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO})
if(NOT TARGET openssl)
message(STATUS "Using bundled openssl in '${OPENSSL_BUNDLE_DIR}'")
ExternalProject_Add(openssl
PREFIX "${PROJECT_BINARY_DIR}/openssl-prefix"
URL "https://github.com/openssl/openssl/releases/download/openssl-3.1.4/openssl-3.1.4.tar.gz"
URL_HASH "SHA256=840af5366ab9b522bde525826be3ef0fb0af81c6a9ebd84caa600fea1731eee3"
CONFIGURE_COMMAND ./config ${OPENSSL_SHARED_OPTION} --prefix=${OPENSSL_INSTALL_DIR} --libdir=lib
BUILD_COMMAND make
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO}
INSTALL_COMMAND make install_sw)
install(FILES "${OPENSSL_LIBRARY_SSL}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES "${OPENSSL_LIBRARY_CRYPTO}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${OPENSSL_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
endif()
if(NOT TARGET openssl)
add_custom_target(openssl)
endif()
include_directories("${OPENSSL_INCLUDE_DIR}")

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_PROTOBUF "Enable building of the bundled protobuf" ${USE_BUNDLED_DEPS})
@ -20,8 +21,14 @@ elseif(NOT USE_BUNDLED_PROTOBUF)
find_program(PROTOC NAMES protoc)
find_path(PROTOBUF_INCLUDE NAMES google/protobuf/message.h)
find_library(PROTOBUF_LIB NAMES protobuf)
if(PROTOC AND PROTOBUF_INCLUDE AND PROTOBUF_LIB)
message(STATUS "Found protobuf: compiler: ${PROTOC}, include: ${PROTOBUF_INCLUDE}, lib: ${PROTOBUF_LIB}")
if(PROTOC
AND PROTOBUF_INCLUDE
AND PROTOBUF_LIB
)
message(
STATUS
"Found protobuf: compiler: ${PROTOC}, include: ${PROTOBUF_INCLUDE}, lib: ${PROTOBUF_LIB}"
)
else()
message(FATAL_ERROR "Couldn't find system protobuf")
endif()
@ -38,29 +45,57 @@ else()
set(PROTOBUF_SRC "${PROJECT_BINARY_DIR}/protobuf-prefix/src/protobuf")
set(PROTOC "${PROTOBUF_SRC}/target/bin/protoc")
set(PROTOBUF_INCLUDE "${PROTOBUF_SRC}/target/include/")
set(PROTOBUF_LIB "${PROTOBUF_SRC}/target/lib/libprotobuf${PROTOBUF_LIB_SUFFIX}" CACHE PATH "Path to libprotobuf")
set(PROTOBUF_LIB
"${PROTOBUF_SRC}/target/lib/libprotobuf${PROTOBUF_LIB_SUFFIX}"
CACHE PATH "Path to libprotobuf"
)
set(PROTOC_LIB "${PROTOBUF_SRC}/target/lib/libprotoc${PROTOBUF_LIB_SUFFIX}")
set(PROTOBUF_INSTALL_DIR "${PROTOBUF_SRC}/target")
if(NOT TARGET protobuf)
if(NOT ENABLE_PIC)
set(PROTOBUF_PIC_OPTION)
else()
set(PROTOBUF_PIC_OPTION "--with-pic=yes")
endif()
# Match both release and relwithdebinfo builds
if(CMAKE_BUILD_TYPE MATCHES "[R,r]el*")
set(PROTOBUF_CXXFLAGS "-O3 -std=c++11 -DNDEBUG")
else()
set(PROTOBUF_CXXFLAGS "-g -std=c++11")
endif()
message(STATUS "Using bundled protobuf in '${PROTOBUF_SRC}'")
ExternalProject_Add(protobuf
ExternalProject_Add(
protobuf
PREFIX "${PROJECT_BINARY_DIR}/protobuf-prefix"
DEPENDS zlib
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.tar.gz"
URL_HASH "SHA256=e51cc8fc496f893e2a48beb417730ab6cbcb251142ad8b2cd1951faa5c76fe3d"
# TODO what if using system zlib?
CONFIGURE_COMMAND CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure --with-zlib ${PROTOBUF_CONFIGURE_FLAGS} --prefix=${PROTOBUF_INSTALL_DIR}
CONFIGURE_COMMAND
./configure CXXFLAGS=${PROTOBUF_CXXFLAGS} --with-zlib-include=${ZLIB_INCLUDE}
--with-zlib-lib=${ZLIB_SRC} --with-zlib ${PROTOBUF_CONFIGURE_FLAGS}
${PROTOBUF_PIC_OPTION} --prefix=${PROTOBUF_INSTALL_DIR}
BUILD_COMMAND make
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${PROTOC} ${PROTOBUF_INCLUDE} ${PROTOBUF_LIB}
INSTALL_COMMAND make install)
install(FILES "${PROTOBUF_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES "${PROTOC_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${PROTOBUF_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
INSTALL_COMMAND make install
)
install(
FILES "${PROTOBUF_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
install(
FILES "${PROTOC_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
install(
DIRECTORY "${PROTOBUF_INCLUDE}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()
endif()

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_RE2 "Enable building of the bundled RE2" ${USE_BUNDLED_DEPS})
@ -42,76 +43,94 @@ else()
set(RE2_LIB "${RE2_SRC}/lib/libre2${RE2_LIB_SUFFIX}")
set(RE2_LIB_PATTERN "libre2*")
if(CMAKE_VERSION VERSION_LESS 3.29.1)
ExternalProject_Add(re2
ExternalProject_Add(
re2
PREFIX "${PROJECT_BINARY_DIR}/re2-prefix"
URL "${RE2_URL}"
URL_HASH "${RE2_URL_HASH}"
BINARY_DIR "${PROJECT_BINARY_DIR}/re2-prefix/build"
BUILD_BYPRODUCTS ${RE2_LIB}
CMAKE_ARGS
-DCMAKE_INSTALL_LIBDIR=lib
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC})
CMAKE_ARGS -DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
else()
# CMake 3.29.1 removed the support for the `PACKAGE_PREFIX_DIR`
# variable. The patch command just applies the same patch applied
# by re2 to solve the issue:
# CMake 3.29.1 removed the support for the `PACKAGE_PREFIX_DIR` variable. The patch
# command just applies the same patch applied by re2 to solve the issue:
# https://github.com/google/re2/commit/9ebe4a22cad8a025b68a9594bdff3c047a111333
ExternalProject_Add(re2
ExternalProject_Add(
re2
PREFIX "${PROJECT_BINARY_DIR}/re2-prefix"
URL "${RE2_URL}"
URL_HASH "${RE2_URL_HASH}"
BINARY_DIR "${PROJECT_BINARY_DIR}/re2-prefix/build"
BUILD_BYPRODUCTS ${RE2_LIB}
PATCH_COMMAND
COMMAND sed -i".bak" "/set_and_check/d" re2Config.cmake.in
CMAKE_ARGS
-DCMAKE_INSTALL_LIBDIR=lib
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC})
COMMAND sed -i".bak" "/set_and_check/d" re2Config.cmake.in
CMAKE_ARGS -DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
endif()
else()
set(RE2_LIB "${RE2_SRC}/lib/re2.lib")
set(RE2_LIB_PATTERN "re2.lib")
# see: https://cmake.org/cmake/help/latest/policy/CMP0091.html
if(CMAKE_VERSION VERSION_LESS 3.15.0)
ExternalProject_Add(re2
ExternalProject_Add(
re2
PREFIX "${PROJECT_BINARY_DIR}/re2-prefix"
URL "${RE2_URL}"
URL_HASH "${RE2_URL_HASH}"
BINARY_DIR "${PROJECT_BINARY_DIR}/re2-prefix/build"
BUILD_BYPRODUCTS ${RE2_LIB}
CMAKE_ARGS
-DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DCMAKE_INSTALL_LIBDIR=lib
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC})
CMAKE_ARGS -DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
else()
ExternalProject_Add(re2
ExternalProject_Add(
re2
PREFIX "${PROJECT_BINARY_DIR}/re2-prefix"
URL "${RE2_URL}"
URL_HASH "${RE2_URL_HASH}"
BINARY_DIR "${PROJECT_BINARY_DIR}/re2-prefix/build"
BUILD_BYPRODUCTS ${RE2_LIB}
CMAKE_ARGS
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_INSTALL_LIBDIR=lib
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC})
CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
endif()
endif()
install(DIRECTORY ${RE2_SRC}/lib/ DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING PATTERN ${RE2_LIB_PATTERN})
install(DIRECTORY "${RE2_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(
DIRECTORY ${RE2_SRC}/lib/
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING
PATTERN ${RE2_LIB_PATTERN}
)
install(
DIRECTORY "${RE2_INCLUDE}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()
if(NOT TARGET re2)

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_TBB "Enable building of the bundled tbb" ${USE_BUNDLED_DEPS})
@ -52,76 +53,106 @@ else()
else()
set(TBB_LIB_BASENAME "tbb12")
endif()
endif()
endif()
set(TBB_LIB "${TBB_LIB_BASEDIR}/${TBB_LIB_PREFIX}${TBB_LIB_BASENAME}${TBB_LIB_SUFFIX}")
if(NOT TARGET tbb)
message(STATUS "Using bundled tbb in '${TBB_SRC}'")
set(TBB_SRC_URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.9.0.tar.gz")
set(TBB_SRC_URL_HASH "SHA256=1ce48f34dada7837f510735ff1172f6e2c261b09460e3bf773b49791d247d24e")
set(TBB_SRC_URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2022.1.0.tar.gz")
set(TBB_SRC_URL_HASH
"SHA256=ed067603ece0dc832d2881ba5c516625ac2522c665d95f767ef6304e34f961b5"
)
set(TBB_FLAGS "")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# latest TBB has issues with GCC >= 12
# see: https://github.com/oneapi-src/oneTBB/issues/843#issuecomment-1152646035
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# latest TBB has issues with GCC >= 12 see:
# https://github.com/oneapi-src/oneTBB/issues/843#issuecomment-1152646035
set(TBB_FLAGS "-Wno-error=stringop-overflow")
endif()
if(EMSCRIPTEN)
set(TBB_FLAGS "${TBB_FLAGS} -Wno-unused-command-line-argument")
set(TBB_EMSCRIPTEN "ON")
endif()
if(NOT WIN32)
ExternalProject_Add(tbb
if(NOT WIN32)
ExternalProject_Add(
tbb
PREFIX "${PROJECT_BINARY_DIR}/tbb-prefix"
URL "${TBB_SRC_URL}"
URL_HASH "${TBB_SRC_URL_HASH}"
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target tbb
CMAKE_ARGS
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS="${TBB_FLAGS}"
CMAKE_ARGS -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS=${TBB_FLAGS}
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DEMSCRIPTEN=${TBB_EMSCRIPTEN}
-DTBB_FILE_TRIM=Off
-DTBB_INSTALL=Off
BUILD_BYPRODUCTS ${TBB_LIB}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
else()
# see: https://cmake.org/cmake/help/latest/policy/CMP0091.html
if(CMAKE_VERSION VERSION_LESS 3.15.0)
ExternalProject_Add(tbb
ExternalProject_Add(
tbb
PREFIX "${PROJECT_BINARY_DIR}/tbb-prefix"
URL "${TBB_SRC_URL}"
URL_HASH "${TBB_SRC_URL_HASH}"
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target tbb --config ${CMAKE_BUILD_TYPE}
CMAKE_ARGS
-DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS="${TBB_FLAGS}"
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target tbb --config
${CMAKE_BUILD_TYPE}
CMAKE_ARGS -DCMAKE_CXX_FLAGS_DEBUG=${FALCOSECURITY_LIBS_DEBUG_FLAGS}
-DCMAKE_CXX_FLAGS_RELEASE=${FALCOSECURITY_LIBS_RELEASE_FLAGS}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS="${TBB_FLAGS}"
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DTBB_FILE_TRIM=Off
-DTBB_INSTALL=Off
BUILD_BYPRODUCTS ${TBB_LIB}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
else()
ExternalProject_Add(tbb
ExternalProject_Add(
tbb
PREFIX "${PROJECT_BINARY_DIR}/tbb-prefix"
URL "${TBB_SRC_URL}"
URL_HASH "${TBB_SRC_URL_HASH}"
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target tbb --config ${CMAKE_BUILD_TYPE}
CMAKE_ARGS
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS="${TBB_FLAGS}"
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target tbb --config
${CMAKE_BUILD_TYPE}
CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DTBB_OUTPUT_DIR_BASE=lib
-DCMAKE_CXX_FLAGS="${TBB_FLAGS}"
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DTBB_FILE_TRIM=Off
-DTBB_INSTALL=Off
BUILD_BYPRODUCTS ${TBB_LIB}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
endif()
endif()
install(DIRECTORY "${TBB_LIB_BASEDIR}/" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING PATTERN "${TBB_LIB_PREFIX}tbb*")
install(DIRECTORY "${TBB_INCLUDE_DIR}/tbb" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(
DIRECTORY "${TBB_LIB_BASEDIR}/"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING
PATTERN "${TBB_LIB_PREFIX}tbb*"
)
install(
DIRECTORY "${TBB_INCLUDE_DIR}/tbb"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
endif()
endif()

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_UTHASH "Enable downloading of the bundled uthash library" ${USE_BUNDLED_DEPS})
@ -31,13 +32,15 @@ else()
message(STATUS "Using bundled uthash in '${UTHASH_SRC}'")
ExternalProject_Add(uthash
PREFIX "${PROJECT_BINARY_DIR}/uthash-prefix"
URL "https://github.com/troydhanson/uthash/archive/refs/tags/v1.9.8.tar.gz"
URL_HASH "SHA256=d9d123ce81c5d127442876fc3b12fab3ad632bee6aca685be7d461c08e24c046"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
ExternalProject_Add(
uthash
PREFIX "${PROJECT_BINARY_DIR}/uthash-prefix"
URL "https://github.com/troydhanson/uthash/archive/refs/tags/v1.9.8.tar.gz"
URL_HASH "SHA256=d9d123ce81c5d127442876fc3b12fab3ad632bee6aca685be7d461c08e24c046"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()
if(NOT TARGET uthash)

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
#
@ -28,13 +29,15 @@ else()
message(STATUS "Using bundled valijson in '${VALIJSON_SRC}'")
ExternalProject_Add(valijson
ExternalProject_Add(
valijson
PREFIX "${PROJECT_BINARY_DIR}/valijson-prefix"
URL "https://github.com/tristanpenman/valijson/archive/refs/tags/v1.0.2.tar.gz"
URL_HASH "SHA256=35d86e54fc727f1265226434dc996e33000a570f833537a25c8b702b0b824431"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
endif()
if(NOT TARGET valijson)

View File

@ -2,51 +2,57 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
include(GetVersionFromGit)
function(get_libs_version _var)
# `+driver` is given to ignore drivers tags when fetching the version of libs
get_version_from_git(ver "" "+driver")
# `+driver` is given to ignore drivers tags when fetching the version of libs
get_version_from_git(ver "" "+driver")
set(${_var}
"${ver}"
PARENT_SCOPE)
return()
set(${_var}
"${ver}"
PARENT_SCOPE
)
return()
endfunction()
function(get_drivers_version _var)
# `+driver` is given to only fetch drivers tags, thus excluding libs ones
get_version_from_git(ver "+driver" "")
# `+driver` is given to only fetch drivers tags, thus excluding libs ones
get_version_from_git(ver "+driver" "")
set(${_var}
"${ver}"
PARENT_SCOPE)
return()
set(${_var}
"${ver}"
PARENT_SCOPE
)
return()
endfunction()
function(get_shared_libs_versions _var _sovar)
string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" sl_ver ${FALCOSECURITY_LIBS_VERSION})
string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" sl_ver ${FALCOSECURITY_LIBS_VERSION})
if(NOT sl_ver)
set(sl_ver "0.0.0")
endif()
if(NOT sl_ver)
set(sl_ver "0.0.0")
endif()
set(${_var} ${sl_ver} PARENT_SCOPE)
string(REPLACE "." ";" sl_ver_list ${sl_ver})
list(GET sl_ver_list 0 so_ver)
set(${_sovar} ${so_ver} PARENT_SCOPE)
return()
set(${_var}
${sl_ver}
PARENT_SCOPE
)
string(REPLACE "." ";" sl_ver_list ${sl_ver})
list(GET sl_ver_list 0 so_ver)
set(${_sovar}
${so_ver}
PARENT_SCOPE
)
return()
endfunction()

View File

@ -2,14 +2,15 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_ZLIB "Enable building of the bundled zlib" ${USE_BUNDLED_DEPS})
@ -28,7 +29,9 @@ else()
set(ZLIB_SRC "${PROJECT_BINARY_DIR}/zlib-prefix/src/zlib")
set(ZLIB_INCLUDE "${ZLIB_SRC}")
set(ZLIB_HEADERS "")
list(APPEND ZLIB_HEADERS
list(
APPEND
ZLIB_HEADERS
"${ZLIB_INCLUDE}/crc32.h"
"${ZLIB_INCLUDE}/deflate.h"
"${ZLIB_INCLUDE}/gzguts.h"
@ -42,49 +45,80 @@ else()
"${ZLIB_INCLUDE}/zutil.h"
)
if(NOT TARGET zlib)
# Match both release and relwithdebinfo builds
if(CMAKE_BUILD_TYPE MATCHES "[R,r]el*")
set(ZLIB_CFLAGS "-O3")
else()
set(ZLIB_CFLAGS "-g")
endif()
if(ENABLE_PIC)
set(ZLIB_CFLAGS "${ZLIB_CFLAGS} -fPIC")
endif()
message(STATUS "Using bundled zlib in '${ZLIB_SRC}'")
if(NOT WIN32)
if(BUILD_SHARED_LIBS)
set(ZLIB_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(ZLIB_CONFIGURE_FLAGS )
set(ZLIB_CONFIGURE_FLAGS)
else()
set(ZLIB_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ZLIB_CONFIGURE_FLAGS "--static")
endif()
set(ZLIB_LIB "${ZLIB_SRC}/libz${ZLIB_LIB_SUFFIX}")
ExternalProject_Add(zlib
ExternalProject_Add(
zlib
PREFIX "${PROJECT_BINARY_DIR}/zlib-prefix"
URL "https://github.com/madler/zlib/archive/v1.2.13.tar.gz"
URL_HASH "SHA256=1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428"
CONFIGURE_COMMAND ./configure --prefix=${ZLIB_SRC} ${ZLIB_CONFIGURE_FLAGS}
URL "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz"
URL_HASH "SHA256=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
CONFIGURE_COMMAND CFLAGS=${ZLIB_CFLAGS} ./configure --prefix=${ZLIB_SRC}
${ZLIB_CONFIGURE_FLAGS}
BUILD_COMMAND make
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${ZLIB_LIB}
INSTALL_COMMAND "")
install(FILES "${ZLIB_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES ${ZLIB_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/zlib"
COMPONENT "libs-deps")
INSTALL_COMMAND ""
)
install(
FILES "${ZLIB_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
install(
FILES ${ZLIB_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/zlib"
COMPONENT "libs-deps"
)
else()
if(BUILD_SHARED_LIBS)
set(ZLIB_LIB_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(ZLIB_LIB "${ZLIB_SRC}/lib/zlib$<$<CONFIG:Debug>:d>${ZLIB_LIB_SUFFIX}")
else()
set(ZLIB_LIB_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(ZLIB_LIB "${ZLIB_SRC}/lib/zlibstatic$<$<CONFIG:Debug>:d>${ZLIB_LIB_SUFFIX}")
endif()
set(ZLIB_LIB "${ZLIB_SRC}/zlib${ZLIB_LIB_SUFFIX}")
ExternalProject_Add(zlib
ExternalProject_Add(
zlib
PREFIX "${PROJECT_BINARY_DIR}/zlib-prefix"
URL "https://github.com/madler/zlib/archive/v1.2.13.tar.gz"
URL_HASH "SHA256=1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428"
CONFIGURE_COMMAND ""
BUILD_COMMAND nmake -f win32/Makefile.msc LOC=-DZLIB_WINAPI
URL "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz"
URL_HASH "SHA256=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${ZLIB_LIB}
INSTALL_COMMAND "")
install(FILES "${ZLIB_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES ${ZLIB_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/zlib"
COMPONENT "libs-deps")
CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_PIC}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${ZLIB_SRC}
)
install(
FILES "${ZLIB_LIB}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
)
install(
FILES ${ZLIB_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/zlib"
COMPONENT "libs-deps"
)
endif()
endif()
endif()

16
codecov.yml Normal file
View File

@ -0,0 +1,16 @@
coverage:
status:
project:
default: off
libsinsp:
flags:
- libsinsp
flags:
libsinsp:
paths:
- userspace/libsinsp/
parsers:
cobertura:
partials_as_hits: true

View File

@ -1,278 +0,0 @@
0 Introduction
------
This repository strives for a consistent high quality code base and uses the conventions
below. If you are going to commit code that doesn't follow them, then you put the
work on us. :-(
If you use vim or emacs, you can put a custom configuration file in the base
directory in order to follow the conventions.
Also, note that the conventions in this file apply **strictly to the userspace** part
of this repository. For the kernel code, you should refer to
https://www.kernel.org/doc/html/latest/process/coding-style.html
and always run `checkpatch.pl` from the kernel tree before submitting pull requests.
Thanks for your attention and time.
1 Curly Braces
------
Every curly brace ("{" and "}") should go on its own line.
Example:
if(a == 0)
{
b = 1;
}
2 If and for statements
------
Every `if` and `for` statement should have the curly braces.
Example:
if(a == 0)
{
b = 1;
}
and not
if(a == 0)
b = 1;
3 Whitespace usage
------
Spaces are used in the following way:
int32_t foo(int32_t a, int32_t b)
{
for(j = 0; j < 10; j++)
{
foo(a, b);
}
}
Note that:
* in a function declaration, there is no space between the function name and the "(".
* in a function declaration, there is no space between the "(" and the first parameter.
* in a statement (e.g `for`, `while`...), there is no space between the "for" and the "(".
* in a statement (e.g `for`), there is no space between the "(" and the variable name.
* in a function call, there is no space between the function name and the "(".
* in a function call, there is no space between the "(" and the first parameter.
* "," and ";" work like in English: there should be a space after them.
4 Primitive types
------
For portability reasons, please use the standard C99 types instead of the native C types
like `int` and `long`. C99 types types will be available in all the user level
source files:
Example:
int32_t foo;
5 Commenting Style
------
Comments should be in the C++ style so we can use `/* */` to quickly remove
portions of code during development.
Example:
// this is a comment
6 Commenting Content
------
Code comments work in the following 2-level way:
* A three-line comment should document what the code does and give higher level explanations.
* A one line comment should detail single code lines or explain specific actions.
Example:
//
// Swap two variables
//
int a = 1, b = 2, t;
// make a copy of a
t = a;
// perform the swap
a = b;
b = t;
7 Class variables
------
In order to know whether a variable belongs to a `class` or a `function` we start member variables with "`m_`".
Example:
public int32_t m_counter;
8 Global variables
------
Similarly, in order to know whether the variable is global or not, we start
globals with "`g_`".
Example:
int g_nplugins;
9 Capitalization
------
The naming convention is camel-cased "Unix" style, i.e. always lower case. Words are separated by underscores.
Example:
int32_t g_global_bean_counter;
int32_t count_beans();
and not,
int32_t GlobalBeanCounter;
10 Packed Structures
-------
Packed structures should use the GCC and MSVC-style supported `pragma`:
#pragma pack(push,1)
struct frame_control
{
struct fields....
};
#pragma pack(pop)
11 OS-specific macros
-------
There's an online wiki which enumerates the different macros for compilers, operating systems, and architectures.
It's available at [http://sourceforge.net/p/predef/wiki/Home/](http://sourceforge.net/p/predef/wiki/Home/). Generally speaking we use the operating system page: [http://sourceforge.net/p/predef/wiki/OperatingSystems/](http://sourceforge.net/p/predef/wiki/OperatingSystems/).
12 64-bit constants
-------
Put an "LL" at the end of your 64 bit constants. Without the LL, on some platforms the compiler tries to interpret the constant on the right hand side
as a long integer instead of a long long and in some platform this generate an error at building time.
Example:
x=0X00FF00000000000LL
13 Class Declaration
-------
Class declarations follow the following sequence
1. constructors and destructor
2. public functions
3. public data
4. private functions
5. private data
6. friend declarations
Example:
class foo
{
public:
foo();
~foo();
int32_t lonli();
int32_t m_val;
private:
int32_t temustra();
int32_t m_val2;
};
14 Struct guidelines
-------
We think hiding the presence of a pointer makes the code unnecessarily
ambiguous and more difficult.
Seeing a * in a variable declaration immediately identifies a pointer, which
is easier to mentally keep track of!
Also we think that defining the struct as a typedef makes forward declarations
clunky and find using the C++ style when declaring our structs makes our
lives easier.
//
// Us human parsers find this confusing.
//
typedef struct _my_struct
{
u_int16 m_field;
} my_struct,
*p_my_struct;
//
// This is easier!
//
struct my_struct {
u_int16 m_field;
};
15 Temporary variables
-------
Since "j" is used less frequently in english prose than "a" or "i", we find
that these variables (in hierarchical order) are great for counters: j, k, l,
m, n.
Example:
int32_t j,k;
for(j = 0; j < 10; j++)
{
for(k = 0; k < 10; k++)
{
int32_t foo = j + k;
}
}
as opposed to:
int32_t i,counter;
for(i = 0; i < 10; i++)
{
for(counter = 0; counter < 10; counter++)
{
int32_t foo = i + counter;
}
}
16 Error management
-------
Error management inside libscap is done through return values, since the scap
library is written in C.
Error management in the rest of the user level code base is done through
exceptions. We know there's a lot of debate between return values and
exceptions. We decided to pick the latter, so please stick with that.
## You Made It!
Phew! That's it. Thanks!
If we've left anything in the open, feel free to contact us and we'll be happy
to get back to you. Also, you can look at the existing code and see how it's
done.
Have a good one!

View File

@ -11,3 +11,7 @@ Navigate to the Home of Falco Drivers Kernel Testing on the left, or click this
## Supported Syscalls Report
Navigate to the Home of Falco Drivers Syscalls Report on the left, or click this [link](syscalls.md), or directly proceed to the supported syscalls [report](report.md).
## Perf Continuous Monitoring
Navigate to the Home of Falco Perf Monitoring on the left, or click this [link](perf.md).

11
docs/perf.md Normal file
View File

@ -0,0 +1,11 @@
# Home of Falco Perf Monitoring
Our CI is capable of continuously benchmarking performance of our userspace code, both CPU and memory.
Every PR will have a comment with the perf diff from master for multiple aspects, while on master the flamegraph are pushed to this github pages.
Navigate to the perf reports on the left, or click these links:
* [unit tests cpu perf](perf_unit_tests.md)
* [scap file reading cpu perf](perf_scap_file.md)
* [unit tests memory profile](heaptrack_unit_tests.md)
* [scap file reading memory profile](heaptrack_scap_file.md)

View File

@ -1,411 +1,418 @@
| SYSCALL | SUPPORTED | ARCHITECTURE |
|-------------------------|-----------|--------------------------------------|
| _llseek | 🟢 | ppc64le |
| _newselect | 🟡 | ppc64le |
| accept | 🟢 | aarch64,ppc64le,riscv64,x86_64 |
| accept4 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| access | 🟢 | ppc64le,s390x,x86_64 |
| acct | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| add_key | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| adjtimex | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| alarm | 🟡 | ppc64le,s390x,x86_64 |
| arch_prctl | 🟡 | x86_64 |
| bind | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| bpf | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| brk | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| cachestat | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| capget | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| capset | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| chdir | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| chmod | 🟢 | ppc64le,s390x,x86_64 |
| chown | 🟢 | ppc64le,s390x,x86_64 |
| chroot | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_adjtime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_getres | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_gettime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_nanosleep | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_settime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clone | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| clone3 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| close | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| close_range | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| connect | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| copy_file_range | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| creat | 🟢 | ppc64le,s390x,x86_64 |
| delete_module | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| dup | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| dup2 | 🟢 | ppc64le,s390x,x86_64 |
| dup3 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_create | 🟢 | ppc64le,s390x,x86_64 |
| epoll_create1 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_ctl | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_ctl_old | 🟡 | x86_64 |
| epoll_pwait | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_pwait2 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_wait | 🟢 | ppc64le,s390x,x86_64 |
| epoll_wait_old | 🟡 | x86_64 |
| eventfd | 🟢 | ppc64le,s390x,x86_64 |
| eventfd2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| execve | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| execveat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| exit | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| exit_group | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| faccessat | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| faccessat2 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fadvise64 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fallocate | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fanotify_init | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fanotify_mark | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchdir | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmod | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmodat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmodat2 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchown | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fchownat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fcntl | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fdatasync | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fgetxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| finit_module | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| flistxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| flock | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fork | 🟢 | ppc64le,s390x,x86_64 |
| fremovexattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fsconfig | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fsetxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fsmount | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fsopen | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fspick | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fstat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fstatfs | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| fstatfs64 | 🟡 | ppc64le,s390x |
| fsync | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ftruncate | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futex | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_requeue | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_wait | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_waitv | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_wake | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| futimesat | 🟡 | ppc64le,s390x,x86_64 |
| get_mempolicy | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| get_robust_list | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| get_thread_area | 🟡 | x86_64 |
| getcpu | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getcwd | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getdents | 🟢 | ppc64le,s390x,x86_64 |
| getdents64 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getegid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| geteuid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getgid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getgroups | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getitimer | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getpeername | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getpgid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getpgrp | 🟡 | ppc64le,s390x,x86_64 |
| getpid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getppid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getpriority | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getrandom | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getresgid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getresuid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getrlimit | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getrusage | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getsid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getsockname | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getsockopt | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| gettid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| gettimeofday | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getuid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| init_module | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_add_watch | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_init | 🟢 | ppc64le,s390x,x86_64 |
| inotify_init1 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_rm_watch | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_cancel | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_destroy | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_getevents | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_pgetevents | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_setup | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_submit | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_enter | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_register | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_setup | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ioctl | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ioperm | 🟡 | ppc64le,x86_64 |
| iopl | 🟡 | ppc64le,x86_64 |
| ioprio_get | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ioprio_set | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ipc | 🟡 | ppc64le,s390x |
| kcmp | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| kexec_file_load | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| kexec_load | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| keyctl | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| kill | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_add_rule | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_create_ruleset | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_restrict_self | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lchown | 🟢 | ppc64le,s390x,x86_64 |
| lgetxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| link | 🟢 | ppc64le,s390x,x86_64 |
| linkat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| listen | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| listmount | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| listxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| llistxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lookup_dcookie | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lremovexattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lseek | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lsetxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_get_self_attr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_list_modules | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_set_self_attr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| lstat | 🟢 | ppc64le,s390x,x86_64 |
| madvise | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| map_shadow_stack | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mbind | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| membarrier | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| memfd_create | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| memfd_secret | 🟡 | aarch64,riscv64,s390x,x86_64 |
| migrate_pages | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mincore | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mkdir | 🟢 | ppc64le,s390x,x86_64 |
| mkdirat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mknod | 🟢 | ppc64le,s390x,x86_64 |
| mknodat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mlock | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mlock2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mlockall | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mmap | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| modify_ldt | 🟡 | ppc64le,x86_64 |
| mount | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mount_setattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| move_mount | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| move_pages | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mprotect | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_getsetattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_notify | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_open | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_timedreceive | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_timedsend | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_unlink | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| mremap | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| msgctl | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| msgget | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| msgrcv | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| msgsnd | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| msync | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| multiplexer | 🟡 | ppc64le |
| munlock | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| munlockall | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| munmap | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| name_to_handle_at | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| nanosleep | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| newfstatat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| nice | 🟡 | ppc64le,s390x |
| oldfstat | 🟡 | ppc64le |
| oldlstat | 🟡 | ppc64le |
| oldolduname | 🟡 | ppc64le |
| oldstat | 🟡 | ppc64le |
| olduname | 🟡 | ppc64le |
| open | 🟢 | ppc64le,s390x,x86_64 |
| open_by_handle_at | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| open_tree | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| openat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| openat2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pause | 🟡 | ppc64le,s390x,x86_64 |
| pciconfig_iobase | 🟡 | ppc64le |
| pciconfig_read | 🟡 | ppc64le |
| pciconfig_write | 🟡 | ppc64le |
| perf_event_open | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| personality | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_getfd | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_open | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_send_signal | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pipe | 🟢 | ppc64le,s390x,x86_64 |
| pipe2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pivot_root | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_alloc | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_free | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_mprotect | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| poll | 🟢 | ppc64le,s390x,x86_64 |
| ppoll | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| prctl | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pread64 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| preadv | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| preadv2 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| prlimit64 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| process_madvise | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| process_mrelease | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| process_vm_readv | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| process_vm_writev | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pselect6 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ptrace | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pwrite64 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pwritev | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| pwritev2 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| quotactl | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| quotactl_fd | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| read | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| readahead | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| readdir | 🟡 | ppc64le,s390x |
| readlink | 🟡 | ppc64le,s390x,x86_64 |
| readlinkat | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| readv | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| reboot | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| recv | 🟢 | ppc64le |
| recvfrom | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| recvmmsg | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| recvmsg | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| remap_file_pages | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| removexattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rename | 🟢 | ppc64le,s390x,x86_64 |
| renameat | 🟢 | aarch64,ppc64le,s390x,x86_64 |
| renameat2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| request_key | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| restart_syscall | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| riscv_flush_icache | 🟡 | riscv64 |
| riscv_hwprobe | 🟡 | riscv64 |
| rmdir | 🟢 | ppc64le,s390x,x86_64 |
| rseq | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigaction | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigpending | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigprocmask | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigqueueinfo | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigreturn | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigsuspend | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigtimedwait | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_tgsigqueueinfo | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| rtas | 🟡 | ppc64le |
| s390_guarded_storage | 🟡 | s390x |
| s390_pci_mmio_read | 🟡 | s390x |
| s390_pci_mmio_write | 🟡 | s390x |
| s390_runtime_instr | 🟡 | s390x |
| s390_sthyi | 🟡 | s390x |
| sched_get_priority_max | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_get_priority_min | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getaffinity | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getparam | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getscheduler | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_rr_get_interval | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setaffinity | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setparam | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setscheduler | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_yield | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| seccomp | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| select | 🟢 | ppc64le,s390x,x86_64 |
| semctl | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| semget | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| semop | 🟢 | aarch64,riscv64,x86_64 |
| semtimedop | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| send | 🟢 | ppc64le |
| sendfile | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sendmmsg | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sendmsg | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sendto | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| set_mempolicy | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| set_mempolicy_home_node | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| set_robust_list | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| set_thread_area | 🟡 | x86_64 |
| set_tid_address | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setdomainname | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setfsgid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setfsuid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setgid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setgroups | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sethostname | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setitimer | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setns | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setpgid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setpriority | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setregid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setresgid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setresuid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setreuid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setrlimit | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setsid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setsockopt | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| settimeofday | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setuid | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setxattr | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sgetmask | 🟡 | ppc64le |
| shmat | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| shmctl | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| shmdt | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| shmget | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| shutdown | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sigaction | 🟡 | ppc64le,s390x |
| sigaltstack | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| signal | 🟡 | ppc64le,s390x |
| signalfd | 🟢 | ppc64le,s390x,x86_64 |
| signalfd4 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sigpending | 🟡 | ppc64le,s390x |
| sigprocmask | 🟡 | ppc64le,s390x |
| sigreturn | 🟡 | ppc64le,s390x |
| sigsuspend | 🟡 | ppc64le,s390x |
| socket | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| socketcall | 🟡 | ppc64le,s390x |
| socketpair | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| splice | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| spu_create | 🟡 | ppc64le |
| spu_run | 🟡 | ppc64le |
| ssetmask | 🟡 | ppc64le |
| stat | 🟢 | ppc64le,s390x,x86_64 |
| statfs | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| statfs64 | 🟡 | ppc64le,s390x |
| statmount | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| statx | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| stime | 🟡 | ppc64le |
| subpage_prot | 🟡 | ppc64le |
| swapcontext | 🟡 | ppc64le |
| swapoff | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| swapon | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| switch_endian | 🟡 | ppc64le |
| symlink | 🟢 | ppc64le,s390x,x86_64 |
| symlinkat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sync | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sync_file_range | 🟡 | aarch64,riscv64,s390x,x86_64 |
| sync_file_range2 | 🟡 | ppc64le |
| syncfs | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| sys_debug_setcontext | 🟡 | ppc64le |
| sysfs | 🟡 | ppc64le,s390x,x86_64 |
| sysinfo | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| syslog | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| tee | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| tgkill | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| time | 🟡 | ppc64le,x86_64 |
| timer_create | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_delete | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_getoverrun | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_gettime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_settime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd | 🟡 | s390x |
| timerfd_create | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd_gettime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd_settime | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| times | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| tkill | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| truncate | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ugetrlimit | 🟢 | ppc64le |
| umask | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| umount | 🟢 | ppc64le,s390x |
| umount2 | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| uname | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| unlink | 🟢 | ppc64le,s390x,x86_64 |
| unlinkat | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| unshare | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| userfaultfd | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| ustat | 🟡 | ppc64le,s390x,x86_64 |
| utime | 🟡 | ppc64le,s390x,x86_64 |
| utimensat | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| utimes | 🟡 | ppc64le,s390x,x86_64 |
| vfork | 🟢 | ppc64le,s390x,x86_64 |
| vhangup | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| vm86 | 🟡 | ppc64le |
| vmsplice | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| wait4 | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| waitid | 🟡 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| waitpid | 🟡 | ppc64le |
| write | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| writev | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| SYSCALL | SUPPORTED | ARCHITECTURE |
|-------------------------|-----------|--------------------------------------------------|
| _llseek | 🟢 | ppc64le |
| _newselect | 🟡 | ppc64le |
| accept | 🟢 | aarch64,loongarch64,ppc64le,riscv64,x86_64 |
| accept4 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| access | 🟢 | ppc64le,s390x,x86_64 |
| acct | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| add_key | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| adjtimex | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| alarm | 🟡 | ppc64le,s390x,x86_64 |
| arch_prctl | 🟡 | x86_64 |
| bind | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| bpf | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| brk | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| cachestat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| capget | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| capset | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| chdir | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| chmod | 🟢 | ppc64le,s390x,x86_64 |
| chown | 🟢 | ppc64le,s390x,x86_64 |
| chroot | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_adjtime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_getres | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_gettime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_nanosleep | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clock_settime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clone | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| clone3 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| close | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| close_range | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| connect | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| copy_file_range | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| creat | 🟢 | ppc64le,s390x,x86_64 |
| delete_module | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| dup | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| dup2 | 🟢 | ppc64le,s390x,x86_64 |
| dup3 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_create | 🟢 | ppc64le,s390x,x86_64 |
| epoll_create1 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_ctl | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_ctl_old | 🟡 | x86_64 |
| epoll_pwait | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_pwait2 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| epoll_wait | 🟢 | ppc64le,s390x,x86_64 |
| epoll_wait_old | 🟡 | x86_64 |
| eventfd | 🟢 | ppc64le,s390x,x86_64 |
| eventfd2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| execve | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| execveat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| exit | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| exit_group | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| faccessat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| faccessat2 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fadvise64 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fallocate | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fanotify_init | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fanotify_mark | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchdir | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmod | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmodat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchmodat2 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchown | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fchownat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fcntl | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fdatasync | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fgetxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| finit_module | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| flistxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| flock | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fork | 🟢 | ppc64le,s390x,x86_64 |
| fremovexattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fsconfig | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fsetxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fsmount | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fsopen | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fspick | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fstat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fstatfs | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| fstatfs64 | 🟡 | ppc64le,s390x |
| fsync | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ftruncate | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futex | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_requeue | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_wait | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_waitv | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futex_wake | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| futimesat | 🟡 | ppc64le,s390x,x86_64 |
| get_mempolicy | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| get_robust_list | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| get_thread_area | 🟡 | x86_64 |
| getcpu | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getcwd | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getdents | 🟢 | ppc64le,s390x,x86_64 |
| getdents64 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getegid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| geteuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getgid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getgroups | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getitimer | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getpeername | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getpgid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getpgrp | 🟡 | ppc64le,s390x,x86_64 |
| getpid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getppid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getpriority | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getrandom | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getresgid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getresuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getrlimit | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| getrusage | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getsid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getsockname | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getsockopt | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| gettid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| gettimeofday | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| getxattrat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| init_module | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_add_watch | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_init | 🟢 | ppc64le,s390x,x86_64 |
| inotify_init1 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| inotify_rm_watch | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_cancel | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_destroy | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_getevents | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_pgetevents | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_setup | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_submit | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_enter | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_register | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| io_uring_setup | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ioctl | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ioperm | 🟡 | ppc64le,x86_64 |
| iopl | 🟡 | ppc64le,x86_64 |
| ioprio_get | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ioprio_set | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ipc | 🟡 | ppc64le,s390x |
| kcmp | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| kexec_file_load | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| kexec_load | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| keyctl | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| kill | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_add_rule | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_create_ruleset | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| landlock_restrict_self | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lchown | 🟢 | ppc64le,s390x,x86_64 |
| lgetxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| link | 🟢 | ppc64le,s390x,x86_64 |
| linkat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| listen | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| listmount | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| listxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| listxattrat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| llistxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lookup_dcookie | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lremovexattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lseek | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lsetxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_get_self_attr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_list_modules | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lsm_set_self_attr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| lstat | 🟢 | ppc64le,s390x,x86_64 |
| madvise | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| map_shadow_stack | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mbind | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| membarrier | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| memfd_create | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| memfd_secret | 🟡 | aarch64,riscv64,s390x,x86_64 |
| migrate_pages | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mincore | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mkdir | 🟢 | ppc64le,s390x,x86_64 |
| mkdirat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mknod | 🟢 | ppc64le,s390x,x86_64 |
| mknodat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mlock | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mlock2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mlockall | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mmap | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| modify_ldt | 🟡 | ppc64le,x86_64 |
| mount | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mount_setattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| move_mount | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| move_pages | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mprotect | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_getsetattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_notify | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_open | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_timedreceive | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_timedsend | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mq_unlink | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mremap | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| mseal | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| msgctl | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| msgget | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| msgrcv | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| msgsnd | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| msync | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| multiplexer | 🟡 | ppc64le |
| munlock | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| munlockall | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| munmap | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| name_to_handle_at | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| nanosleep | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| newfstatat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| nice | 🟡 | ppc64le,s390x |
| oldfstat | 🟡 | ppc64le |
| oldlstat | 🟡 | ppc64le |
| oldolduname | 🟡 | ppc64le |
| oldstat | 🟡 | ppc64le |
| olduname | 🟡 | ppc64le |
| open | 🟢 | ppc64le,s390x,x86_64 |
| open_by_handle_at | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| open_tree | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| open_tree_attr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| openat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| openat2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pause | 🟡 | ppc64le,s390x,x86_64 |
| pciconfig_iobase | 🟡 | ppc64le |
| pciconfig_read | 🟡 | ppc64le |
| pciconfig_write | 🟡 | ppc64le |
| perf_event_open | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| personality | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_getfd | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_open | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pidfd_send_signal | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pipe | 🟢 | ppc64le,s390x,x86_64 |
| pipe2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pivot_root | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_alloc | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_free | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pkey_mprotect | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| poll | 🟢 | ppc64le,s390x,x86_64 |
| ppoll | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| prctl | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pread64 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| preadv | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| preadv2 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| prlimit64 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| process_madvise | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| process_mrelease | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| process_vm_readv | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| process_vm_writev | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pselect6 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ptrace | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pwrite64 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pwritev | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| pwritev2 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| quotactl | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| quotactl_fd | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| read | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| readahead | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| readdir | 🟡 | ppc64le,s390x |
| readlink | 🟡 | ppc64le,s390x,x86_64 |
| readlinkat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| readv | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| reboot | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| recv | 🟢 | ppc64le |
| recvfrom | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| recvmmsg | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| recvmsg | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| remap_file_pages | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| removexattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| removexattrat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rename | 🟢 | ppc64le,s390x,x86_64 |
| renameat | 🟢 | aarch64,ppc64le,s390x,x86_64 |
| renameat2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| request_key | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| restart_syscall | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| riscv_flush_icache | 🟡 | riscv64 |
| riscv_hwprobe | 🟡 | riscv64 |
| rmdir | 🟢 | ppc64le,s390x,x86_64 |
| rseq | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigaction | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigpending | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigprocmask | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigqueueinfo | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigreturn | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigsuspend | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_sigtimedwait | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rt_tgsigqueueinfo | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| rtas | 🟡 | ppc64le |
| s390_guarded_storage | 🟡 | s390x |
| s390_pci_mmio_read | 🟡 | s390x |
| s390_pci_mmio_write | 🟡 | s390x |
| s390_runtime_instr | 🟡 | s390x |
| s390_sthyi | 🟡 | s390x |
| sched_get_priority_max | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_get_priority_min | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getaffinity | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getparam | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_getscheduler | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_rr_get_interval | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setaffinity | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setparam | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_setscheduler | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sched_yield | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| seccomp | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| select | 🟢 | ppc64le,s390x,x86_64 |
| semctl | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| semget | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| semop | 🟢 | aarch64,loongarch64,riscv64,x86_64 |
| semtimedop | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| send | 🟢 | ppc64le |
| sendfile | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sendmmsg | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sendmsg | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sendto | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| set_mempolicy | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| set_mempolicy_home_node | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| set_robust_list | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| set_thread_area | 🟡 | x86_64 |
| set_tid_address | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setdomainname | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setfsgid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setfsuid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setgid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setgroups | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sethostname | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setitimer | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setns | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setpgid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setpriority | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setregid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setresgid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setresuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setreuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setrlimit | 🟢 | aarch64,ppc64le,riscv64,s390x,x86_64 |
| setsid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setsockopt | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| settimeofday | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setuid | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setxattr | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| setxattrat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sgetmask | 🟡 | ppc64le |
| shmat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| shmctl | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| shmdt | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| shmget | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| shutdown | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sigaction | 🟡 | ppc64le,s390x |
| sigaltstack | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| signal | 🟡 | ppc64le,s390x |
| signalfd | 🟢 | ppc64le,s390x,x86_64 |
| signalfd4 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sigpending | 🟡 | ppc64le,s390x |
| sigprocmask | 🟡 | ppc64le,s390x |
| sigreturn | 🟡 | ppc64le,s390x |
| sigsuspend | 🟡 | ppc64le,s390x |
| socket | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| socketcall | 🟡 | ppc64le,s390x |
| socketpair | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| splice | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| spu_create | 🟡 | ppc64le |
| spu_run | 🟡 | ppc64le |
| ssetmask | 🟡 | ppc64le |
| stat | 🟢 | ppc64le,s390x,x86_64 |
| statfs | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| statfs64 | 🟡 | ppc64le,s390x |
| statmount | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| statx | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| stime | 🟡 | ppc64le |
| subpage_prot | 🟡 | ppc64le |
| swapcontext | 🟡 | ppc64le |
| swapoff | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| swapon | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| switch_endian | 🟡 | ppc64le |
| symlink | 🟢 | ppc64le,s390x,x86_64 |
| symlinkat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sync | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sync_file_range | 🟡 | aarch64,loongarch64,riscv64,s390x,x86_64 |
| sync_file_range2 | 🟡 | ppc64le |
| syncfs | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| sys_debug_setcontext | 🟡 | ppc64le |
| sysfs | 🟡 | ppc64le,s390x,x86_64 |
| sysinfo | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| syslog | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| tee | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| tgkill | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| time | 🟡 | ppc64le,x86_64 |
| timer_create | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_delete | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_getoverrun | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_gettime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timer_settime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd | 🟡 | s390x |
| timerfd_create | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd_gettime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| timerfd_settime | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| times | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| tkill | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| truncate | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ugetrlimit | 🟢 | ppc64le |
| umask | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| umount | 🟢 | ppc64le,s390x |
| umount2 | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| uname | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| unlink | 🟢 | ppc64le,s390x,x86_64 |
| unlinkat | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| unshare | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| uretprobe | 🟡 | x86_64 |
| userfaultfd | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| ustat | 🟡 | ppc64le,s390x,x86_64 |
| utime | 🟡 | ppc64le,s390x,x86_64 |
| utimensat | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| utimes | 🟡 | ppc64le,s390x,x86_64 |
| vfork | 🟢 | ppc64le,s390x,x86_64 |
| vhangup | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| vm86 | 🟡 | ppc64le |
| vmsplice | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| wait4 | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| waitid | 🟡 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| waitpid | 🟡 | ppc64le |
| write | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |
| writev | 🟢 | aarch64,loongarch64,ppc64le,riscv64,s390x,x86_64 |

View File

@ -1 +1 @@
8.0.3
8.0.4

View File

@ -2,26 +2,31 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# This file is dual licensed under either the MIT or GPL 2. See
# MIT.txt or GPL.txt for full copies of the license.
# This file is dual licensed under either the MIT or GPL 2. See MIT.txt or GPL.txt for full copies
# of the license.
#
cmake_minimum_required(VERSION 3.12)
project(driver)
set(TARGET_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
if((NOT TARGET_ARCH STREQUAL "x86_64") AND
(NOT TARGET_ARCH STREQUAL "aarch64") AND
(NOT TARGET_ARCH STREQUAL "s390x") AND
(NOT TARGET_ARCH STREQUAL "riscv64") AND
(NOT TARGET_ARCH STREQUAL "ppc64le") AND
(NOT TARGET_ARCH STREQUAL "loongarch64"))
if((NOT TARGET_ARCH STREQUAL "x86_64")
AND (NOT TARGET_ARCH STREQUAL "aarch64")
AND (NOT TARGET_ARCH STREQUAL "s390x")
AND (NOT TARGET_ARCH STREQUAL "riscv64")
AND (NOT TARGET_ARCH STREQUAL "ppc64le")
AND (NOT TARGET_ARCH STREQUAL "loongarch64")
)
message(WARNING "Target architecture not officially supported by our drivers!")
else()
# Load current kernel version
execute_process(COMMAND uname -r OUTPUT_VARIABLE UNAME_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND uname -r
OUTPUT_VARIABLE UNAME_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "[0-9]+.[0-9]+" LINUX_KERNEL_VERSION ${UNAME_RESULT})
message(STATUS "Kernel version: ${UNAME_RESULT}")
message(STATUS "Kernel version: ${UNAME_RESULT}")
# Check minimum kernel version
set(kmod_min_kver_map_x86_64 2.6)
@ -31,8 +36,11 @@ else()
set(kmod_min_kver_map_ppc64le 2.6)
set(kmod_min_kver_map_loongarch64 5.10)
if (LINUX_KERNEL_VERSION VERSION_LESS ${kmod_min_kver_map_${TARGET_ARCH}})
message(WARNING "[KMOD] To run this driver you need a Linux kernel version >= ${kmod_min_kver_map_${TARGET_ARCH}} but actual kernel version is: ${UNAME_RESULT}")
if(LINUX_KERNEL_VERSION VERSION_LESS ${kmod_min_kver_map_${TARGET_ARCH}})
message(
WARNING
"[KMOD] To run this driver you need a Linux kernel version >= ${kmod_min_kver_map_${TARGET_ARCH}} but actual kernel version is: ${UNAME_RESULT}"
)
endif()
endif()
@ -40,8 +48,9 @@ option(BUILD_DRIVER "Build the driver on Linux" ON)
option(ENABLE_DKMS "Enable DKMS on Linux" ON)
if(NOT DEFINED DRIVER_VERSION)
message(FATAL_ERROR
"No DRIVER_VERSION set.\nPlease either explicitly set it or build the root project 'falcosecurity/libs' from a git working directory."
message(
FATAL_ERROR
"No DRIVER_VERSION set.\nPlease either explicitly set it or build the root project 'falcosecurity/libs' from a git working directory."
)
endif()
@ -64,36 +73,30 @@ if(NOT DEFINED DRIVER_DEVICE_NAME)
set(DRIVER_DEVICE_NAME "${DRIVER_NAME}")
endif()
# The driver build process is somewhat involved because we use the same
# sources for building the driver locally and for shipping as a DKMS module.
# The driver build process is somewhat involved because we use the same sources for building the
# driver locally and for shipping as a DKMS module.
#
# We need a single directory with the following files inside:
# - all the driver *.c/*.h sources
# - Makefile generated from Makefile.in
# - driver_config.h generated from driver_config.h.in
# We need a single directory with the following files inside: - all the driver *.c/*.h sources -
# Makefile generated from Makefile.in - driver_config.h generated from driver_config.h.in
#
# The Makefile _must_ be called just Makefile (and not e.g. Makefile.dkms)
# because of the module build process, which looks like this:
# 1. The user (or some script) runs make in our driver directory
# 2. Our Makefile runs the Makefile from kernel sources/headers
# 3. The kernel Makefile calls our original Makefile again, with options that
# trigger the actual build. This step cannot know that our Makefile has
# a different name.
# The Makefile _must_ be called just Makefile (and not e.g. Makefile.dkms) because of the module
# build process, which looks like this: 1. The user (or some script) runs make in our driver
# directory 2. Our Makefile runs the Makefile from kernel sources/headers 3. The kernel Makefile
# calls our original Makefile again, with options that trigger the actual build. This step cannot
# know that our Makefile has a different name.
#
# (DKMS needs a Makefile called Makefile as well).
#
# The files need to be in a single directory because we cannot know where
# the sources will be built (especially by DKMS) so we cannot put _any_ paths
# in the Makefile.
# The files need to be in a single directory because we cannot know where the sources will be built
# (especially by DKMS) so we cannot put _any_ paths in the Makefile.
#
# The chosen directory must not be ${CMAKE_CURRENT_BINARY_DIR} because CMake
# puts its own generated Makefile in there, so we (arbitrarily) choose
# ${CMAKE_CURRENT_BINARY_DIR}/src. To maintain compatibility with older versions,
# after the build we copy the compiled module one directory up,
# The chosen directory must not be ${CMAKE_CURRENT_BINARY_DIR} because CMake puts its own generated
# Makefile in there, so we (arbitrarily) choose ${CMAKE_CURRENT_BINARY_DIR}/src. To maintain
# compatibility with older versions, after the build we copy the compiled module one directory up,
# to ${CMAKE_CURRENT_BINARY_DIR}.
include(compute_versions RESULT_VARIABLE RESULT)
if(RESULT STREQUAL NOTFOUND)
message(FATAL_ERROR "problem with compute_versions.cmake in ${CMAKE_MODULE_PATH}")
message(FATAL_ERROR "problem with compute_versions.cmake in ${CMAKE_MODULE_PATH}")
endif()
compute_versions(API_VERSION SCHEMA_VERSION)
@ -108,23 +111,26 @@ file(GLOB configure_modules "${CMAKE_CURRENT_SOURCE_DIR}/configure/*")
foreach(subdir ${configure_modules})
if(IS_DIRECTORY "${subdir}")
file(RELATIVE_PATH CONFIGURE_MODULE "${CMAKE_CURRENT_SOURCE_DIR}/configure" "${subdir}")
configure_file(configure/${CONFIGURE_MODULE}/test.c src/configure/${CONFIGURE_MODULE}/test.c COPYONLY)
configure_file(
configure/${CONFIGURE_MODULE}/test.c src/configure/${CONFIGURE_MODULE}/test.c COPYONLY
)
configure_file(configure/Makefile src/configure/${CONFIGURE_MODULE}/Makefile COPYONLY)
configure_file(configure/build.sh src/configure/${CONFIGURE_MODULE}/build.sh COPYONLY)
configure_file(configure/Makefile.inc.in src/configure/${CONFIGURE_MODULE}/Makefile.inc)
if(ENABLE_DKMS)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/build.sh"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/test.c"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile.inc"
DESTINATION "src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/configure/${CONFIGURE_MODULE}"
COMPONENT ${DRIVER_KMOD_COMPONENT_NAME})
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/build.sh"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/test.c"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile.inc"
DESTINATION
"src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/configure/${CONFIGURE_MODULE}"
COMPONENT ${DRIVER_KMOD_COMPONENT_NAME}
)
endif()
endif()
endforeach()
set(DRIVER_SOURCES
dynamic_params_table.c
event_table.c
@ -152,6 +158,11 @@ set(DRIVER_SOURCES
ppm_consumer.h
capture_macro.h
socketcall_to_syscall.h
syscall_compat_loongarch64.h
syscall_compat_ppc64le.h
syscall_compat_riscv64.h
syscall_compat_s390x.h
syscall_compat_x86_64.h
syscall_ia32_64_map.c
)
@ -159,44 +170,51 @@ foreach(FILENAME IN LISTS DRIVER_SOURCES)
configure_file(${FILENAME} src/${FILENAME} COPYONLY)
endforeach()
# make can be self-referenced as $(MAKE) only from Makefiles but this
# triggers syntax errors with other generators such as Ninja
# make can be self-referenced as $(MAKE) only from Makefiles but this triggers syntax errors with
# other generators such as Ninja
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set(MAKE_COMMAND "$(MAKE)")
else()
set(MAKE_COMMAND "make")
endif()
# This if/else is needed because you currently cannot manipulate dependencies
# of built-in targets like "all" in CMake:
# http://public.kitware.com/Bug/view.php?id=8438
# This if/else is needed because you currently cannot manipulate dependencies of built-in targets
# like "all" in CMake: http://public.kitware.com/Bug/view.php?id=8438
if(BUILD_DRIVER)
add_custom_target(driver ALL
add_custom_target(
driver ALL
COMMAND ${MAKE_COMMAND}
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${DRIVER_NAME}.ko "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${DRIVER_NAME}.ko
"${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY src
VERBATIM)
VERBATIM
)
else()
add_custom_target(driver
add_custom_target(
driver
COMMAND ${MAKE_COMMAND}
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${DRIVER_NAME}.ko "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${DRIVER_NAME}.ko
"${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY src
VERBATIM)
VERBATIM
)
endif()
add_custom_target(install_driver
add_custom_target(
install_driver
COMMAND ${MAKE_COMMAND} install
DEPENDS driver
WORKING_DIRECTORY src
VERBATIM)
VERBATIM
)
if(ENABLE_DKMS)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/Makefile
${CMAKE_CURRENT_BINARY_DIR}/src/dkms.conf
${CMAKE_CURRENT_BINARY_DIR}/src/driver_config.h
${DRIVER_SOURCES}
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/src/Makefile ${CMAKE_CURRENT_BINARY_DIR}/src/dkms.conf
${CMAKE_CURRENT_BINARY_DIR}/src/driver_config.h ${DRIVER_SOURCES}
DESTINATION "src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}"
COMPONENT ${DRIVER_KMOD_COMPONENT_NAME})
COMPONENT ${DRIVER_KMOD_COMPONENT_NAME}
)
endif()
add_subdirectory(bpf)

View File

@ -29,7 +29,7 @@ install: all
else
KERNELDIR ?= $(CURDIR)
KERNELDIR ?= $(realpath $(objtree))
#
# Get the path of the module sources
#

View File

@ -1 +1 @@
2.20.0
3.69.0

View File

@ -2,8 +2,8 @@
#
# Copyright (C) 2023 The Falco Authors.
#
# This file is dual licensed under either the MIT or GPL 2. See
# MIT.txt or GPL.txt for full copies of the license.
# This file is dual licensed under either the MIT or GPL 2. See MIT.txt or GPL.txt for full copies
# of the license.
#
configure_file(../driver_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/../driver_config.h)
@ -16,15 +16,20 @@ if(BUILD_BPF)
set(bpf_min_kver_map_aarch64 4.17)
set(bpf_min_kver_map_s390x 5.5)
set(bpf_min_kver_map_ppc64le 5.1)
if (LINUX_KERNEL_VERSION VERSION_LESS ${bpf_min_kver_map_${TARGET_ARCH}})
message(WARNING "[BPF] To run this driver you need a Linux kernel version >= ${bpf_min_kver_map_${TARGET_ARCH}} but actual kernel version is: ${UNAME_RESULT}")
if(LINUX_KERNEL_VERSION VERSION_LESS ${bpf_min_kver_map_${TARGET_ARCH}})
message(
WARNING
"[BPF] To run this driver you need a Linux kernel version >= ${bpf_min_kver_map_${TARGET_ARCH}} but actual kernel version is: ${UNAME_RESULT}"
)
endif()
add_custom_target(bpf ALL
COMMAND make
COMMAND "${CMAKE_COMMAND}" -E copy_if_different probe.o "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY src
VERBATIM)
add_custom_target(
bpf ALL
COMMAND make
COMMAND "${CMAKE_COMMAND}" -E copy_if_different probe.o "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY src
VERBATIM
)
endif()
set(BPF_SOURCES
@ -51,16 +56,16 @@ file(GLOB DRIVER_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../*.h)
list(APPEND BPF_SOURCES ${DRIVER_HEADERS})
set(INSTALL_SET "")
# Copy all needed sources under src folder in current binary dir
# and add them to the set of installed files
# Copy all needed sources under src folder in current binary dir and add them to the set of
# installed files
foreach(SOURCE IN LISTS BPF_SOURCES)
get_filename_component(FILENAME ${SOURCE} NAME)
configure_file(${SOURCE} src/${FILENAME} COPYONLY)
list(APPEND INSTALL_SET ${CMAKE_CURRENT_BINARY_DIR}/src/${FILENAME})
endforeach()
install(FILES
${INSTALL_SET}
install(
FILES ${INSTALL_SET}
DESTINATION "src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/bpf"
COMPONENT ${DRIVER_BPF_COMPONENT_NAME}
)
@ -72,16 +77,20 @@ file(GLOB configure_modules "${CMAKE_CURRENT_SOURCE_DIR}/configure/*")
foreach(subdir ${configure_modules})
if(IS_DIRECTORY "${subdir}")
file(RELATIVE_PATH CONFIGURE_MODULE "${CMAKE_CURRENT_SOURCE_DIR}/configure" "${subdir}")
configure_file(configure/${CONFIGURE_MODULE}/test.c src/configure/${CONFIGURE_MODULE}/test.c COPYONLY)
configure_file(
configure/${CONFIGURE_MODULE}/test.c src/configure/${CONFIGURE_MODULE}/test.c COPYONLY
)
configure_file(configure/Makefile src/configure/${CONFIGURE_MODULE}/Makefile COPYONLY)
configure_file(configure/build.sh src/configure/${CONFIGURE_MODULE}/build.sh COPYONLY)
configure_file(configure/Makefile.inc.in src/configure/${CONFIGURE_MODULE}/Makefile.inc)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/build.sh"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/test.c"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile.inc"
DESTINATION "src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/bpf/configure/${CONFIGURE_MODULE}"
COMPONENT ${DRIVER_BPF_COMPONENT_NAME})
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/build.sh"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/test.c"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile"
"${CMAKE_CURRENT_BINARY_DIR}/src/configure/${CONFIGURE_MODULE}/Makefile.inc"
DESTINATION
"src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/bpf/configure/${CONFIGURE_MODULE}"
COMPONENT ${DRIVER_BPF_COMPONENT_NAME}
)
endif()
endforeach()
endforeach()

View File

@ -28,7 +28,7 @@ clean:
else
KERNELDIR ?= $(CURDIR)
KERNELDIR ?= $(realpath $(objtree))
#
# Get the path of the module sources
#

View File

@ -10,102 +10,99 @@ or GPL2.txt for full copies of the license.
#ifndef __BPF_HELPERS_H
#define __BPF_HELPERS_H
static void *(*bpf_map_lookup_elem)(void *map, void *key) =
(void *)BPF_FUNC_map_lookup_elem;
static int (*bpf_map_update_elem)(void *map, void *key, void *value,
unsigned long long flags) =
(void *)BPF_FUNC_map_update_elem;
static int (*bpf_map_delete_elem)(void *map, void *key) =
(void *)BPF_FUNC_map_delete_elem;
static int (*bpf_probe_read)(void *dst, int size, void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read;
static void *(*bpf_map_lookup_elem)(void *map, void *key) = (void *)BPF_FUNC_map_lookup_elem;
static int (*bpf_map_update_elem)(void *map,
void *key,
void *value,
unsigned long long flags) = (void *)BPF_FUNC_map_update_elem;
static int (*bpf_map_delete_elem)(void *map, void *key) = (void *)BPF_FUNC_map_delete_elem;
static int (*bpf_probe_read)(void *dst, int size, void *unsafe_ptr) = (void *)BPF_FUNC_probe_read;
/* Introduced in linux 5.8, see https://github.com/torvalds/linux/commit/71d19214776e61b33da48f7c1b46e522c7f78221 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
static unsigned long long (*bpf_ktime_get_boot_ns)(void) =
(void *)BPF_FUNC_ktime_get_boot_ns;
/* Introduced in linux 5.8, see
* https://github.com/torvalds/linux/commit/71d19214776e61b33da48f7c1b46e522c7f78221 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
static unsigned long long (*bpf_ktime_get_boot_ns)(void) = (void *)BPF_FUNC_ktime_get_boot_ns;
#else
/* fallback at using old, non suspend-time aware, helper */
static unsigned long long (*bpf_ktime_get_boot_ns)(void) =
(void *)BPF_FUNC_ktime_get_ns;
static unsigned long long (*bpf_ktime_get_boot_ns)(void) = (void *)BPF_FUNC_ktime_get_ns;
#endif
static int (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
(void *)BPF_FUNC_trace_printk;
static void (*bpf_tail_call)(void *ctx, void *map, int index) =
(void *)BPF_FUNC_tail_call;
static unsigned long long (*bpf_get_smp_processor_id)(void) =
(void *)BPF_FUNC_get_smp_processor_id;
static unsigned long long (*bpf_get_current_pid_tgid)(void) =
(void *)BPF_FUNC_get_current_pid_tgid;
static unsigned long long (*bpf_get_current_uid_gid)(void) =
(void *)BPF_FUNC_get_current_uid_gid;
static int (*bpf_get_current_comm)(void *buf, int buf_size) =
(void *)BPF_FUNC_get_current_comm;
static int (*bpf_perf_event_read)(void *map, int index) =
(void *)BPF_FUNC_perf_event_read;
static int (*bpf_clone_redirect)(void *ctx, int ifindex, int flags) =
(void *)BPF_FUNC_clone_redirect;
static int (*bpf_redirect)(int ifindex, int flags) =
(void *)BPF_FUNC_redirect;
static int (*bpf_perf_event_output)(void *ctx, void *map,
unsigned long long flags, void *data,
int size) =
(void *)BPF_FUNC_perf_event_output;
static int (*bpf_get_stackid)(void *ctx, void *map, int flags) =
(void *)BPF_FUNC_get_stackid;
static int (*bpf_probe_write_user)(void *dst, void *src, int size) =
(void *)BPF_FUNC_probe_write_user;
static int (*bpf_current_task_under_cgroup)(void *map, int index) =
(void *)BPF_FUNC_current_task_under_cgroup;
static int (*bpf_skb_get_tunnel_key)(void *ctx, void *key, int size, int flags) =
(void *)BPF_FUNC_skb_get_tunnel_key;
static int (*bpf_skb_set_tunnel_key)(void *ctx, void *key, int size, int flags) =
(void *)BPF_FUNC_skb_set_tunnel_key;
static int (*bpf_skb_get_tunnel_opt)(void *ctx, void *md, int size) =
(void *)BPF_FUNC_skb_get_tunnel_opt;
static int (*bpf_skb_set_tunnel_opt)(void *ctx, void *md, int size) =
(void *)BPF_FUNC_skb_set_tunnel_opt;
static unsigned long long (*bpf_get_prandom_u32)(void) =
(void *)BPF_FUNC_get_prandom_u32;
static int (*bpf_xdp_adjust_head)(void *ctx, int offset) =
(void *)BPF_FUNC_xdp_adjust_head;
static int (*bpf_probe_read_str)(void *dst, uint64_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_str;
static int (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) = (void *)BPF_FUNC_trace_printk;
static void (*bpf_tail_call)(void *ctx, void *map, int index) = (void *)BPF_FUNC_tail_call;
static unsigned long long (*bpf_get_smp_processor_id)(void) = (void *)BPF_FUNC_get_smp_processor_id;
static unsigned long long (*bpf_get_current_pid_tgid)(void) = (void *)BPF_FUNC_get_current_pid_tgid;
static unsigned long long (*bpf_get_current_uid_gid)(void) = (void *)BPF_FUNC_get_current_uid_gid;
static int (*bpf_get_current_comm)(void *buf, int buf_size) = (void *)BPF_FUNC_get_current_comm;
static int (*bpf_perf_event_read)(void *map, int index) = (void *)BPF_FUNC_perf_event_read;
static int (*bpf_clone_redirect)(void *ctx,
int ifindex,
int flags) = (void *)BPF_FUNC_clone_redirect;
static int (*bpf_redirect)(int ifindex, int flags) = (void *)BPF_FUNC_redirect;
static int (*bpf_perf_event_output)(void *ctx,
void *map,
unsigned long long flags,
void *data,
int size) = (void *)BPF_FUNC_perf_event_output;
static int (*bpf_get_stackid)(void *ctx, void *map, int flags) = (void *)BPF_FUNC_get_stackid;
static int (*bpf_probe_write_user)(void *dst,
void *src,
int size) = (void *)BPF_FUNC_probe_write_user;
static int (*bpf_current_task_under_cgroup)(void *map,
int index) = (void *)BPF_FUNC_current_task_under_cgroup;
static int (*bpf_skb_get_tunnel_key)(void *ctx, void *key, int size, int flags) = (void *)
BPF_FUNC_skb_get_tunnel_key;
static int (*bpf_skb_set_tunnel_key)(void *ctx, void *key, int size, int flags) = (void *)
BPF_FUNC_skb_set_tunnel_key;
static int (*bpf_skb_get_tunnel_opt)(void *ctx,
void *md,
int size) = (void *)BPF_FUNC_skb_get_tunnel_opt;
static int (*bpf_skb_set_tunnel_opt)(void *ctx,
void *md,
int size) = (void *)BPF_FUNC_skb_set_tunnel_opt;
static unsigned long long (*bpf_get_prandom_u32)(void) = (void *)BPF_FUNC_get_prandom_u32;
static int (*bpf_xdp_adjust_head)(void *ctx, int offset) = (void *)BPF_FUNC_xdp_adjust_head;
static int (*bpf_probe_read_str)(void *dst,
uint64_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read_str;
#if defined(USE_BPF_PROBE_KERNEL_USER_VARIANTS)
static int (*bpf_probe_read_user)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_user;
static int (*bpf_probe_read_kernel)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_kernel;
static int (*bpf_probe_read_user_str)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_user_str;
static int (*bpf_probe_read_kernel_str)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_kernel_str;
static int (*bpf_probe_read_user)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read_user;
static int (*bpf_probe_read_kernel)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read_kernel;
static int (*bpf_probe_read_user_str)(void *dst, uint32_t size, const void *unsafe_ptr) = (void *)
BPF_FUNC_probe_read_user_str;
static int (*bpf_probe_read_kernel_str)(void *dst, uint32_t size, const void *unsafe_ptr) = (void *)
BPF_FUNC_probe_read_kernel_str;
#else
static int (*bpf_probe_read_user)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_kernel)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_user_str)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_str;
static int (*bpf_probe_read_kernel_str)(void *dst, uint32_t size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_str;
static int (*bpf_probe_read_user)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_kernel)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_user_str)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read_str;
static int (*bpf_probe_read_kernel_str)(void *dst,
uint32_t size,
const void *unsafe_ptr) = (void *)BPF_FUNC_probe_read_str;
#endif
static uint64_t (*bpf_get_current_task)(void) =
(void *)BPF_FUNC_get_current_task;
static int (*bpf_skb_load_bytes)(void *ctx, int off, void *to, int len) =
(void *)BPF_FUNC_skb_load_bytes;
static int (*bpf_skb_store_bytes)(void *ctx, int off, void *from, int len, int flags) =
(void *)BPF_FUNC_skb_store_bytes;
static int (*bpf_l3_csum_replace)(void *ctx, int off, int from, int to, int flags) =
(void *)BPF_FUNC_l3_csum_replace;
static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flags) =
(void *)BPF_FUNC_l4_csum_replace;
static int (*bpf_skb_under_cgroup)(void *ctx, void *map, int index) =
(void *)BPF_FUNC_skb_under_cgroup;
static int (*bpf_skb_change_head)(void *, int len, int flags) =
(void *)BPF_FUNC_skb_change_head;
static uint64_t (*bpf_get_current_task)(void) = (void *)BPF_FUNC_get_current_task;
static int (*bpf_skb_load_bytes)(void *ctx, int off, void *to, int len) = (void *)
BPF_FUNC_skb_load_bytes;
static int (*bpf_skb_store_bytes)(void *ctx, int off, void *from, int len, int flags) = (void *)
BPF_FUNC_skb_store_bytes;
static int (*bpf_l3_csum_replace)(void *ctx, int off, int from, int to, int flags) = (void *)
BPF_FUNC_l3_csum_replace;
static int (*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flags) = (void *)
BPF_FUNC_l4_csum_replace;
static int (*bpf_skb_under_cgroup)(void *ctx,
void *map,
int index) = (void *)BPF_FUNC_skb_under_cgroup;
static int (*bpf_skb_change_head)(void *, int len, int flags) = (void *)BPF_FUNC_skb_change_head;
#endif

View File

@ -28,4 +28,4 @@ or GPL2.txt for full copies of the license.
#endif
#define memcpy __builtin_memcpy
#endif // __BUILTINS_H
#endif // __BUILTINS_H

View File

@ -0,0 +1,23 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (C) 2024 The Falco Authors.
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
or GPL2.txt for full copies of the license.
*/
/*
* Check that the build system is sane.
*/
#include "../../quirks.h"
#include "../../ppm_events_public.h"
#include "../../types.h"
BPF_PROBE("sanity/", sanity, sanity_args) {
return 0;
}
char __license[] __bpf_section("license") = "Dual MIT/GPL";

View File

@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (C) 2025 The Falco Authors.
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
or GPL2.txt for full copies of the license.
*/
/*
* Check that kernfs_node's field `parent` exists.
* See 6.15 kernel commit it is named __parent:
* https://github.com/torvalds/linux/commit/633488947ef66b194377411322dc9e12aab79b65
*/
#include "../../quirks.h"
#include "../../ppm_events_public.h"
#include "../../types.h"
// struct kernfs_node declaration
#include <linux/kernfs.h>
BPF_PROBE("signal/", signal_deliver, signal_deliver_args) {
struct kernfs_node *parent;
struct kernfs_node node;
parent = node.parent;
return 0;
}
char __license[] __bpf_section("license") = "Dual MIT/GPL";

View File

@ -7,7 +7,17 @@ ifeq ($(HAS_@CONFIGURE_MODULE@),0)
$(info [configure-bpf] Setting HAS_@CONFIGURE_MODULE@ flag)
KBUILD_CPPFLAGS += -DHAS_@CONFIGURE_MODULE@
else
HAS_@CONFIGURE_MODULE@_OUT := $(shell cat $(MODULE_MAKEFILE_DIR)/build.log)
HAS_@CONFIGURE_MODULE@_OUT1 := $(shell cat $(MODULE_MAKEFILE_DIR)/build.log | sed -n ':a;N;$$$!ba;s/\n/@@NEWLINE@@/g;P')
HAS_@CONFIGURE_MODULE@_OUT := $(subst @@NEWLINE@@,$(newline),$(HAS_@CONFIGURE_MODULE@_OUT1))
$(info [configure-bpf] Build output for HAS_@CONFIGURE_MODULE@:)
$(info [configure-bpf] $(HAS_@CONFIGURE_MODULE@_OUT))
endif
ifeq ('@CONFIGURE_MODULE@','0__SANITY')
ifeq ($(HAS_@CONFIGURE_MODULE@),0)
$(info [configure-bpf] Build system is sane)
else
$(info [configure-bpf] Build system is broken, please see above errors)
$(error The build system is broken, please see above errors)
endif
endif

View File

@ -10,7 +10,8 @@ or GPL2.txt for full copies of the license.
/*
* Check that mm_struct's field `rss_stat` is an array.
* See 6.2 kernel commit: https://github.com/torvalds/linux/commit/f1a7941243c102a44e8847e3b94ff4ff3ec56f25
* See 6.2 kernel commit:
* https://github.com/torvalds/linux/commit/f1a7941243c102a44e8847e3b94ff4ff3ec56f25
*/
#include "../../quirks.h"
@ -20,8 +21,7 @@ or GPL2.txt for full copies of the license.
// struct mm_struct declaration
#include <linux/mm_types.h>
BPF_PROBE("signal/", signal_deliver, signal_deliver_args)
{
BPF_PROBE("signal/", signal_deliver, signal_deliver_args) {
long val;
struct mm_struct *mm;
val = mm->rss_stat[0].count;

View File

@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (C) 2024 The Falco Authors.
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
or GPL2.txt for full copies of the license.
*/
/*
* Check that the `pids` field is defined in the `task_struct` struct.
* Since kernel version 4.19.0 the `pids` field is moved in the `signal_struct` struct, but this
* change has been backported to older kernels.
*/
#include "../../quirks.h"
#include "../../ppm_events_public.h"
#include "../../types.h"
BPF_PROBE("signal/", signal_deliver, signal_deliver_args) {
struct task_struct *task = (struct task_struct *)0;
if(task->pids) {
return 1;
}
return 0;
}
char __license[] __bpf_section("license") = "Dual MIT/GPL";

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,92 +22,92 @@ struct bpf_map_def {
#ifdef __KERNEL__
struct bpf_map_def __bpf_section("maps") perf_map = {
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = 0,
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = 0,
};
struct bpf_map_def __bpf_section("maps") tail_map = {
.type = BPF_MAP_TYPE_PROG_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = PPM_FILLER_MAX,
.type = BPF_MAP_TYPE_PROG_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = PPM_FILLER_MAX,
};
struct bpf_map_def __bpf_section("maps") syscall_table = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct syscall_evt_pair),
.max_entries = SYSCALL_TABLE_SIZE,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct syscall_evt_pair),
.max_entries = SYSCALL_TABLE_SIZE,
};
struct bpf_map_def __bpf_section("maps") event_info_table = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct ppm_event_info),
.max_entries = PPM_EVENT_MAX,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct ppm_event_info),
.max_entries = PPM_EVENT_MAX,
};
struct bpf_map_def __bpf_section("maps") fillers_table = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct ppm_event_entry),
.max_entries = PPM_EVENT_MAX,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct ppm_event_entry),
.max_entries = PPM_EVENT_MAX,
};
struct bpf_map_def __bpf_section("maps") frame_scratch_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = SCRATCH_SIZE,
.max_entries = 0,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = SCRATCH_SIZE,
.max_entries = 0,
};
struct bpf_map_def __bpf_section("maps") tmp_scratch_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = SCRATCH_SIZE,
.max_entries = 0,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = SCRATCH_SIZE,
.max_entries = 0,
};
struct bpf_map_def __bpf_section("maps") settings_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct scap_bpf_settings),
.max_entries = 1,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct scap_bpf_settings),
.max_entries = 1,
};
struct bpf_map_def __bpf_section("maps") local_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct scap_bpf_per_cpu_state),
.max_entries = 0,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct scap_bpf_per_cpu_state),
.max_entries = 0,
};
struct bpf_map_def __bpf_section("maps") interesting_syscalls_table = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(bool),
.max_entries = SYSCALL_TABLE_SIZE,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(bool),
.max_entries = SYSCALL_TABLE_SIZE,
};
// The key is the 32-bit syscall code while the value is 64-bit one
struct bpf_map_def __bpf_section("maps") ia32_64_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = SYSCALL_TABLE_SIZE,
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(uint32_t),
.value_size = sizeof(uint32_t),
.max_entries = SYSCALL_TABLE_SIZE,
};
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
struct bpf_map_def __bpf_section("maps") stash_map = {
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(uint64_t),
.value_size = sizeof(struct sys_stash_args),
.max_entries = 65535,
.type = BPF_MAP_TYPE_HASH,
.key_size = sizeof(uint64_t),
.value_size = sizeof(struct sys_stash_args),
.max_entries = 65535,
};
#endif
#endif // __KERNEL__
#endif // __KERNEL__
#endif

View File

@ -10,45 +10,14 @@ or GPL2.txt for full copies of the license.
#ifndef __BPF_MISSING_DEFINITIONS_H__
#define __BPF_MISSING_DEFINITIONS_H__
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
struct ovl_entry {
union {
struct {
unsigned long has_upper;
bool opaque;
};
struct rcu_head rcu;
};
unsigned numlower;
struct path lowerstack[];
};
#else
struct ovl_entry {
union {
struct {
unsigned long flags;
};
struct rcu_head rcu;
};
unsigned numlower;
//struct ovl_path lowerstack[];
};
enum ovl_entry_flag {
OVL_E_UPPER_ALIAS,
OVL_E_OPAQUE,
OVL_E_CONNECTED,
};
#endif
#include <linux/mount.h>
/* This require the inlclude `linux/mount.h` for `vfsmount` definition */
struct mount {
struct hlist_node mnt_hash;
struct mount *mnt_parent;
struct dentry *mnt_mountpoint;
struct vfsmount mnt;
// ...
struct hlist_node mnt_hash;
struct mount *mnt_parent;
struct dentry *mnt_mountpoint;
struct vfsmount mnt;
// ...
};
#endif /*__BPF_MISSING_DEFINITIONS_H__*/

View File

@ -18,65 +18,63 @@ or GPL2.txt for full copies of the license.
#include "builtins.h"
#include "socketcall_to_syscall.h"
#define _READ(P) ({ typeof(P) _val; \
bpf_probe_read_kernel(&_val, sizeof(_val), &P); \
_val; \
})
#define _READ(P) \
({ \
typeof(P) _val; \
bpf_probe_read_kernel(&_val, sizeof(_val), &P); \
_val; \
})
#define _READ_KERNEL(P) _READ(P)
#define _READ_USER(P) ({ typeof(P) _val; \
bpf_probe_read_user(&_val, sizeof(_val), &P); \
_val; \
})
#define _READ_USER(P) \
({ \
typeof(P) _val; \
bpf_probe_read_user(&_val, sizeof(_val), &P); \
_val; \
})
#ifdef BPF_DEBUG
#define bpf_printk(fmt, ...) \
do { \
char s[] = fmt; \
bpf_trace_printk(s, sizeof(s), ##__VA_ARGS__); \
} while (0)
#define bpf_printk(fmt, ...) \
do { \
char s[] = fmt; \
bpf_trace_printk(s, sizeof(s), ##__VA_ARGS__); \
} while(0)
#else
#define bpf_printk(fmt, ...)
#endif
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
static __always_inline int __stash_args(unsigned long long id,
unsigned long *args)
{
static __always_inline int __stash_args(unsigned long long id, unsigned long *args) {
int ret = bpf_map_update_elem(&stash_map, &id, args, BPF_ANY);
if (ret)
if(ret)
bpf_printk("error stashing arguments for %d:%d\n", id, ret);
return ret;
}
static __always_inline int stash_args(unsigned long *args)
{
static __always_inline int stash_args(unsigned long *args) {
unsigned long long id = bpf_get_current_pid_tgid() & 0xffffffff;
return __stash_args(id, args);
}
static __always_inline unsigned long *__unstash_args(unsigned long long id)
{
static __always_inline unsigned long *__unstash_args(unsigned long long id) {
struct sys_stash_args *args;
args = bpf_map_lookup_elem(&stash_map, &id);
if (!args)
if(!args)
return NULL;
return args->args;
}
static __always_inline unsigned long *unstash_args(void)
{
static __always_inline unsigned long *unstash_args(void) {
unsigned long long id = bpf_get_current_pid_tgid() & 0xffffffff;
return __unstash_args(id);
}
static __always_inline void delete_args(void)
{
static __always_inline void delete_args(void) {
unsigned long long id = bpf_get_current_pid_tgid() & 0xffffffff;
bpf_map_delete_elem(&stash_map, &id);
@ -85,15 +83,13 @@ static __always_inline void delete_args(void)
/* Can be called just from an exit event
*/
static __always_inline long bpf_syscall_get_retval(void *ctx)
{
static __always_inline long bpf_syscall_get_retval(void *ctx) {
struct sys_exit_args *args = (struct sys_exit_args *)ctx;
return args->ret;
}
static __always_inline bool bpf_in_ia32_syscall()
{
static __always_inline bool bpf_in_ia32_syscall() {
struct task_struct *task = (struct task_struct *)bpf_get_current_task();
uint32_t status = 0;
@ -160,8 +156,7 @@ static __always_inline bool bpf_in_ia32_syscall()
/* Can be called from both enter and exit event, id is at the same
* offset in both struct sys_enter_args and struct sys_exit_args
*/
static __always_inline long bpf_syscall_get_nr(void *ctx)
{
static __always_inline long bpf_syscall_get_nr(void *ctx) {
struct sys_enter_args *args = (struct sys_enter_args *)ctx;
long id = 0;
@ -173,14 +168,14 @@ static __always_inline long bpf_syscall_get_nr(void *ctx)
/* See here for the definition:
* https://github.com/torvalds/linux/blob/69cb6c6556ad89620547318439d6be8bb1629a5a/arch/x86/include/asm/syscall.h#L40
*/
*/
id = _READ(regs->orig_ax);
#elif CONFIG_ARM64
/* See here for the definition:
* https://github.com/torvalds/linux/blob/69cb6c6556ad89620547318439d6be8bb1629a5a/arch/arm64/include/asm/syscall.h#L23
*/
*/
id = _READ(regs->syscallno);
#elif CONFIG_S390
@ -211,12 +206,10 @@ static __always_inline long bpf_syscall_get_nr(void *ctx)
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
static __always_inline unsigned long bpf_syscall_get_argument_from_args(unsigned long *args,
int idx)
{
int idx) {
unsigned long arg = 0;
if(idx <= 5)
{
if(idx <= 5) {
arg = args[idx];
}
@ -224,9 +217,7 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_args(unsigned
}
#endif
static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx,
int idx)
{
static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx, int idx) {
unsigned long arg = 0;
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
@ -235,9 +226,8 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
struct pt_regs *regs = (struct pt_regs *)args->regs;
#ifdef CONFIG_X86_64
if (bpf_in_ia32_syscall())
{
switch (idx) {
if(bpf_in_ia32_syscall()) {
switch(idx) {
case 0:
arg = _READ(regs->bx);
break;
@ -265,7 +255,7 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
/* See here for the definition:
* https://github.com/libbpf/libbpf/blob/master/src/bpf_tracing.h#L75-L87
*/
switch (idx) {
switch(idx) {
case 0:
arg = _READ(regs->di);
break;
@ -291,10 +281,10 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
#elif CONFIG_ARM64
/* See here for the definition:
* https://github.com/libbpf/libbpf/blob/master/src/bpf_tracing.h#L166-L178
* https://github.com/libbpf/libbpf/blob/master/src/bpf_tracing.h#L166-L178
*/
struct user_pt_regs *user_regs = (struct user_pt_regs *)args->regs;
switch (idx) {
switch(idx) {
case 0:
arg = _READ(regs->orig_x0);
break;
@ -310,12 +300,12 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
}
#elif CONFIG_S390
/* See here for the definition:
* https://github.com/libbpf/libbpf/blob/master/src/bpf_tracing.h#L132-L144
*/
user_pt_regs *user_regs = (user_pt_regs *)args->regs;
switch (idx) {
switch(idx) {
case 0:
arg = _READ(regs->orig_gpr2);
break;
@ -324,7 +314,7 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
case 3:
case 4:
case 5:
arg = _READ(user_regs->gprs[idx+2]);
arg = _READ(user_regs->gprs[idx + 2]);
break;
default:
arg = 0;
@ -335,7 +325,7 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
/* See here for the definition:
* https://github.com/libbpf/libbpf/blob/master/src/bpf_tracing.h#L290-L306
*/
switch (idx) {
switch(idx) {
case 0:
arg = _READ(regs->orig_gpr3);
break;
@ -344,7 +334,7 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
case 3:
case 4:
case 5:
arg = _READ(regs->gpr[idx+3]);
arg = _READ(regs->gpr[idx + 3]);
break;
default:
arg = 0;
@ -355,41 +345,40 @@ static __always_inline unsigned long bpf_syscall_get_argument_from_ctx(void *ctx
#else
unsigned long *args = unstash_args();
if (args)
if(args)
arg = bpf_syscall_get_argument_from_args(args, idx);
else
arg = 0;
#endif /* BPF_SUPPORTS_RAW_TRACEPOINTS */
return arg;
}
static __always_inline unsigned long bpf_syscall_get_socketcall_arg(void *ctx, int idx)
{
static __always_inline unsigned long bpf_syscall_get_socketcall_arg(void *ctx, int idx) {
unsigned long arg = 0;
unsigned long args_pointer = 0;
args_pointer = bpf_syscall_get_argument_from_ctx(ctx, 1);
if (bpf_in_ia32_syscall())
{
bpf_probe_read_user(&arg, sizeof(uint32_t), (void*)(args_pointer + (idx * sizeof(uint32_t))));
}
else
{
bpf_probe_read_user(&arg, sizeof(unsigned long), (void*)(args_pointer + (idx * sizeof(unsigned long))));
if(bpf_in_ia32_syscall()) {
bpf_probe_read_user(&arg,
sizeof(uint32_t),
(void *)(args_pointer + (idx * sizeof(uint32_t))));
} else {
bpf_probe_read_user(&arg,
sizeof(unsigned long),
(void *)(args_pointer + (idx * sizeof(unsigned long))));
}
return arg;
}
static __always_inline unsigned long bpf_syscall_get_argument(struct filler_data *data,
int idx)
{
static __always_inline unsigned long bpf_syscall_get_argument(struct filler_data *data, int idx) {
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
// We define it here because we support socket calls only on kernels with BPF_SUPPORTS_RAW_TRACEPOINTS
// `data->state->tail_ctx.socketcall_syscall_id != -1` just to improve perf
if(data->state->tail_ctx.socketcall_syscall_id != -1 && bpf_syscall_get_nr(data->ctx) == data->state->tail_ctx.socketcall_syscall_id)
{
// We define it here because we support socket calls only on kernels with
// BPF_SUPPORTS_RAW_TRACEPOINTS `data->state->tail_ctx.socketcall_syscall_id != -1` just to
// improve perf
if(data->state->tail_ctx.socketcall_syscall_id != -1 &&
bpf_syscall_get_nr(data->ctx) == data->state->tail_ctx.socketcall_syscall_id) {
return bpf_syscall_get_socketcall_arg(data->ctx, idx);
}
return bpf_syscall_get_argument_from_ctx(data->ctx, idx);
@ -398,45 +387,39 @@ static __always_inline unsigned long bpf_syscall_get_argument(struct filler_data
#endif
}
static __always_inline char *get_frame_scratch_area(unsigned int cpu)
{
static __always_inline char *get_frame_scratch_area(unsigned int cpu) {
char *scratchp;
scratchp = bpf_map_lookup_elem(&frame_scratch_map, &cpu);
if (!scratchp)
if(!scratchp)
bpf_printk("frame scratch NULL\n");
return scratchp;
}
static __always_inline char *get_tmp_scratch_area(unsigned int cpu)
{
static __always_inline char *get_tmp_scratch_area(unsigned int cpu) {
char *scratchp;
scratchp = bpf_map_lookup_elem(&tmp_scratch_map, &cpu);
if (!scratchp)
if(!scratchp)
bpf_printk("tmp scratch NULL\n");
return scratchp;
}
static __always_inline const struct syscall_evt_pair *get_syscall_info(int id)
{
const struct syscall_evt_pair *p =
bpf_map_lookup_elem(&syscall_table, &id);
static __always_inline const struct syscall_evt_pair *get_syscall_info(int id) {
const struct syscall_evt_pair *p = bpf_map_lookup_elem(&syscall_table, &id);
if (!p)
if(!p)
bpf_printk("no syscall_info for %d\n", id);
return p;
}
static __always_inline bool is_syscall_interesting(int id)
{
static __always_inline bool is_syscall_interesting(int id) {
bool *enabled = bpf_map_lookup_elem(&interesting_syscalls_table, &id);
if (!enabled)
{
if(!enabled) {
bpf_printk("no syscall_info for %d\n", id);
return false;
}
@ -444,12 +427,10 @@ static __always_inline bool is_syscall_interesting(int id)
return *enabled;
}
static __always_inline int convert_ia32_to_64(int id)
{
static __always_inline int convert_ia32_to_64(int id) {
int *x64_id = bpf_map_lookup_elem(&ia32_64_map, &id);
if (!x64_id)
{
if(!x64_id) {
bpf_printk("no 64bit mapped value for %d\n", id);
return -1;
}
@ -457,54 +438,49 @@ static __always_inline int convert_ia32_to_64(int id)
return *x64_id;
}
static __always_inline const struct ppm_event_info *get_event_info(ppm_event_code event_type)
{
const struct ppm_event_info *e =
bpf_map_lookup_elem(&event_info_table, &event_type);
static __always_inline const struct ppm_event_info *get_event_info(ppm_event_code event_type) {
const struct ppm_event_info *e = bpf_map_lookup_elem(&event_info_table, &event_type);
if (!e)
if(!e)
bpf_printk("no event info for %d\n", event_type);
return e;
}
static __always_inline const struct ppm_event_entry *get_event_filler_info(ppm_event_code event_type)
{
static __always_inline const struct ppm_event_entry *get_event_filler_info(
ppm_event_code event_type) {
const struct ppm_event_entry *e;
e = bpf_map_lookup_elem(&fillers_table, &event_type);
if (!e)
if(!e)
bpf_printk("no filler info for %d\n", event_type);
return e;
}
static __always_inline struct scap_bpf_settings *get_bpf_settings(void)
{
static __always_inline struct scap_bpf_settings *get_bpf_settings(void) {
struct scap_bpf_settings *settings;
int id = 0;
settings = bpf_map_lookup_elem(&settings_map, &id);
if (!settings)
if(!settings)
bpf_printk("settings NULL\n");
return settings;
}
static __always_inline struct scap_bpf_per_cpu_state *get_local_state(unsigned int cpu)
{
static __always_inline struct scap_bpf_per_cpu_state *get_local_state(unsigned int cpu) {
struct scap_bpf_per_cpu_state *state;
state = bpf_map_lookup_elem(&local_state_map, &cpu);
if (!state)
if(!state)
bpf_printk("state NULL\n");
return state;
}
static __always_inline bool acquire_local_state(struct scap_bpf_per_cpu_state *state)
{
if (state->in_use) {
static __always_inline bool acquire_local_state(struct scap_bpf_per_cpu_state *state) {
if(state->in_use) {
bpf_printk("acquire_local_state: already in use\n");
return false;
}
@ -513,9 +489,8 @@ static __always_inline bool acquire_local_state(struct scap_bpf_per_cpu_state *s
return true;
}
static __always_inline bool release_local_state(struct scap_bpf_per_cpu_state *state)
{
if (!state->in_use) {
static __always_inline bool release_local_state(struct scap_bpf_per_cpu_state *state) {
if(!state->in_use) {
bpf_printk("release_local_state: already not in use\n");
return false;
}
@ -524,44 +499,41 @@ static __always_inline bool release_local_state(struct scap_bpf_per_cpu_state *s
return true;
}
static __always_inline int init_filler_data(void *ctx,
struct filler_data *data,
bool is_syscall)
{
static __always_inline int init_filler_data(void *ctx, struct filler_data *data, bool is_syscall) {
unsigned int cpu;
data->ctx = ctx;
data->settings = get_bpf_settings();
if (!data->settings)
if(!data->settings)
return PPM_FAILURE_BUG;
cpu = bpf_get_smp_processor_id();
data->buf = get_frame_scratch_area(cpu);
if (!data->buf)
if(!data->buf)
return PPM_FAILURE_BUG;
data->state = get_local_state(cpu);
if (!data->state)
if(!data->state)
return PPM_FAILURE_BUG;
data->tmp_scratch = get_tmp_scratch_area(cpu);
if (!data->tmp_scratch)
if(!data->tmp_scratch)
return PPM_FAILURE_BUG;
data->evt = get_event_info(data->state->tail_ctx.evt_type);
if (!data->evt)
if(!data->evt)
return PPM_FAILURE_BUG;
data->filler_info = get_event_filler_info(data->state->tail_ctx.evt_type);
if (!data->filler_info)
if(!data->filler_info)
return PPM_FAILURE_BUG;
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
if (is_syscall) {
if(is_syscall) {
data->args = unstash_args();
if (!data->args)
if(!data->args)
return PPM_SKIP_EVENT;
}
#endif
@ -572,17 +544,14 @@ static __always_inline int init_filler_data(void *ctx,
return PPM_SUCCESS;
}
static __always_inline int bpf_test_bit(int nr, unsigned long *addr)
{
static __always_inline int bpf_test_bit(int nr, unsigned long *addr) {
return 1UL & (_READ(addr[BIT_WORD(nr)]) >> (nr & (BITS_PER_LONG - 1)));
}
#if defined(CAPTURE_SCHED_PROC_FORK) || defined(CAPTURE_SCHED_PROC_EXEC)
static __always_inline bool bpf_drop_syscall_exit_events(void *ctx, ppm_event_code evt_type)
{
static __always_inline bool bpf_drop_syscall_exit_events(void *ctx, ppm_event_code evt_type) {
long ret = 0;
switch (evt_type)
{
switch(evt_type) {
/* On s390x, clone and fork child events will be generated but
* due to page faults, no args/envp information will be collected.
* Also no child events appear for clone3 syscall.
@ -591,48 +560,47 @@ static __always_inline bool bpf_drop_syscall_exit_events(void *ctx, ppm_event_co
* let proactively ignore them.
*/
#ifdef CAPTURE_SCHED_PROC_FORK
case PPME_SYSCALL_CLONE_20_X:
case PPME_SYSCALL_FORK_20_X:
case PPME_SYSCALL_VFORK_20_X:
case PPME_SYSCALL_CLONE3_X:
ret = bpf_syscall_get_retval(ctx);
/* We ignore only child events, so ret == 0! */
return ret == 0;
case PPME_SYSCALL_CLONE_20_X:
case PPME_SYSCALL_FORK_20_X:
case PPME_SYSCALL_VFORK_20_X:
case PPME_SYSCALL_CLONE3_X:
ret = bpf_syscall_get_retval(ctx);
/* We ignore only child events, so ret == 0! */
return ret == 0;
#endif
/* If `CAPTURE_SCHED_PROC_EXEC` logic is enabled we collect execve-family
* exit events through a dedicated tracepoint so we can ignore them here.
*/
#ifdef CAPTURE_SCHED_PROC_EXEC
case PPME_SYSCALL_EXECVE_19_X:
case PPME_SYSCALL_EXECVEAT_X:
ret = bpf_syscall_get_retval(ctx);
/* We ignore only successful events, so ret == 0! */
return ret == 0;
case PPME_SYSCALL_EXECVE_19_X:
case PPME_SYSCALL_EXECVEAT_X:
ret = bpf_syscall_get_retval(ctx);
/* We ignore only successful events, so ret == 0! */
return ret == 0;
#endif
default:
break;
default:
break;
}
return false;
}
#endif
static __always_inline bool drop_event(void *ctx,
struct scap_bpf_per_cpu_state *state,
ppm_event_code evt_type,
struct scap_bpf_settings *settings,
enum syscall_flags drop_flags)
{
if (!settings->dropping_mode)
struct scap_bpf_per_cpu_state *state,
ppm_event_code evt_type,
struct scap_bpf_settings *settings,
enum syscall_flags drop_flags) {
if(!settings->dropping_mode)
return false;
switch (evt_type) {
switch(evt_type) {
case PPME_SYSCALL_CLOSE_X:
case PPME_SOCKET_BIND_X: {
long ret = bpf_syscall_get_retval(ctx);
if (ret < 0)
if(ret < 0)
return true;
break;
@ -647,30 +615,30 @@ static __always_inline bool drop_event(void *ctx,
int max_fds;
close_fd = bpf_syscall_get_argument_from_ctx(ctx, 0);
if (close_fd < 0)
if(close_fd < 0)
return true;
task = (struct task_struct *)bpf_get_current_task();
if (!task)
if(!task)
break;
files = _READ(task->files);
if (!files)
if(!files)
break;
fdt = _READ(files->fdt);
if (!fdt)
if(!fdt)
break;
max_fds = _READ(fdt->max_fds);
if (close_fd >= max_fds)
if(close_fd >= max_fds)
return true;
open_fds = _READ(fdt->open_fds);
if (!open_fds)
if(!open_fds)
break;
if (!bpf_test_bit(close_fd, open_fds))
if(!bpf_test_bit(close_fd, open_fds))
return true;
break;
@ -679,7 +647,7 @@ static __always_inline bool drop_event(void *ctx,
case PPME_SYSCALL_FCNTL_X: {
long cmd = bpf_syscall_get_argument_from_ctx(ctx, 1);
if (cmd != F_DUPFD && cmd != F_DUPFD_CLOEXEC)
if(cmd != F_DUPFD && cmd != F_DUPFD_CLOEXEC)
return true;
break;
@ -688,15 +656,14 @@ static __always_inline bool drop_event(void *ctx,
break;
}
if (drop_flags & UF_NEVER_DROP)
if(drop_flags & UF_NEVER_DROP)
return false;
if (drop_flags & UF_ALWAYS_DROP)
if(drop_flags & UF_ALWAYS_DROP)
return true;
if (state->tail_ctx.ts % 1000000000 >= 1000000000 /
settings->sampling_ratio) {
if (!settings->is_dropping) {
if(state->tail_ctx.ts % 1000000000 >= 1000000000 / settings->sampling_ratio) {
if(!settings->is_dropping) {
settings->is_dropping = true;
state->tail_ctx.evt_type = PPME_DROP_E;
return false;
@ -705,7 +672,7 @@ static __always_inline bool drop_event(void *ctx,
return true;
}
if (settings->is_dropping) {
if(settings->is_dropping) {
settings->is_dropping = false;
state->tail_ctx.evt_type = PPME_DROP_X;
return false;
@ -715,9 +682,8 @@ static __always_inline bool drop_event(void *ctx,
}
static __always_inline void reset_tail_ctx(struct scap_bpf_per_cpu_state *state,
ppm_event_code evt_type,
unsigned long long ts)
{
ppm_event_code evt_type,
unsigned long long ts) {
state->tail_ctx.evt_type = evt_type;
state->tail_ctx.ts = ts;
state->tail_ctx.curarg = 0;
@ -727,11 +693,10 @@ static __always_inline void reset_tail_ctx(struct scap_bpf_per_cpu_state *state,
}
static __always_inline void call_filler(void *ctx,
void *stack_ctx,
ppm_event_code evt_type,
enum syscall_flags drop_flags,
int socketcall_syscall_id)
{
void *stack_ctx,
ppm_event_code evt_type,
enum syscall_flags drop_flags,
int socketcall_syscall_id) {
struct scap_bpf_settings *settings;
const struct ppm_event_entry *filler_info;
struct scap_bpf_per_cpu_state *state;
@ -742,17 +707,17 @@ static __always_inline void call_filler(void *ctx,
cpu = bpf_get_smp_processor_id();
state = get_local_state(cpu);
if (!state)
if(!state)
return;
settings = get_bpf_settings();
if (!settings)
if(!settings)
return;
if (!acquire_local_state(state))
if(!acquire_local_state(state))
return;
if (cpu == 0 && state->hotplug_cpu != 0) {
if(cpu == 0 && state->hotplug_cpu != 0) {
evt_type = PPME_CPU_HOTPLUG_E;
drop_flags = UF_NEVER_DROP;
}
@ -761,7 +726,7 @@ static __always_inline void call_filler(void *ctx,
reset_tail_ctx(state, evt_type, ts);
/* drop_event can change state->tail_ctx.evt_type */
if (drop_event(stack_ctx, state, evt_type, settings, drop_flags))
if(drop_event(stack_ctx, state, evt_type, settings, drop_flags))
goto cleanup;
++state->n_evts;
@ -769,21 +734,20 @@ static __always_inline void call_filler(void *ctx,
state->tail_ctx.socketcall_syscall_id = socketcall_syscall_id;
filler_info = get_event_filler_info(state->tail_ctx.evt_type);
if (!filler_info)
if(!filler_info)
goto cleanup;
bpf_tail_call(ctx, &tail_map, filler_info->filler_id);
bpf_printk("Can't tail call filler evt=%d, filler=%d\n",
state->tail_ctx.evt_type,
filler_info->filler_id);
state->tail_ctx.evt_type,
filler_info->filler_id);
cleanup:
release_local_state(state);
}
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
static __always_inline long convert_network_syscalls(void *ctx, bool *is_syscall)
{
static __always_inline long convert_network_syscalls(void *ctx, bool *is_syscall) {
int socketcall_id = (int)bpf_syscall_get_argument_from_ctx(ctx, 0);
return socketcall_code_to_syscall_code(socketcall_id, is_syscall);
}

View File

@ -14,7 +14,6 @@ or GPL2.txt for full copies of the license.
#if __has_include(<asm/rwonce.h>)
#include <asm/rwonce.h>
#endif
#include <linux/sched.h>
#include "driver_config.h"
#include "ppm_events_public.h"
@ -29,8 +28,7 @@ or GPL2.txt for full copies of the license.
#define __NR_ia32_socketcall 102
BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
{
BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args) {
const struct syscall_evt_pair *sc_evt = NULL;
ppm_event_code evt_type = -1;
int drop_flags = 0;
@ -39,59 +37,47 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
int socketcall_syscall_id = -1;
id = bpf_syscall_get_nr(ctx);
if (id < 0 || id >= SYSCALL_TABLE_SIZE)
if(id < 0 || id >= SYSCALL_TABLE_SIZE)
return 0;
if (bpf_in_ia32_syscall())
{
// Right now we support 32-bit emulation only on x86.
// We try to convert the 32-bit id into the 64-bit one.
if(bpf_in_ia32_syscall()) {
// Right now we support 32-bit emulation only on x86.
// We try to convert the 32-bit id into the 64-bit one.
#if defined(CONFIG_X86_64) && defined(CONFIG_IA32_EMULATION)
if (id == __NR_ia32_socketcall)
{
if(id == __NR_ia32_socketcall) {
socketcall_syscall_id = __NR_ia32_socketcall;
}
else
{
} else {
id = convert_ia32_to_64(id);
// syscalls defined only on 32 bits are dropped here.
if(id == -1)
{
if(id == -1) {
return 0;
}
}
#else
// Unsupported arch
return 0;
#endif
}
else
{
// Right now only s390x supports it
#endif
} else {
// Right now only s390x supports it
#ifdef __NR_socketcall
socketcall_syscall_id = __NR_socketcall;
#endif
}
// Now all syscalls on 32-bit should be converted to 64-bit apart from `socketcall`.
// This one deserves a special treatment
if(id == socketcall_syscall_id)
{
if(id == socketcall_syscall_id) {
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
bool is_syscall_return = false;
int return_code = convert_network_syscalls(ctx, &is_syscall_return);
if (return_code == -1)
{
if(return_code == -1) {
// Wrong SYS_ argument passed. Drop the syscall.
return 0;
}
if(!is_syscall_return)
{
if(!is_syscall_return) {
evt_type = return_code;
drop_flags = UF_USED;
}
else
{
} else {
id = return_code;
}
#else
@ -105,11 +91,9 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
// There could be cases in which we have a `PPME_SOCKET_SEND_E` event
// and`id=__NR_ia32_socketcall`...We resolved the correct event type but we cannot
// update the `id`.
if (evt_type == -1)
{
if(evt_type == -1) {
enabled = is_syscall_interesting(id);
if(!enabled)
{
if(!enabled) {
return 0;
}
@ -117,19 +101,15 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
if(!sc_evt)
return 0;
if(sc_evt->flags & UF_USED)
{
if(sc_evt->flags & UF_USED) {
evt_type = sc_evt->enter_event_type;
drop_flags = sc_evt->flags;
}
else
{
} else {
evt_type = PPME_GENERIC_E;
drop_flags = UF_ALWAYS_DROP;
}
}
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
call_filler(ctx, ctx, evt_type, drop_flags, socketcall_syscall_id);
#else
@ -137,7 +117,7 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
struct sys_enter_args stack_ctx;
memcpy(stack_ctx.args, ctx->args, sizeof(ctx->args));
if (stash_args(stack_ctx.args))
if(stash_args(stack_ctx.args))
return 0;
call_filler(ctx, &stack_ctx, evt_type, drop_flags, socketcall_syscall_id);
@ -145,30 +125,25 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
return 0;
}
BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
{
BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args) {
const struct syscall_evt_pair *sc_evt = NULL;
ppm_event_code evt_type = -1;
int drop_flags = 0;
long id = 0;
bool enabled = false;
struct scap_bpf_settings *settings = 0;
struct scap_bpf_settings *settings = 0;
long retval = 0;
int socketcall_syscall_id = -1;
id = bpf_syscall_get_nr(ctx);
if (id < 0 || id >= SYSCALL_TABLE_SIZE)
if(id < 0 || id >= SYSCALL_TABLE_SIZE)
return 0;
if (bpf_in_ia32_syscall())
{
if(bpf_in_ia32_syscall()) {
#if defined(CONFIG_X86_64) && defined(CONFIG_IA32_EMULATION)
if (id == __NR_ia32_socketcall)
{
if(id == __NR_ia32_socketcall) {
socketcall_syscall_id = __NR_ia32_socketcall;
}
else
{
} else {
/*
* When a process does execve from 64bit to 32bit, TS_COMPAT is marked true
* but the id of the syscall is __NR_execve, so to correctly parse it we need to
@ -182,8 +157,7 @@ BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
#endif
{
id = convert_ia32_to_64(id);
if(id == -1)
{
if(id == -1) {
return 0;
}
}
@ -192,31 +166,24 @@ BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
// Unsupported arch
return 0;
#endif
}
else
{
} else {
#ifdef __NR_socketcall
socketcall_syscall_id = __NR_socketcall;
#endif
}
if(id == socketcall_syscall_id)
{
if(id == socketcall_syscall_id) {
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
bool is_syscall_return = false;
int return_code = convert_network_syscalls(ctx, &is_syscall_return);
if (return_code == -1)
{
if(return_code == -1) {
// Wrong SYS_ argument passed. Drop the syscall.
return 0;
}
if(!is_syscall_return)
{
evt_type = return_code + 1; // we are in sys_exit!
if(!is_syscall_return) {
evt_type = return_code + 1; // we are in sys_exit!
drop_flags = UF_USED;
}
else
{
} else {
id = return_code;
}
#else
@ -225,39 +192,32 @@ BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
#endif
}
if(evt_type == -1)
{
if(evt_type == -1) {
enabled = is_syscall_interesting(id);
if(!enabled)
{
if(!enabled) {
return 0;
}
sc_evt = get_syscall_info(id);
if(!sc_evt)
return 0;
if(sc_evt->flags & UF_USED)
{
if(sc_evt->flags & UF_USED) {
evt_type = sc_evt->exit_event_type;
drop_flags = sc_evt->flags;
}
else
{
} else {
evt_type = PPME_GENERIC_X;
drop_flags = UF_ALWAYS_DROP;
}
}
settings = get_bpf_settings();
if (!settings)
if(!settings)
return 0;
// Drop failed syscalls if necessary
if (settings->drop_failed)
{
if(settings->drop_failed) {
retval = bpf_syscall_get_retval(ctx);
if (retval < 0)
{
if(retval < 0) {
return 0;
}
}
@ -271,8 +231,7 @@ BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
return 0;
}
BPF_PROBE("sched/", sched_process_exit, sched_process_exit_args)
{
BPF_PROBE("sched/", sched_process_exit, sched_process_exit_args) {
ppm_event_code evt_type;
struct task_struct *task;
unsigned int flags;
@ -280,7 +239,7 @@ BPF_PROBE("sched/", sched_process_exit, sched_process_exit_args)
task = (struct task_struct *)bpf_get_current_task();
flags = _READ(task->flags);
if (flags & PF_KTHREAD)
if(flags & PF_KTHREAD)
return 0;
evt_type = PPME_PROCEXIT_1_E;
@ -289,19 +248,17 @@ BPF_PROBE("sched/", sched_process_exit, sched_process_exit_args)
return 0;
}
BPF_PROBE("sched/", sched_switch, sched_switch_args)
{
BPF_PROBE("sched/", sched_switch, sched_switch_args) {
ppm_event_code evt_type;
evt_type = PPME_SCHEDSWITCH_6_E;
call_filler(ctx, ctx, evt_type, 0, -1);
call_filler(ctx, ctx, evt_type, UF_ALWAYS_DROP, -1);
return 0;
}
#ifdef CAPTURE_PAGE_FAULTS
static __always_inline int bpf_page_fault(struct page_fault_args *ctx)
{
static __always_inline int bpf_page_fault(struct page_fault_args *ctx) {
ppm_event_code evt_type;
evt_type = PPME_PAGE_FAULT_E;
@ -310,19 +267,16 @@ static __always_inline int bpf_page_fault(struct page_fault_args *ctx)
return 0;
}
BPF_PROBE("exceptions/", page_fault_user, page_fault_args)
{
BPF_PROBE("exceptions/", page_fault_user, page_fault_args) {
return bpf_page_fault(ctx);
}
BPF_PROBE("exceptions/", page_fault_kernel, page_fault_args)
{
BPF_PROBE("exceptions/", page_fault_kernel, page_fault_args) {
return bpf_page_fault(ctx);
}
#endif
BPF_PROBE("signal/", signal_deliver, signal_deliver_args)
{
BPF_PROBE("signal/", signal_deliver, signal_deliver_args) {
ppm_event_code evt_type;
evt_type = PPME_SIGNALDELIVER_E;
@ -332,15 +286,14 @@ BPF_PROBE("signal/", signal_deliver, signal_deliver_args)
}
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
__bpf_section(TP_NAME "sched/sched_process_fork&1")
int bpf_sched_process_fork(struct sched_process_fork_args *ctx)
{
__bpf_section(TP_NAME "sched/sched_process_fork&1") int bpf_sched_process_fork(
struct sched_process_fork_args *ctx) {
ppm_event_code evt_type;
struct sys_stash_args args;
unsigned long *argsp;
argsp = __unstash_args(ctx->parent_pid);
if (!argsp)
if(!argsp)
return 0;
memcpy(&args, argsp, sizeof(args));
@ -352,8 +305,7 @@ int bpf_sched_process_fork(struct sched_process_fork_args *ctx)
#endif
#ifdef CAPTURE_SCHED_PROC_EXEC
BPF_PROBE("sched/", sched_process_exec, sched_process_exec_args)
{
BPF_PROBE("sched/", sched_process_exec, sched_process_exec_args) {
struct scap_bpf_settings *settings;
/* We will always send an execve exit event. */
ppm_event_code event_type = PPME_SYSCALL_EXECVE_19_X;
@ -361,42 +313,37 @@ BPF_PROBE("sched/", sched_process_exec, sched_process_exec_args)
/* We are not interested in kernel threads. */
struct task_struct *task = (struct task_struct *)bpf_get_current_task();
unsigned int flags = _READ(task->flags);
if(flags & PF_KTHREAD)
{
if(flags & PF_KTHREAD) {
return 0;
}
/* Reset the tail context in the CPU state map. */
uint32_t cpu = bpf_get_smp_processor_id();
struct scap_bpf_per_cpu_state * state = get_local_state(cpu);
if(!state)
{
struct scap_bpf_per_cpu_state *state = get_local_state(cpu);
if(!state) {
return 0;
}
settings = get_bpf_settings();
if(!settings)
{
if(!settings) {
return 0;
}
uint64_t ts = settings->boot_time + bpf_ktime_get_boot_ns();
reset_tail_ctx(state, event_type, ts);
++state->n_evts;
int filler_code = PPM_FILLER_sched_prog_exec;
bpf_tail_call(ctx, &tail_map, filler_code);
bpf_printk("Can't tail call filler 'sched_proc_exec' evt=%d, filler=%d\n",
event_type,
filler_code);
event_type,
filler_code);
return 0;
}
#endif /* CAPTURE_SCHED_PROC_EXEC */
#ifdef CAPTURE_SCHED_PROC_FORK
__bpf_section("raw_tracepoint/sched_process_fork&2")
int bpf_sched_process_fork(struct sched_process_fork_raw_args *ctx)
{
__bpf_section("raw_tracepoint/sched_process_fork&2") int bpf_sched_process_fork(
struct sched_process_fork_raw_args *ctx) {
struct scap_bpf_settings *settings;
/* We will always send a clone exit event. */
ppm_event_code event_type = PPME_SYSCALL_CLONE_20_X;
@ -404,22 +351,19 @@ int bpf_sched_process_fork(struct sched_process_fork_raw_args *ctx)
/* We are not interested in kernel threads. */
struct task_struct *task = (struct task_struct *)bpf_get_current_task();
unsigned int flags = _READ(task->flags);
if(flags & PF_KTHREAD)
{
if(flags & PF_KTHREAD) {
return 0;
}
/* Reset the tail context in the CPU state map. */
uint32_t cpu = bpf_get_smp_processor_id();
struct scap_bpf_per_cpu_state * state = get_local_state(cpu);
if(!state)
{
struct scap_bpf_per_cpu_state *state = get_local_state(cpu);
if(!state) {
return 0;
}
settings = get_bpf_settings();
if(!settings)
{
if(!settings) {
return 0;
}
uint64_t ts = settings->boot_time + bpf_ktime_get_boot_ns();
@ -429,8 +373,8 @@ int bpf_sched_process_fork(struct sched_process_fork_raw_args *ctx)
int filler_code = PPM_FILLER_sched_prog_fork;
bpf_tail_call(ctx, &tail_map, filler_code);
bpf_printk("Can't tail call filler 'sched_proc_fork' evt=%d, filler=%d\n",
event_type,
filler_code);
event_type,
filler_code);
return 0;
}
#endif /* CAPTURE_SCHED_PROC_FORK */

View File

@ -17,20 +17,24 @@ or GPL2.txt for full copies of the license.
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 4)
#define randomized_struct_fields_start struct {
#define randomized_struct_fields_end };
#define randomized_struct_fields_start struct {
#define randomized_struct_fields_end \
} \
;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#define BPF_FORBIDS_ZERO_ACCESS
#endif
#if (defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_S390) || defined(CONFIG_PPC64)) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
#define BPF_SUPPORTS_RAW_TRACEPOINTS
#if(defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_S390) || \
defined(CONFIG_PPC64)) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
#define BPF_SUPPORTS_RAW_TRACEPOINTS
#endif
#if CAPTURE_SCHED_PROC_FORK && !defined(BPF_SUPPORTS_RAW_TRACEPOINTS)
#error The CAPTURE_SCHED_PROC_FORK support requires 'raw_tracepoints' so kernel versions greater or equal than '4.17'.
#error The CAPTURE_SCHED_PROC_FORK support requires 'raw_tracepoints' so kernel versions greater or equal than '4.17'.
#endif
/* Redefine asm_volatile_goto to work around clang not supporting it

View File

@ -10,8 +10,7 @@ or GPL2.txt for full copies of the license.
#ifndef __RING_HELPERS_H
#define __RING_HELPERS_H
static __always_inline void write_evt_hdr(struct filler_data *data)
{
static __always_inline void write_evt_hdr(struct filler_data *data) {
struct ppm_evt_hdr *evt_hdr = (struct ppm_evt_hdr *)data->buf;
evt_hdr->ts = data->state->tail_ctx.ts;
@ -19,43 +18,35 @@ static __always_inline void write_evt_hdr(struct filler_data *data)
evt_hdr->type = data->state->tail_ctx.evt_type;
evt_hdr->nparams = data->evt->nparams;
data->state->tail_ctx.curoff = sizeof(struct ppm_evt_hdr) +
sizeof(uint16_t) * data->evt->nparams;
data->state->tail_ctx.curoff =
sizeof(struct ppm_evt_hdr) + sizeof(uint16_t) * data->evt->nparams;
data->state->tail_ctx.len = data->state->tail_ctx.curoff;
}
static __always_inline void fixup_evt_len(char *p, unsigned long len)
{
static __always_inline void fixup_evt_len(char *p, unsigned long len) {
struct ppm_evt_hdr *evt_hdr = (struct ppm_evt_hdr *)p;
evt_hdr->len = len;
}
static __always_inline void fixup_evt_arg_len(char *p,
unsigned int argnum,
unsigned int arglen)
{
if (argnum > PPM_MAX_EVENT_PARAMS)
{
static __always_inline void fixup_evt_arg_len(char *p, unsigned int argnum, unsigned int arglen) {
if(argnum > PPM_MAX_EVENT_PARAMS) {
return;
}
volatile unsigned int argnumv = argnum;
*((uint16_t *)&p[sizeof(struct ppm_evt_hdr)] + (argnumv & (PPM_MAX_EVENT_PARAMS - 1))) = arglen;
}
static __always_inline int push_evt_frame(void *ctx,
struct filler_data *data)
{
if (data->state->tail_ctx.curarg != data->evt->nparams) {
static __always_inline int push_evt_frame(void *ctx, struct filler_data *data) {
if(data->state->tail_ctx.curarg != data->evt->nparams) {
bpf_printk("corrupted filler for event type %d (added %u args, should have added %u)\n",
data->state->tail_ctx.evt_type,
data->state->tail_ctx.curarg,
data->evt->nparams);
data->state->tail_ctx.evt_type,
data->state->tail_ctx.curarg,
data->evt->nparams);
return PPM_FAILURE_BUG;
}
if (data->state->tail_ctx.len > PERF_EVENT_MAX_SIZE)
{
if(data->state->tail_ctx.len > PERF_EVENT_MAX_SIZE) {
return PPM_FAILURE_FRAME_SCRATCH_MAP_FULL;
}
@ -63,18 +54,18 @@ static __always_inline int push_evt_frame(void *ctx,
#ifdef BPF_FORBIDS_ZERO_ACCESS
int res = bpf_perf_event_output(ctx,
&perf_map,
BPF_F_CURRENT_CPU,
data->buf,
((data->state->tail_ctx.len - 1) & SCRATCH_SIZE_MAX) + 1);
&perf_map,
BPF_F_CURRENT_CPU,
data->buf,
((data->state->tail_ctx.len - 1) & SCRATCH_SIZE_MAX) + 1);
#else
int res = bpf_perf_event_output(ctx,
&perf_map,
BPF_F_CURRENT_CPU,
data->buf,
data->state->tail_ctx.len & SCRATCH_SIZE_MAX);
&perf_map,
BPF_F_CURRENT_CPU,
data->buf,
data->state->tail_ctx.len & SCRATCH_SIZE_MAX);
#endif
if (res == -ENOENT || res == -EOPNOTSUPP) {
if(res == -ENOENT || res == -EOPNOTSUPP) {
/*
* ENOENT = likely a new CPU is online that wasn't
* opened in userspace
@ -86,15 +77,15 @@ static __always_inline int push_evt_frame(void *ctx,
*/
struct scap_bpf_per_cpu_state *state = get_local_state(0);
if (!state)
if(!state)
return PPM_FAILURE_BUG;
state->hotplug_cpu = bpf_get_smp_processor_id();
bpf_printk("detected hotplug event, cpu=%d\n", state->hotplug_cpu);
} else if (res == -ENOSPC) {
} else if(res == -ENOSPC) {
bpf_printk("bpf_perf_buffer full\n");
return PPM_FAILURE_BUFFER_FULL;
} else if (res) {
} else if(res) {
bpf_printk("bpf_perf_event_output failed, res=%d\n", res);
return PPM_FAILURE_BUG;
}

View File

@ -12,6 +12,8 @@ or GPL2.txt for full copies of the license.
#ifdef __KERNEL__
#include <linux/sched.h> // TASK_COMM_LEN definition
#define __bpf_section(NAME) __attribute__((section(NAME), used))
#ifndef __always_inline
@ -25,13 +27,11 @@ or GPL2.txt for full copies of the license.
#endif
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME #event) \
int bpf_##event(struct type *ctx)
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME #event) int bpf_##event(struct type *ctx)
#else
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME prefix #event) \
int bpf_##event(struct type *ctx)
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME prefix #event) int bpf_##event(struct type *ctx)
#endif
#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
@ -143,26 +143,24 @@ struct sys_stash_args {
#ifdef CAPTURE_SCHED_PROC_EXEC
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
/* TP_PROTO(struct task_struct *p, pid_t old_pid, struct linux_binprm *bprm)
* Taken from `/include/trace/events/sched.h`
*/
struct sched_process_exec_args
{
struct task_struct *p;
pid_t old_pid;
struct linux_binprm *bprm;
};
#else
struct sched_process_exec_args
{
struct sched_process_exec_args {
unsigned short common_type;
unsigned char common_flags;
unsigned char common_preempt_count;
int common_pid;
int filename;
__u32 filename; // This is actually defined as "__data_loc char[] filename;".
pid_t pid;
pid_t old_pid;
};
#else
/* TP_PROTO(struct task_struct *p, pid_t old_pid, struct linux_binprm *bprm)
* Taken from `/include/trace/events/sched.h`
*/
struct sched_process_exec_args {
struct task_struct *p;
pid_t old_pid;
struct linux_binprm *bprm;
};
#endif /* BPF_SUPPORTS_RAW_TRACEPOINTS */
#endif /* CAPTURE_SCHED_PROC_EXEC */
@ -171,10 +169,9 @@ struct sched_process_exec_args
/* TP_PROTO(struct task_struct *parent, struct task_struct *child)
* Taken from `/include/trace/events/sched.h`
*/
struct sched_process_fork_raw_args
{
struct sched_process_fork_raw_args {
struct task_struct *parent;
struct task_struct *child;
struct task_struct *child;
};
#endif
@ -220,7 +217,6 @@ struct perf_event_sample {
#endif /* __KERNEL__ */
/* WARNING: This enum must follow the order in which BPF maps are defined in
* `driver/bpf/maps.h`.
*/
@ -267,9 +263,13 @@ struct tail_context {
struct scap_bpf_per_cpu_state {
struct tail_context tail_ctx;
unsigned long long n_evts; /* Total number of kernel side events actively traced (not including events discarded due to simple consumer mode). */
unsigned long long n_drops_buffer; /* Total number of kernel side drops due to full buffer, includes all categories below, likely higher than sum of syscall categories. */
/* Kernel side drops due to full buffer for categories of system calls. Not all system calls of interest are mapped into one of the categories. */
unsigned long long n_evts; /* Total number of kernel side events actively traced (not including
events discarded due to simple consumer mode). */
unsigned long long
n_drops_buffer; /* Total number of kernel side drops due to full buffer, includes all
categories below, likely higher than sum of syscall categories. */
/* Kernel side drops due to full buffer for categories of system calls. Not all system calls of
* interest are mapped into one of the categories. */
unsigned long long n_drops_buffer_clone_fork_enter;
unsigned long long n_drops_buffer_clone_fork_exit;
unsigned long long n_drops_buffer_execve_enter;
@ -280,13 +280,18 @@ struct scap_bpf_per_cpu_state {
unsigned long long n_drops_buffer_open_exit;
unsigned long long n_drops_buffer_dir_file_enter;
unsigned long long n_drops_buffer_dir_file_exit;
unsigned long long n_drops_buffer_other_interest_enter; /* Category of other system calls of interest, not all other system calls that did not match a category from above. */
unsigned long long
n_drops_buffer_other_interest_enter; /* Category of other system calls of interest, not
all other system calls that did not match a
category from above. */
unsigned long long n_drops_buffer_other_interest_exit;
unsigned long long n_drops_buffer_close_exit;
unsigned long long n_drops_buffer_proc_exit;
unsigned long long n_drops_scratch_map; /* Number of kernel side scratch map drops. */
unsigned long long n_drops_pf; /* Number of kernel side page faults drops (invalid memory access). */
unsigned long long n_drops_bug; /* Number of kernel side bug drops (invalid condition in the kernel instrumentation). */
unsigned long long n_drops_scratch_map; /* Number of kernel side scratch map drops. */
unsigned long long
n_drops_pf; /* Number of kernel side page faults drops (invalid memory access). */
unsigned long long n_drops_bug; /* Number of kernel side bug drops (invalid condition in the
kernel instrumentation). */
unsigned int hotplug_cpu;
bool in_use;
} __attribute__((packed));

View File

@ -13,6 +13,7 @@ or GPL2.txt for full copies of the license.
// #define SNAPLEN_TRACERS_ENABLED 4096 // note: deprecated
#define SNAPLEN_FULLCAPTURE_PORT 16000
#define SNAPLEN_MAX 65000
#define SNAPLEN_DNS_UDP 512
/* Deep packet inspection logic */
#define DPI_LOOKAHEAD_SIZE 16
@ -20,6 +21,7 @@ or GPL2.txt for full copies of the license.
#define PPM_PORT_POSTGRES 5432
#define PPM_PORT_STATSD 8125
#define PPM_PORT_MONGODB 27017
#define PPM_PORT_DNS 53
/* HTTP */
#define BPF_HTTP_GET 0x20544547
@ -35,5 +37,5 @@ or GPL2.txt for full copies of the license.
#define SECOND_TO_NS 1000000000ULL
#ifdef PAGE_SIZE
#define STR_STORAGE_SIZE PAGE_SIZE
#define STR_STORAGE_SIZE PAGE_SIZE
#endif

View File

@ -0,0 +1,26 @@
/*
Copyright (C) 2023 The Falco Authors.
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
or GPL2.txt for full copies of the license.
*/
/*
* Check that the build environment is sane
*/
#include <linux/module.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("the Falco authors");
static int empty_init(void) {
return 0;
}
static void empty_exit(void) {}
module_init(empty_init);
module_exit(empty_exit);

View File

@ -18,15 +18,12 @@ or GPL2.txt for full copies of the license.
MODULE_LICENSE("GPL");
MODULE_AUTHOR("the Falco authors");
static int access_ok_init(void)
{
static int access_ok_init(void) {
access_ok(0, 0);
return 0;
}
static void access_ok_exit(void)
{
}
static void access_ok_exit(void) {}
module_init(access_ok_init);
module_exit(access_ok_exit);

View File

@ -9,7 +9,8 @@ or GPL2.txt for full copies of the license.
/*
* Check that `class_create` builds with only a single parameter
* See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1aaba11da9aa7d7d6b52a74d45b31cac118295a1
* See
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1aaba11da9aa7d7d6b52a74d45b31cac118295a1
*/
#include <linux/module.h>
@ -18,15 +19,13 @@ or GPL2.txt for full copies of the license.
MODULE_LICENSE("GPL");
MODULE_AUTHOR("the Falco authors");
static int class_create_test_init(void)
{
static int class_create_test_init(void) {
struct class *g_ppm_class = class_create("test");
(void)g_ppm_class;
return 0;
}
static void class_create_test_exit(void)
{
}
static void class_create_test_exit(void) {}
module_init(class_create_test_init);
module_exit(class_create_test_exit);

Some files were not shown because too many files have changed in this diff Show More