Compare commits

...

2221 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
Federico Di Pierro c357c49d5d fix(driver/configure): properly pass `CC` variable as make argument.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-17 15:17:58 +02:00
Andrea Terzolo 590e109177 test(drivers): add some tests for ia32 syscalls
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-17 13:17:57 +02:00
Andrea Terzolo 482e47f644 cleanup(modern): avoid to use an array with just one element
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-05-16 16:27:54 +02:00
Andrea Terzolo ddfc61a3bd cleanup(modern): clear all arrays before using them
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-16 16:27:54 +02:00
Jason Dellaluce 0b18e7348c test(userspace/libsinsp): cover field type / operator compatibility grid
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce 8ebd6eead5 fix(userspace/libsinsp): support comparisons with double fields
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce a82cc1672c chore(userspace/libsinsp): remove useless ASSERTs from filter_compare
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce 6f774a41a4 fix(userspace/libsinsp): check operator compatibility with list field types
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce bf9993c54e fix(userspace/libsinsp): solve cross-platform compilation issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce 4df2053b72 refactor(userspace/libsinsp): isolate filter comparison primitives and check compatibility in filter compiler
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce d94273c1e3 refactor(userspace/libsinsp): split filter comparing functions in their own source file (2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Jason Dellaluce 83770d519f refactor(userspace/libsinsp): split filter comparing functions in their own source file (1)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-16 15:32:54 +02:00
Gianmatteo Palmieri 0c3e799915 new(tests): plugin metrics tests
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-16 14:30:54 +02:00
Gianmatteo Palmieri b1aea19567 new(libsinsp): plugin metric to sinsp metric conversion
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-16 14:30:54 +02:00
Gianmatteo Palmieri 8a860c1b8b new(plugin_api): add plugin metrics symbols and types
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-16 14:30:54 +02:00
Jason Dellaluce 4c993d6f46 update: address review comments
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-15 14:30:51 +02:00
Jason Dellaluce c9a433aafa update(userspace/libsinsp): support array-like types as state fields in thread infos, compatible with plugin API
Co-authored-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-15 14:30:51 +02:00
Jason Dellaluce 335d74cffd refactor(userspace/libsinsp): expose file descriptors as state subtable fields compatible with plugins
Co-authored-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-15 09:40:51 +02:00
Federico Di Pierro e199c37aa8 fix(test/drivers): properly account for pagesize that can differ from 4096 on execve related tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro f418c9ec81 fix(driver): unify behavior of kmod and old bpf probe to the new one when reading clone3 clone_args.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro 628e705b34 chore(ci): ssh-action already creates temp folder for us.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro 9d6022c1f8 chore(ci): fetch test exit code and use it to return an error if needed.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro f78484f320 update(ci): bump command_timeout to 60minutes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro 82529b2ca8 chore(ci): do not stop at first error.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro db043df897 chore(docs): ppc64le is now stable.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro fd1e9e9105 new(ci): add a test-drivers-ppc64le workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 17:50:47 +02:00
Federico Di Pierro 2432f0d11c chore(userspace/libsinsp): disable flaky test on arm64.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-14 10:15:45 +02:00
Jason Dellaluce 43beb09be6 refactor(userspace/libsinsp): support subtable state field type and adapt to new plugin API
Co-authored-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-14 09:44:45 +02:00
Jason Dellaluce bc8d95bea7 update(userspace/plugin): support subtable state field type and bump API version
Co-authored-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-14 09:44:45 +02:00
Gianmatteo Palmieri e0fd864907 new(libsinsp): async event queue capacity setter
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-13 18:49:43 +02:00
Andrea Terzolo d3c804b999 fix: use `vtid` instead of `vpid`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-13 11:35:43 +02:00
Andrea Terzolo 24b1b07f13 fix(modern): add some safety checks on struct* file
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-13 11:35:43 +02:00
Andrea Terzolo 5aa0c2fb14 new(modern): add `likely` `unlikely` definitions
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-13 11:35:43 +02:00
Andrea Terzolo 2282131697 cleanup(modern): remove no more needed macro definition
Now we use libbpf 1.3.0 and this definition is already included

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-13 11:35:43 +02:00
Andrea Terzolo ec40c7c50f fix(sinsp): remove wrong unix parsing logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-10 19:24:34 +02:00
Gianmatteo Palmieri 94ced5c414 fix(libsinsp): use current formatting option in bytebuf
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-10 11:51:33 +02:00
Gianmatteo Palmieri 1434e4cd9d fix(libsinsp): make sure formatted bytebuf doesn't contain irregular characters
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-05-10 11:51:33 +02:00
Angelo Puglisi ef6aea37c8 update(sinsp_cgroup): add with_self_cg to the ctors
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-05-10 10:37:33 +02:00
Angelo Puglisi e8c495c083 update(sinsp_cgroup): expose self_v2
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-05-10 10:37:33 +02:00
Angelo Puglisi 0c83bf1c0d update(sinsp_cgroup): expose in_cgroupns
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-05-10 10:37:33 +02:00
Federico Di Pierro 84378d71a2 chore(test/e2e): redirect stderr to stdout.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-10 09:56:03 +02:00
Andrea Terzolo 1f5e5150fd new(test): add a test for a bind with unix socket
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-09 18:51:00 +02:00
Federico Aponte bae8258bb2 chore: limit MIN/MAX macros to plain C
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-09 13:48:58 +02:00
Federico Di Pierro fac8758e30 fix(ci): fixed drivers_ci `if` condition for kernel headers install steps.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-09 12:10:58 +02:00
Federico Di Pierro e6199f9db8 chore(ci): use `get-kernel-sources` master sha.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-09 10:27:57 +02:00
Roberto Scolaro 174c696be4 cleanup(libsinsp): remove unused member from threadinfo
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-08 19:41:55 +02:00
Federico Di Pierro 97f582faa2 chore(userspace/libsinsp): better check leveraging `query_os_for_missing_info`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-05-08 19:39:55 +02:00
Federico Di Pierro 9005155103 chore(userspace/libsinsp): properly manage `podman` container type.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 19:39:55 +02:00
Federico Di Pierro ad9e8c52eb fix(userspace/libsinsp): enable podman container engine when running in capture mode.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 19:39:55 +02:00
Jason Dellaluce a8fdacdbbf fix(userspace/libsinsp): solve a bunch of bugs in the filter checks area
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-08 17:43:54 +02:00
Federico Di Pierro 54238dc025 wip
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 16:56:54 +02:00
Federico Di Pierro 02c825ebbe wip
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 16:56:54 +02:00
Mauro Ezequiel Moltrasio cdef274860 fix(build): remove more occurrences of the OUT macro
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-05-08 13:40:54 +02:00
Mauro Ezequiel Moltrasio 230de3b00f fix(build): remove OUT references in the modern bpf engine
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2024-05-08 13:40:54 +02:00
Mauro Ezequiel Moltrasio 50a724b927 chore(docs): replace IN and OUT macros with docs
In scap.h, we have a couple of quite generic macros called IN and OUT
that can very easily leak into adopter's code bases and wreak havoc.

From my understanding, these macros are only used for documenting which
parameters in a function are input and which are output. Since they are
not consistently used, only appear in a handful of places in the
codebase and the preprocessor is the devil's spawn, we should replace
these macros with proper doxygen style string docs.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Olivier Valentin <ovalenti@redhat.com>
2024-05-08 13:40:54 +02:00
Andrea Terzolo 1991dfe091 cleanup: use a unique macro `TRY_SYSCALL`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-07 19:38:49 +02:00
Andrea Terzolo 22a2b33a65 new: tests check vdso syscall on 64 bits
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 19:38:49 +02:00
Andrea Terzolo 9e62770c76 tests: add support for ia32 vdso syscalls
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 19:38:49 +02:00
Jason Dellaluce b130797900 test(libsinsp): cover new changes in output formatters
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:37:49 +02:00
Jason Dellaluce 220603744f update(libsinsp): support field transformers in output formatters
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:37:49 +02:00
Jason Dellaluce c4f7658795 update: apply review suggestions
Co-authored-by: Federico Aponte <97532903+federico-sysdig@users.noreply.github.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:36:49 +02:00
Jason Dellaluce c8f257187d fix(userspace/libsinsp): solve cases of unsafe string_view access
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:36:49 +02:00
Jason Dellaluce be8b55e65f fix(userspace/libsinsp): consistently check storage size when parsing value string
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:35:51 +02:00
Jason Dellaluce ec4d2ba01b refactor(userspace/libsinsp): optimize allocations of filter checks
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-07 19:35:51 +02:00
Andrea Terzolo 5560701a41 fix(libpman): manage discarded events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 19:31:50 +02:00
Eddy Duer d67ff09199 Bump SCHEMA_VERSION
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-05-07 15:59:48 +02:00
Eddy Duer e2d08e596e Fix 'mmap' and 'mmap2' system calls parsing so that they can be filtered using the fd parameter
Signed-off-by: Eddy Duer <eddy.duer@sysdig.com>
2024-05-07 15:59:48 +02:00
Andrea Terzolo 0609a96975 fix: fix typedef definition and rename
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 11:43:48 +02:00
Andrea Terzolo cf1701f0d8 cleanup: split stats between userspace and kernel
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 11:43:48 +02:00
Andrea Terzolo 0283654110 new(scap_open): introduce new stats in scap_open
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-07 11:43:48 +02:00
Federico Di Pierro 0dd24edd1b chore(ci): updated release-body semver_no_meta regex.
It will now properly match any semver-like string; this is the official semver regex: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-06 14:40:45 +02:00
Federico Di Pierro 0782be45a2 cleanup(ci): removed old release-body-libs workflow and renamed release-body-driver.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-06 14:40:45 +02:00
Federico Di Pierro 325a3a215c cleanup(ci): merge release-body workflows.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-06 14:40:45 +02:00
Jason Dellaluce 24696e0ff5 refactor(userspace/libsinsp): minor changes in state API, expose new threadinfo fields
* Optimize memory allocations for static fields
* Ground work for supporting subtable access and complex state types
* Inlining functions wherever possible
* Improve checks in static and dynamic state fields defintions
* Expose new fields in thread infos

Co-authored-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-06 12:28:45 +02:00
Jason Dellaluce 00cb7b24ac test(libsinsp): cover new changes in filter compiler and existing visitors
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-06 12:15:44 +02:00
Jason Dellaluce 39c277622f update(libsinsp): support new filter grammar in compiler and existing visitors
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-06 12:15:44 +02:00
Jason Dellaluce a982cf56de test(libsinsp/filter): cover latest updates to filtering grammar and parser
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-06 12:15:44 +02:00
Jason Dellaluce b9a0e0aeba refactor(libsinsp/filter): update filtering grammar and parser to support transformers and field-to-field checks
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-06 12:15:44 +02:00
Federico Aponte dd3449861b refactor: use C++ std lib for sinsp::get_file_size
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-06 10:57:44 +02:00
Federico Aponte a088425796 refactor: unique_ptr to arrays
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-06 10:48:44 +02:00
Jason Dellaluce 910df4e79f fix(userspace/libsinsp): remove bad ASSERTs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-06 10:43:44 +02:00
Federico Aponte 87a74810a1 refactor: smart pointer usage
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-06 10:21:44 +02:00
Roberto Scolaro 44cb8fe680 fix(libsinsp): avoid unintented copies
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-05-06 10:08:45 +02:00
Jason Dellaluce bf1835b0e0 fix(userspace/libsinsp): make sure simple sinsp wrapper methods are inlined
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-03 16:14:04 +02:00
Federico Aponte e285a4742f refactor: minor change in for loops
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-03 14:30:03 +02:00
Federico Aponte 72bdea1896 refactor: Use string_view in event filters and more
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-05-03 14:30:03 +02:00
Jason Dellaluce cbdb225278 chore(libsinsp): apply review suggestions
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-03 12:52:03 +02:00
Jason Dellaluce 790d25e1ee fix(userspace/libsinsp): solve link issues in libsinsp tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-03 12:52:03 +02:00
Jason Dellaluce c185a6e73d test(libsinsp): add coverage for filterchecks and new use cases involving transformers and rhs fields
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-03 12:52:03 +02:00
Jason Dellaluce a46663d422 update(libsinsp): support transformers and rhs fields in filterchecks
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-03 12:52:03 +02:00
Jason Dellaluce e2dfbd1036 update(libsinsp): add internal flags for controlling field compatibility with transformers
For now, we exclude all fields that are internally-implemented with custom compare functions,
as it would get too ambiguous to define their behavior, and would become hard to maintain/debug.

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-03 12:52:03 +02:00
Federico Di Pierro 3e57e67b69 fix(ci): fixed release-body-driver workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-02 15:37:56 +02:00
Lovel Rishi 02455b48f3 Use config check to enable memfd related processing (#550)
Signed-off-by: Lovel Rishi <lovelworks@gmail.com>
2024-05-02 11:16:56 +02:00
Andrea Terzolo 72af93fc00 fix(scap): set a null terminator when we collect args from /proc
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-05-02 09:38:56 +02:00
Federico Di Pierro b3734896de fix(userspace/libsinsp): properly set successful lookup state when parsing old container json events.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-24 17:28:25 +02:00
Luca Guerra 5eb4e2ff19 fix(libscap): send a consistent length when reading scap files
Signed-off-by: Luca Guerra <luca@guerra.sh>

Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-24 17:11:25 +02:00
Federico Di Pierro e428555aad chore(userspace/libsinsp): use `strnlen` to be safer.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Dmitrii Dolgov <9erthalion6@gmail.com>
2024-04-24 16:52:25 +02:00
Federico Di Pierro 5e3944dce0 fix(userspace/libsinsp): properly use `strlen` instead of `sizeof` when assigning user/group string infos.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Luca Guerra <luca@guerra.sh>
2024-04-24 16:52:25 +02:00
Gerald Combs 13d73bf590 cleanup(libscap): Allow retries after encountering SCAP_EOF
Call gzclearerr if gzread returns fewer bytes than expected. This lets
us "tail" a file being written by another process.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-04-24 09:08:23 +02:00
Luca Guerra 739d3b9e4f cleanup(libsinsp): throw exception for invalid parsed string vectors
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-23 15:47:19 +02:00
Federico Di Pierro 3793b106a3 fix(test/drivers): disable some checks in clone/fork related tests on ppc64, where a pagefault happens.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 11:56:18 +02:00
Federico Di Pierro 1ce890ad5f fix(test/drivers): fixed sendmsgX_fail and socketcall_sendmsgX_fail tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-23 11:56:18 +02:00
Federico Di Pierro f4faa54427 fix(test/drivers): only assert `dev` parameter on ext4 FS.
Refs #1805

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

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 11:56:18 +02:00
Federico Di Pierro a6c224009e fix(test/drivers): fixed `sendmsgX_fail` and `socketcallX_sendmsg_fail` tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-23 11:56:18 +02:00
Federico Di Pierro 777c7043b9 fix(driver/modern_bpf): fixed missing_definitions for powerpc64le.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-23 11:56:18 +02:00
Andrea Terzolo 1b79c345d4 fix(driver): handle null pointer cases
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 10:33:17 +02:00
Andrea Terzolo c87abdcc6e test(drivers): add some tests for `args` and `envs`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 10:33:17 +02:00
Andrea Terzolo d40e69b77b fix(driver/kmod): avoid dropping events in case of page faults
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 10:33:17 +02:00
Andrea Terzolo 65eacbf357 fix(driver/modern): add always a null terminator after `args`
This commit handles `args` >= 4096. We always add a `\0` at the end of
the args even in case of partial reads. Moreover this changes uniform
the modern probe behavior with other drivers, before this commit we have
a max len of 4096 for `exe` and other `4096` for args. After this change
`exe + args` should be <= 4096

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 10:33:17 +02:00
Andrea Terzolo 88ab162644 fix(driver/modern): send `\0` in case of empty strings
Instruct `push__charbuf` to send a single `\0` when the unsafe pointer
points to an empty string `""`. Doing it inside `push__charbuf` avoid
extra ad-hoc code in various places

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-23 10:33:17 +02:00
therealbobo 68c1bfd14c fix(e2e_ci): always update apt index
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-04-23 10:22:17 +02:00
yzewei af6bd4f84f Update userspace/libscap/engine/gvisor/parsers.cpp
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: yzewei <141103849+yzewei@users.noreply.github.com>
2024-04-22 16:17:14 +02:00
yzewei bc14dd652f update ifdef to ifndef
Signed-off-by: yzewei <yangzewei@loongson.cn>
2024-04-22 16:17:14 +02:00
yzewei 998b11920d add loongarch64 support (driver)
Signed-off-by: yzewei <yangzewei@loongson.cn>
2024-04-22 16:17:14 +02:00
Dmitrii Dolgov 90246b8038 Split user info
sinsp_threadinfo contains two fields with user and login_user
information. Since those fields are of scap_userinfo type and statically
allocated, they take a lot of space:

    scap_userinfo              m_user;               /*   368  2312 */
    scap_userinfo              m_loginuser;          /*  2680  2312 */

which is 4624 bytes out of 5728 for the whole sinsp_threadinfo:

    /* size: 5728, cachelines: 90, members: 64 */

Most of this memory is coming from the fields name
(MAX_CREDENTIALS_STR_LEN), homedir and shell (both SCAP_MAX_PATH_SIZE).
For a process-heavy workload this can mean a lot of memory taken for
these purposes.

To make memory management more flexible, split m_user/m_loginuser into
two set of fields:
* one containing uid/gid, which are ubiquitous and generally used
everywhere
* one for the rest of heavy details, which are needed less often

The new sinsp_userinfo class is not supposed to use separately from
sinsp_threadinfo, thus it's defined inside the class.

Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
2024-04-19 17:23:57 +02:00
Andrea Terzolo d4f41d2577 fix(driver/modern_bpf): address task_struct has no embedded thread_info
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-19 14:40:56 +02:00
Federico Di Pierro 1634d64283 fix(userspace/libsinsp): fixed multiple wrong variadic arguments.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-19 11:34:56 +02:00
Federico Di Pierro 54c4671d25 new(userspace/libsinsp): check usage of wrong-sized variadic arguments in sinsp tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-19 11:34:56 +02:00
Luca Guerra 8a15b03705 fix(libscap): handle NULL scap handle pointer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-19 11:31:56 +02:00
Roberto Scolaro b8c95c6f1d chore(libsinsp_e2e): disable test on the source
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-18 14:04:55 +02:00
Roberto Scolaro 4f478abddc fix(libsinsp_e2e): disable flaky sys_call_test.forking_clone_fs e2e test
The `sys_call_test.forking_clone_fs` e2e test makes the assuption that,
if a children closes a file descriptor, the parent trying to close
the same file descriptor will get an error. This seems not to be
always the case. As the man says `It is probably unwise to close
file descriptors while they may be in use by system calls in other
threads in the same process.  Since a file descriptor may be reused,
there are some obscure race conditions that may cause unintended side
effects.`

Given that we'll disable it upon further investigation.

Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-18 14:04:55 +02:00
Federico Di Pierro 6792229c27 fix(userspace/libsinsp): fixed multiple proc related tests variadic arguments types.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-17 12:14:52 +02:00
Jason Dellaluce 03e34ed297 refactor(userspace/libsinsp): improve performance of endswith filter operator
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-16 21:25:48 +02:00
Andrea Terzolo 039a5f5e84 tests: fix some CI tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 21:23:48 +02:00
Andrea Terzolo eedebfa456 update(tests): add a test on `uid` fields
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 21:23:48 +02:00
Andrea Terzolo 1ba2a80f3e fix(sinsp): remove an extra " "
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 21:23:48 +02:00
Andrea Terzolo d0581820bb new(tests): add a test for unix sockets
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 21:23:48 +02:00
Andrea Terzolo 3597bf953d style(modern_bpf): reword a comment
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 21:23:48 +02:00
Federico Di Pierro b0da658094 cleanup(userspace/libsinsp): improved sinsp metrics_collector to make it more future proof.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-16 21:13:48 +02:00
Jason Dellaluce c5250d6b66 new(libsinsp): data structure for filter field transformers
The first transformations implemented are:
- `tolower`: converts to lower case fields of type string or path
- `toupper`: converts to upper case fields of type string or path
- `b64`: decodes with b64 a string or a byte buf

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-16 18:43:47 +02:00
Jason Dellaluce 7f2b34153f test(libsinsp): add coverage for filter transformers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-16 18:43:47 +02:00
Federico Di Pierro 898fba0d46 chore(driver/bpf): add a warning and use elif.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-16 14:52:45 +02:00
Federico Di Pierro d05d9f9d6f docs(driver/bpf): minimum kernel release ver for bpf for ppc64le is 5.1.
Also, allow to build even when `CONFIG_THREAD_INFO_IN_TASK` is not defined.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-16 14:52:45 +02:00
Melissa Kilby 6b1d8d6d6f fix(container_engine): explicitely set lookup state for all engines
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-04-16 14:05:46 +02:00
Melissa Kilby c2c9e3402c update(tests): define explicit SUCESSFUL container lookup status
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-04-16 14:05:46 +02:00
Melissa Kilby 1938e1db89 feat(libsinsp/container_info): change default / init lookup state to FAILED
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-04-16 14:05:46 +02:00
Jason Dellaluce 449877a051 refactor(libsinsp): better clarify filtercheck subclass extracting only one value
Having `extract` methods all with the same name bacame confusing both to develop on and to review.

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-15 16:25:44 +02:00
Leonardo Grasso 17ca0ea5ea update(userspace/libsinsp): enhance `proc.exe` inline doc
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-04-13 14:59:35 +02:00
Leonardo Grasso 3dd434aca7 update(userspace/libsinsp): enhance `proc.exepath` inline doc
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-04-13 14:59:35 +02:00
Roberto Scolaro f147ffa82c fix(libsinsp_e2e): force changes to disk
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 84ed872d88 chore(libsinsp_e2e): added log on failure
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 7567ed9a5f fix(driver/bpf): always fill exe on proc_startupdate
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro cd79d3d398 fix(e2e_ci): rebuild drivers on the test step
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 5fc6e0a572 fix(libsinsp_e2e): print error on init failed
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 397f50c89a fix(libsinsp_e2e): improve multiarch compatibility
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro d98d16a4a3 fix(libsinsp): fix misalinged access
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro af8439cc8e chore(libsinsp_e2e): improve test stability
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 8e38357454 new(libsinsp): add api for clean suppress comms and tids
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 2f40e78677 new(libsinsp_e2e): add failing_execve tests
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro 2169f933b8 new(libsinsp_e2e): add getsetresuid_and_gid test
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro b42efc986e new(libsinsp_e2e): add poll/ppoll timeout tests
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro e28c703769 new(libsinsp_e2e): add suppress events tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 19:24:32 +02:00
Roberto Scolaro fd8c5341ed chore: remove chisel leftovers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 16:30:32 +02:00
Roberto Scolaro 9f73f61e59 chore(README): remove chisels leftover
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 16:30:32 +02:00
Roberto Scolaro 296b86fbcf refactor!(chisels): deprecate chisels
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 16:30:32 +02:00
Roberto Scolaro 34371e18ca refactor(libsinsp_e2e): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Roberto Scolaro 03835edd59 fix(driver/modern_bpf): simplify apply_dynamic_snaplen func
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Roberto Scolaro 90cbbfc7af chore(driver/modern_bpf): rename enum
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Roberto Scolaro ce529458eb fix(driver/modern_bpf): check sendmsg msghar for null
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Roberto Scolaro 04d9e82d6a fix(driver/modern_bpf): correctly set dynamic snaplen with sendto and sendmsg syscalls
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Roberto Scolaro 919413dc27 new(libsinsp_e2e): add statsd e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-12 09:10:32 +02:00
Andrea Terzolo 78138c1dcf fix: remove some wrong asserts
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-10 16:15:20 +02:00
Roberto Scolaro 4bfbd1fc91 fix(cmake/modules/re2): use sed compatible syntax w/ macos
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-10 14:46:21 +02:00
Jason Dellaluce eadccc563a chore(userspace/libsinsp): apply review suggestions
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-10 12:34:20 +02:00
Jason Dellaluce 6cb5e2ac68 test(libsinsp): add cases for output formatters
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-10 12:34:20 +02:00
Jason Dellaluce 85a1ea0a54 update(libsinsp/test): minor cleanups in sinsp filter tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-10 12:34:20 +02:00
Roberto Scolaro 59a7627f92 fix(libsinsp_e2e): make forking_clone_fs more reliable
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-10 11:12:20 +02:00
Roberto Scolaro 1cd3f83af3 fix(cmake/modules/re2): fix configure issue on cmake >=3.29.1
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-09 18:27:15 +02:00
Andrea Terzolo fb087ae095 new(scap-open): collect the average dimension of events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-04-09 11:57:14 +02:00
Luca Guerra 4893cdb9da fix(tests/gvisor): fix build and sanitizer exec in gvisor parser tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-08 10:40:12 +02:00
Jason Dellaluce 01fe5d78b6 fix(userspace/libsinsp): solve formatts being cropped with fd.types
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-04-05 18:53:03 +02:00
Luca Guerra c909ab6635 fix(gvisor): fix duplicated args
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-04 17:33:59 +02:00
Roberto Scolaro 2700c1bc1d new(libsinsp_e2e_tests): add forking and net tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-03 19:30:53 +02:00
Roberto Scolaro ae684c0abd fix(libsinsp/test): exclude other platforms from new tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-02 16:43:46 +02:00
Roberto Scolaro 6ddb64fde5 cleanup(libsinsp/tests): move logger reset in SetUp
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-02 16:43:46 +02:00
Roberto Scolaro dd6091d843 new(libsinsp/test): new unit tests for logger
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-04-02 16:43:46 +02:00
Luca Guerra cf1e4d9c68 update(build): update libcurl to 8.7.1
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-02 10:06:44 +02:00
Gianmatteo Palmieri ecd5a65495 chore(driver): bump schema version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-29 10:53:23 +01:00
Gianmatteo Palmieri 0d0b9537fc fix(modern_bpf): recvmsg filler sending empty addres for udp connections
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-29 10:53:23 +01:00
Leonardo Grasso 026ffe1d8f chore(.github): new heuristics for API_VERSION checks
Fillers were removed because they are usually related to the SCHEMA_VERSION.
`ppm_events_public.h` was added due to IOCTL codes.
Also, the addition of bpf maps usually affects the API.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-03-28 16:03:16 +01:00
Leonardo Grasso 82d06aee73 chore(.github): add fillers in SCHEMA_VERSION checks
The schema version patch number should be incremented when code changes don't break compatibility (e.g. bug fixes in filler code)

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-03-28 16:03:16 +01:00
Gerlando Falauto 209243e020 fix(driver/bpf): honor CLANG and LLC from the env
the configure subsystem currently relies on
clang and llc being available.
However, building drivers in a containerized
environment might actually want to leverage
a specific CLANG version.
So just like we did for CC on the kmod driver,
have those variables passed over to the
configure subsystem.

Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
2024-03-28 10:56:16 +01:00
Gianmatteo Palmieri fac10c517a fix(test): expect a non-null tuple in recvfrom syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-28 10:53:15 +01:00
Gianmatteo Palmieri 333e76abca fix(driver): avoid sending a null tuple in recvfrom
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-28 10:53:15 +01:00
Roberto Scolaro 2528afa798 cleanup(driver/bpf): use _READ_USER helper
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-27 12:22:13 +01:00
Roberto Scolaro a5546b628a fix(driver/bpf): report correct args of getresuid syscall
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-27 12:22:13 +01:00
Roberto Scolaro df7f57a29d new(libsinsp_e2e): add fs, process and threadinfo tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-27 12:12:13 +01:00
Luca Guerra a9a9c993c4 fix(build): use ENABLE_COVERAGE for coverage, fix segfault
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-26 17:31:11 +01:00
Grzegorz Nosek c66b891669 chore(driver): bump API_VERSION by 0.0.1
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-26 15:51:11 +01:00
Grzegorz Nosek 5a6b43b48d fix(fillers): do not ASSERT on an invalid fcntl
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-26 15:51:11 +01:00
Grzegorz Nosek 4e27a7ec93 fix(fillers): do not ASSERT on an invalid shutdown flag
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-26 15:51:11 +01:00
Grzegorz Nosek 1627338536 fix(fillers): do not check for SHUT_RD as a cpp macro
For example, <linux/net.h> defines the constants as enum variants,
not as preprocessor macros, making the original code work by accident
(because SHUT_* are the same as PPM_SHUT_*).

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-26 15:51:11 +01:00
Grzegorz Nosek 0ce46ba733 fix(fillers): use the proper PPM_SHUT_* constants
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-26 15:51:11 +01:00
Roberto Scolaro 04d4cb7a2d fix(driver/modern_bpf): avoid type confusion setting snaplen
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-25 14:21:05 +01:00
Roberto Scolaro b3eb1eff0d fix(driver): avoid mixed declarations
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 17:44:54 +01:00
Roberto Scolaro a9e561257e chore(driver): adopt consistent approach in fd casting for dup syscalls
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 17:44:54 +01:00
Roberto Scolaro 44ffb2743d fix(kmod): fix signedness on fd of dup syscalls
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 17:44:54 +01:00
Roberto Scolaro 4686acb4ca fix(libsinsp_e2e): more robust container tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 6d1fc9194a fix(libsinsp_e2e): actually stop capture
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 52f110f7bd fix(libsinsp_e2e): remove flaky get_n_tracepoint_hit_smoke
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro a0b65db302 fix(libsinsp_e2e): make sys_call_tests more reliable
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 2fa0e80c64 refactor(libsinsp_e2e): use singleton for inspector to avoid UAF
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 166fbfed38 cleanup(libsinsp_e2e): sys_call_test.cpp cleanup
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro f139868f3c fix(libsinsp_e2e): paths tests cleanup
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 6374824c25 fix(libsinsp_e2e): stop dropping mode after test
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro a963094ba6 refactor(libsinsp_e2e): create inspector only once
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 51431d0333 chore(libsinsp_e2e): reorder callbacks
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro 392868a10e new(tests): add new path e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Roberto Scolaro e296a45dc2 fix(libsinsp): remove misaligned access
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-22 16:54:54 +01:00
Gianmatteo Palmieri 413b7a6c4d new(test): add execve failure test with empty argument
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-22 13:08:53 +01:00
Gianmatteo Palmieri 94b24dcb61 fix(driver/bpf): not sending all arguments on execve fail
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-22 13:08:53 +01:00
Roberto Scolaro 6229de5402 new(ci): add sccache support
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-20 15:28:46 +01:00
Roberto Scolaro 89b63faeb3 chore(ci): cache libsinsp e2e builds
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-20 15:28:46 +01:00
Roberto Scolaro 158566d12b chore(test/libsinsp_e2e): build only necessary tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-20 15:28:46 +01:00
Roberto Scolaro b07417ace9 chore(ci): better e2e libsinsp naming
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-20 15:28:46 +01:00
Gianmatteo Palmieri 1ade13c209 fix(libsinsp): parse dev and inode in all open-family events
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-20 14:52:46 +01:00
Gianmatteo Palmieri f9e3009e4d chore(driver): bump schema version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-20 14:52:46 +01:00
Gianmatteo Palmieri 7d02443fd6 new(tests): expect more params in open syscalls test
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-20 14:52:46 +01:00
Gianmatteo Palmieri 514499412b new(driver): collect dev and ino in open_by_handle_at syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-20 14:52:46 +01:00
Gianmatteo Palmieri b70b471eb4 new(driver): collect dev and ino in openat2 syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-20 14:52:46 +01:00
Grzegorz Nosek 41f4564d92 Revert "update(sinsp): implement suppressed tid cache in sinsp_suppress"
The cache implementation was broken (a no-op, effectively) but even
after fixing it doesn't provide noticeable performance wins.

Revert it and save a bit of complexity.

This reverts commit 6a9a0ec14d.

Fixes: #1724

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-19 17:23:43 +01:00
Federico Di Pierro 2e38d22074 fix(userspace/libscap): fix memleak in scap-open example when killed by signal handler.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-19 12:08:42 +01:00
Federico Di Pierro c094c53549 fix(userspace/libsinsp): avoid possible UB unaligned access.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-19 12:08:42 +01:00
Federico Di Pierro 4b9751fcaf chore(test/libsinsp_e2e): added a `sendmsg_recvmsg_SCM_RIGHTS` test to cover the issue.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-19 12:08:42 +01:00
Federico Di Pierro 6ff059fdbd fix(userspace/libsinsp): fix a possible source of use-after-free.
Basically, `scap_get_fdlist()` called in the sinsp parsers loop to manage SCM_RIGHTS flag for recvmsg,
updates the pointers in the thread fdtable.
After #1637, doing so invalidates `event` m_fdinfo field, that is a pointer to a now freed data.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-19 12:08:42 +01:00
Federico Di Pierro cce37fa3b4 fix(ci): fixed recent asan-related CI issues.
See actions/runner-images#9524 (comment) for the fix.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-18 17:58:38 +01:00
Federico Di Pierro fc68119ac1 chore(test/libsisnp_e2e): use an unique_ptr for m_inspector.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-18 17:58:38 +01:00
Roberto Scolaro a6be3efda7 fix(libpman): fix compilation issue with -Werror
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-15 14:51:28 +01:00
Angelo Puglisi c6715dd3e8 fix(driver/bpf): KBUILD_CPPFLAGS
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-15 09:37:28 +01:00
Angelo Puglisi b78fc061c3 fix(driver): CC variable for debian
In Debian 12 we have `CC= gcc-12`, so we have to wrap it in quotes when
setting it to the configure system env

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-14 09:45:24 +01:00
Roberto Scolaro 5fbb7991ad refactor(e2e): add docker helper class
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro be0958ab8f fix(tests): move container_image_splitting tests to ut
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro e835f551ba chore(libsinsp_e2e): move container tests in separated folder
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro 93caaf9af5 fix(libsinsp_e2e): use _exit(0)
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro 67814ff835 fix(libsinsp_e2e): fix unfreed memory
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro e677e28f51 new(libsinsp_e2e): add container+thread state to cmake
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro 0865ec467d new(libsinsp_e2e): add thread state tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro 93cf6e0e90 new(libsinsp_e2e): add container tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:34:21 +01:00
Roberto Scolaro 9645e9c1d9 chore(ci): enable chisels on win32 build
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-13 15:26:21 +01:00
Stefan Reimer 2514b509ac fix: missing cstdint include to fix build on Alpine
Signed-off-by: Stefan Reimer <stefan@zero-downtime.net>
2024-03-13 15:25:21 +01:00
Melissa Kilby 29e7c7be7b cleanup(metrics): apply reviewers suggestions
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby d5a6fdc6c2 cleanup(metrics): code deduplication and simplification
Co-authored-by: Samuel Gaist <samuel.gaist@idiap.ch>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 5484223dc6 chore: use cerr information prints in metrics unit tests
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby fc716db5d8 cleanup(libsinsp/metrics): apply reviewers suggestions
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby d8ebf81a62 cleanup(libsinsp/metrics): apply reviewers suggestions + cleanup
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 8eefd70e60 new(libsinsp/metrics): implement Prometheus convert_metric_to_unit_convention
Honor Prometheus standards (https://prometheus.io/docs/practices/naming/ or https://prometheus.io/docs/practices/naming/#base-units),
except keep libbpf stats metrics and timestamps in nanoseconds to avoid precision loss when converting them to seconds. Note that the standards are recommendations and not requirements,
and not even cAdvisor always adheres to them. The Prometheus community acknowledges that the standards do not always fit the use case at hand.

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby fce6445f4e chore: adopt new get thread_manager style in metrics
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby a083f92837 cleanup(libsinsp/metrics_collector): const correction
Co-authored-by: Samuel Gaist <samuel.gaist@idiap.ch>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby ecf5b68781 refactor!(libsinsp/metrics): new metrics_converter subclasses complementing metrics_collector
Separation of concerns: new metrics_converter subclasses

Rename the following metric names for consistency:

cpu_usage_perc_total_host -> host_cpu_usage_perc
memory_used_host -> host_memory_used_kb (or host_memory_used_mb if unit converted)
procs_running_host -> host_procs_running
open_fds_host -> host_open_fds

memory_rss -> memory_rss_kb (or memory_rss_mb if unit converted)
memory_pss -> memory_pss_kb (or memory_pss_mb if unit converted)
memory_vsz -> memory_vsz_kb (or memory_vsz_mb if unit converted)
container_memory_used -> container_memory_used_bytes (or container_memory_used_mb if unit converted)

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 2d359f550c cleanup(libsinp): improve prometheus format conversion correctness
Co-authored-by: Mickael Carl <mcarl@apple.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 159b0fa9ac chore: revert some changes to get_sinsp_stats_v2
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 2861124b5f refactor(libsinsp): convert_metric_to_prom_text follow some best practices
Co-authored-by: Mickael Carl <mcarl@apple.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 31f322071c update: introduce new rule counters metrics category macro
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 70084450cd cleanup(libsinsp): expand convert_metric_to_prometheus_text
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby df1290cb90 cleanup(libsinsp): metrics text - pass by string_view
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 174ffd46be cleanup(libsinsp): apply reviewers suggestions
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 0cbebc9553 new(libsinsp): add convert_metric_to_prometheus_text to metrics_collector
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 79505a6661 cleanup(libsinsp): improve code clarity and adopt best practices
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby c413d8cfce refactor(libsinsp): native memory conversion in metrics_v2
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby bc7f93b134 refactor: naming change stats -> metrics if applicable + complete metrics_v2 schema updates
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby db2916d811 refactor(libsinsp): new light weight metrics_collector class
* simplifies consuming metrics; now combines libscap and libsinsp metrics into one vector
* type of metrics uniformely gated via pushing flags down (as previously)
* easier memory management
* use std::vector as data structure for m_metrics for safer management; this also helps reduce the knowledge the client needs about the metrics or the number of possible metrics; client can just loop over metrics and gate actions based on the metrics string name etc
* changes do not affect the hot path and performance is not of primary concern
* previous metrics preserved; only code refactor

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Melissa Kilby 2f62626e42 update(scap): update scap_stats_v2 schema
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-13 10:25:20 +01:00
Federico Di Pierro 5dc692e304 chore(test/drivers): some small fixes for file_opener and a couple of tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-11 13:44:15 +01:00
Federico Di Pierro d90cb71c45 fix(test/drivers): fix ENOSYS check and test skipping.
We cannot call GTEST_SKIP() in a sub-routine of a test, but only in the test body.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-11 13:44:15 +01:00
Federico Di Pierro 03f027a33d chore(driver/bpf): move `BPF_PROBE` macro definitions to types.h.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-11 10:37:14 +01:00
Federico Di Pierro 6dc651648e fix(driver/bpf): fix configure modules installation for bpf.
Now we are able to build bpf probe from installed path.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-11 10:37:14 +01:00
Federico Di Pierro 026bae193f new(driver/bpf): added bpf configure system similar to the kmod one.
Then, added fix for rss_stat becoming an array in kernel 6.2.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-11 10:37:14 +01:00
Gianmatteo Palmieri b27e8d950e fix(libsinsp): avoid setting a null event pointer when returning SCAP_EOF in sinsp::next
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-03-11 09:27:14 +01:00
Federico Di Pierro a5463db45e chore(driver): pass also `CC` env variable if set.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-08 09:42:02 +01:00
Federico Di Pierro 002af52462 fix(driver): properly pass KBUILD_MODPOST_WARN env variable to configure makefiles if set.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-08 09:42:02 +01:00
Grzegorz Nosek 5f4f7eccc5 fix(plugins): make list_fields return a const pointer
The fields returned by a plugin can be a static string and the plugin
framework doesn't have any business in modifying it so let's make it
const (to avoid a copy for plugins that can return a static string).

Note: I only bump the plugin API version by 0.0.1 since the changes
in this PR do not affect binary compatibility in any way.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-08 08:58:02 +01:00
Roberto Scolaro 4abc96dc88 fix(test/drivers): fix concurrency issue
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-07 23:21:00 +01:00
Jason Dellaluce 4872fe2d81 fix(userspace/libsinsp): field lists are hidden by mistake
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-03-07 20:18:59 +01:00
Roberto Scolaro 71104f32d3 chore(driver): bump driver schema version
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-07 17:45:59 +01:00
Roberto Scolaro 6b37fb6342 fix(libsinsp): ignore equal fds from sockepair syscall
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-07 17:45:59 +01:00
Roberto Scolaro 930976e382 fix(bpf,modern_bpf): fix wrong return value state
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-07 17:45:59 +01:00
Grzegorz Nosek e28756d49e update(SCHEMA_VERSION): bump SCHEMA_VERSION by 0.0.1
Technically, this PR does change the schema, not just
the implementation, but all the changes are ABI-compatible and do not
affect driver<->userspace compatibility.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek d82835ae83 fix(schema): use finit_module_flags for finit_module flags param
We had finit_module_flags_to_scap defined but we did not have
the corresponding flag table for userspace.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek 6c0f643abc fix(schema): use pidfd_open_flags for pidfd_open flags param
We already had the flags defined, they just weren't wired in to
the event table.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek de0ce6ccc6 fix(schema): change pidfd_getfd flags param to PT_UINT32
pidfd_getfd does not define any flags at the moment

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek 82052ade7f fix(schema): use file_flags as signalfd4 flags
This follows the pattern for inotify_init1 and eventfd2, where
the syscalls technically do define their own flags but the subset
we're interested in maps to file_flags directly.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek ccd3bcf560 fix(schema): change inotify_init flags param to PT_UINT8
Per the comment in f_sys_inotify_init_e:
    /* We have nothing to extract from the kernel here so we send `0`.
     * This is done to preserve the `PPME_SYSCALL_INOTIFY_INIT_E` event with 1 param.
     */

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek fcf626b328 fix(schema): change timerfd_create flags param to PT_UINT8
We don't even have a dedicated filler for this and always set the flags
to zero.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek 3bb3243e2b fix(schema): change signalfd flags param to PT_UINT8
Per the comment in f_sys_signalfd_e:
    /* The syscall `signalfd` has no flags! only `signalfd4` has the `flags` param.
     * For compatibility with the event definition here we send `0` as flags.
     */

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek d571aad86b fix(schema): change eventfd flags param to PT_UINT32
Per the comment in f_sys_eventfd_e:
    /* The syscall eventfd has no flags! only `eventfd2` has the `flags` param.
     * For compatibility with the event definition here we send `0` as flags.
     */

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek 8d81d0ab5c fix(schema): make mlock2 flags a PT_FLAGS32
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Grzegorz Nosek a2480f35ab fix(schema): fix typo in BPF_OBJ_PIN
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 15:54:58 +01:00
Melissa Kilby ad990205a7 chore: polish order and comments in CRI restructure refactor one more time
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby 46a93c9dc4 chore: polish naming and comments in CRI restructure refactor
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby 048b836b99 cleanup(libsinsp): add fallback to sandbox container in k8s filterchecks
Includes minor additional cleanups wrt to comments.

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby f6b974e5c8 fix(cri): adjust some checks
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby a2738aa722 refactor(cri): restructure parsing of the pod sandbox container itself
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby f441e6ff51 refactor(cri): restructure ContainerStatusResponse parsing
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Melissa Kilby 19893329af refactor(libsinsp/cri): consolidate PodSandboxStatusResponse parsing
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-03-07 12:47:58 +01:00
Federico Di Pierro 945fedb6f3 fix(driver): properly use DRIVER_KMOD_COMPONENT_NAME when installing kmod configure modules.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-07 11:50:58 +01:00
Grzegorz Nosek 83f152905b fix(build): replace {0} zero-init with {}
Apparently my compiler (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0)
does not like initializing structs with {0} at all.

Honestly, I'm not convinced this is valid C++ either, though I'm
pretty sure it is valid C. E.g. this page:
https://en.cppreference.com/w/cpp/language/zero_initialization
does not mention {0} as a valid way to zero-initialize a struct.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2024-03-07 11:39:58 +01:00
Roberto Scolaro 8cbfc42fe2 fix(libsinsp-ut): avoid use after free
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-06 14:40:55 +01:00
Roberto Scolaro 85cda8e887 new(libsinsp/test): add new async_key_value_source tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-03-06 14:40:55 +01:00
Luca Guerra 9c538e014b update(ci): use bundled deps in e2e ci
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-06 11:22:55 +01:00
Luca Guerra 8d97b9d9a1 cleanup(scap/bpf): resolve ubsan warning
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-06 11:22:55 +01:00
Luca Guerra 42c6d04728 update(ci): enable sanitizers in e2e tests, use new options
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-06 11:22:55 +01:00
Luca Guerra ba9a70db5a new(build): add flags USE_ASAN, USE_UBSAN, UBSAN_HALT_ON_ERROR
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-06 11:22:55 +01:00
Luca Guerra bb0f97d3b9 fix(sinsp): ignore fds without tinfo from scap files
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-05 16:29:52 +01:00
Angelo Puglisi 9f75998160 fix(driver): use configure system to build class_create with a single parameter
Address RHEL 9 backport of class_create signature change introduced in kernel 6.4
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1aaba11da9aa7d7d6b52a74d45b31cac118295a1

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-05 14:48:51 +01:00
Angelo Puglisi 151b277d32 fix(driver): ppm_devnode definition
Trust the kmod configure system for `ppm_devnode`, and drop
PPM_RHEL_RELEASE_CODE checks.
Fixes fedora-5.17 build, failing because of RHEL release version 9.99

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-05 10:33:51 +01:00
Angelo Puglisi c29b69a227 fix(driver): KERNELDIR always using current kernel
When installing a new kernel, dkms would build the module for it, but
with KERNELDIR defined with `uname -r` the compilation will likely fail.
Define it with the current kernel headers only when the makefile is used
directly, and rely on the make current directory otherwise (coming from
make -C ...).

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-05 10:33:51 +01:00
Gerlando Falauto 72dad23c34 fix(driver): use configure to fix build of RHEL8.9 kernels
RHEL8.9 kernels (4.18.0) have an inconsistent behavior in that
the first releases (up to ~500) do NOT include the backported
change, which was however included from a certain point on.
The previous implementation empirically (but wrongly) assumed
that all RHEL8.9 kernels would have the patch, so the first
ones would not compile.
Now that we have a dynamic discovery mechanism, we can drop
this assumption and leverage HAS_DEVNODE_ARG1_CONST.

Notice how this includes a revert of:

commit 977f946e31
Author: Gerlando Falauto <gerlando.falauto@sysdig.com>
Date:   Wed Aug 2 14:22:37 2023 +0200

    fix(driver): fix build on RHEL 8.9 kernels

Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
Co-authored-by: Angelo Puglisi <angelo.puglisi@sysdig.com>
2024-03-05 10:33:51 +01:00
Gerlando Falauto 1ca8e130be chore(configure): make configure output more verbose
- embellish the output with a '[configure]' prefix
- show the make output of the configuration step
  (notice it will be squashed into a single line)

Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
Co-authored-by: Angelo Puglisi <angelo.puglisi@sysdig.com>
2024-03-05 10:33:51 +01:00
Angelo Puglisi 942b096130 new(driver): kmod configure system
Introduce a new mechanism for conditional build in the kernel module,
documented in driver/README.configure.md

Apply such mechanism to `ppm_access_ok`, easily detecting if `access_ok`
is the old version with 3 parameters or the new one with just two.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-03-05 10:33:51 +01:00
Lorenzo Susini 51faaa458a update(tests): test also delete_module flags parameter
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini a388543721 update(driver): use delete_module flags
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini 67aecdc3a8 chore: bump num syscalls
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini ed9ac66cf9 chore: bump schema version to 2.18.0
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini 7ec1baea1e test(test/drivers): new test for delete_module syscall
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini 92a18191e1 update(driver): implement delete_module syscall for kmod
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini 3dc5284b54 update(driver/bpf): implement delete_module syscall for bpf probe
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Lorenzo Susini d3e1afe7ac update(driver/modern_bpf): implement delete_module syscall for modern bpf
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-03-01 21:15:37 +01:00
Luca Guerra 1f8296a8cf cleanup(libsinsp): scap_evt cleanups
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-03-01 18:12:37 +01:00
Federico Aponte 0db15e6779 fix: Some warnings when compiling with GCC 14
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-03-01 10:23:36 +01:00
Federico Di Pierro 3f03a2c8ab chore(driver/bpf): build probe from within CMAKE_CURRENT_BINARY_DIR like we do for kmod.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-01 09:38:36 +01:00
Federico Di Pierro f803ea284a chore(driver): allow to specify different components for kmod and bpf install.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-01 09:38:36 +01:00
Roberto Scolaro bf3b9d5f49 fix(test): improve process_vm_readvX failure test
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-29 12:58:33 +01:00
Gianmatteo Palmieri d753477d22 fix(driver): undefined SPLICE flags
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-29 10:34:32 +01:00
Gianmatteo Palmieri a4ff990b42 fix(test): syscall failure with non-null flag in process_vm_readv
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-29 10:34:32 +01:00
Gianmatteo Palmieri c3d1721dde fix(test): expect fd list in poll syscall exit
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-29 10:34:32 +01:00
Gianmatteo Palmieri 2573b85475 fix(driver/kmod): always send fds to userspace in poll/ppoll syscall exit
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-29 10:34:32 +01:00
Melissa Kilby 3aad411b35 cleanup: revert any changes to parse_container_json_evt + ensure existing state updates in lookup_sync are preserved
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-02-28 18:11:28 +01:00
Melissa Kilby ecfa917ded fix(cri): properly handle state assignments in new fast-track CRI container sync lookups
Co-authored-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-02-28 18:11:28 +01:00
Melissa Kilby bef58e5c52 cleanup(cri): cleanup lookup_status handling
* Now more precise, logical and clean, set STARTED at the beginning
and SUCCESSFUL at the end of `parse_container_json_evt` if and only if
the container image was successfully retrieved and present before calling
`add_container` or if it's a pod sanbox container.
* In `lookup_sync` we previously set the lookup_status to SUCCESSFUL, which can be
avoided to have a more consolidated and clean behavior in `parse_container_json_evt`.

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-02-28 18:11:28 +01:00
Melissa Kilby c6cc2249ab refactor(cri): fast-track add containers to cache (synchronous lookup case)
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-02-28 18:11:28 +01:00
Jason Dellaluce b656814552 fix(userspace/libsinsp): make sure fd table's tid is set
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-28 11:07:27 +01:00
Federico Di Pierro 63f762c7d6 update(cmake): bumped valijson to latest version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-28 10:42:26 +01:00
Federico Di Pierro 18c33257e9 fix(driver): use strlcpy when `strscpy` was not available.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-28 09:43:27 +01:00
Federico Di Pierro 81ca65efb9 chore(driver): bump API_VERSION patch.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-28 09:43:27 +01:00
Federico Di Pierro 350208fac7 chore(driver): properly use `strscpy`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-28 09:43:27 +01:00
Dmitrii Dolgov 102bc0fbe9 Silence missing BPF program error
PR falcosecurity#943 has introduced ability to exclude a set of
tail-called programs from loading. Yet current such excluded program
will generate an error message, which could be misleading. Extend the
logging infrastructure to be able to use a specified log level and
downgrade the message to the debug level.

Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
2024-02-27 17:58:25 +01:00
Roberto Scolaro 9a62e07954 fix(e2e_ci): use system deps
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-26 18:48:21 +01:00
Roberto Scolaro ed4f0a1a8e fix(test/libsinsp_e2e): fix multiple thread-safety issues in event_capture
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-26 18:48:21 +01:00
Roberto Scolaro 844b275c52 chore(test/drivers): remove unused header
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-23 10:41:08 +01:00
Roberto Scolaro 2abbb30b10 fix(test/drivers): improved error handling
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-23 10:41:08 +01:00
Roberto Scolaro f6905e4ad8 chore(test/drivers): add file_opener helper
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-23 10:41:08 +01:00
therealbobo abc5ea989a fix(test/drivers): wait for process_vm_readv
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-02-23 10:41:08 +01:00
therealbobo 5a93899f1c fix(test/drivers): add check for name_to_handle_at support
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-02-23 10:41:08 +01:00
therealbobo 1c1415c09b fix(test/drivers): avoid to use MFD_HUGETLB together with MFD_ALLOW_SEALING
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-02-23 10:41:08 +01:00
therealbobo 34123bf086 fix(test/drivers): manually create temp fd when O_TMPFILE is not available
Signed-off-by: therealbobo <robi.ayrton@gmail.com>
2024-02-23 10:41:08 +01:00
Jason Dellaluce f2eabad40d fix(test/libsinsp_e2e): solve compilation issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce 938be9003e update(userspace/libsinsp): apply reviews suggestions
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce 43f1757c5c fix(userspace/libsinsp): solve link issues in sinsp-example
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce 3c15c531f8 chore(userspace/libsinsp): further minor improvements
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce b18149fca2 refactor(userspace/libsinsp)!: clear up ownership model of thread manager
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce 600976ebb3 refactor(userspace/libsinsp)!: adopt unique_ptr for heap-allocated class members
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce eaa2573ee8 chore(userspace/libsinsp)!: remove unused method
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce dde22cb5d1 refactor(userspace/libsinsp)!: adopt unique_ptrs in filters
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce 92e3161e12 refactor(userspace/libsinsp)!: adopt unique_ptrs in filtercheck lists
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Jason Dellaluce febdb7bfd2 refactor(userspace/libsinsp)!: use unique_ptr in filtercheck allocate_new
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-22 12:05:05 +01:00
Luca Guerra ff0ea6d759 cleanup(libsinsp): fix misaligned access to cmsghdr
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-22 11:52:05 +01:00
Luca Guerra aad5f2a8c4 fix(tests): fix warning for unshare
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-22 11:52:05 +01:00
Luca Guerra 2eaf8a1ccf cleanup(libsinsp): remove some more misaligned accesses
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-22 08:17:05 +01:00
Roberto Scolaro d8bfc3ce13 fix(test/libsinsp_e2e): correctly manage cmake deps
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 00e44ae132 fix(tests): improved error handling with subprocesses
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 1f089621a4 fix(tests): invoke helper scripts with absolute paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro f16b7a215d fix(test): use builtin parameter type converter
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 455a2a0632 fix(tests): fix load of misaligned addresses
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro c3a662efbf fix(ci): exclude quotactl_ok test on arm64
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 130e1a5c04 fix(ci): remove s390x e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 8f04f1baeb fix(tests): build test_helper_32 only on x86_64
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 66cad21c9e fix(tests): use new libsinsp_e2e comm
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 3fe47c4f54 fix(ci): change libsinsp_e2e dir
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 69fb04d413 fix(ci): use correct e2e libsinsp cmake flag
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 8772574fad fix(ci): correctly handle job matrix
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 5791ab3c8f fix(ci): remove typo
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 81f6e7c076 chore(cmake): warning users on usage of libsinsp e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 11e935d638 chore(tests): document libsinsp e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 8119a68369 fix(tests): fix minor unshare_ test issues
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro e671810c98 fix(tests): use correct directory for captures
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro c6246399b0 chore(tests): rename new libsinsp_e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro af63f49960 fix(ci): don't fail fast on libsinsp_e2e
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 6ca81ca2ee clenaup(ci): move new e2e tests in another workflow
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro ebad4add94 feat(ci): add e2e libsinsp tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Roberto Scolaro 59fff90aa9 feat(tests): new e2e tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-21 15:09:03 +01:00
Federico Di Pierro 0500bdbdca cleanup(ci): dropped circleCI.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-21 10:32:02 +01:00
Luca Guerra fc0b50f80b fix(tests): add missing bools to sinsp threadinfo
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-16 18:33:38 +01:00
Federico Aponte afb905a441 cleanup: Split class sinsp_with_test_input into hdr + src
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-02-16 16:30:38 +01:00
Luca Guerra 2f4e75e230 new(gha): enable and enforce UndefinedBehaviorSanitizer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-16 16:16:38 +01:00
Roberto Scolaro 21c51fd147 chore(libsinsp): remove unsused parse_suppresed_types function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-16 13:23:37 +01:00
Roberto Scolaro 82fa06c4c0 chore(libsinsp): remove unused parse_iso8601_utc_string function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-16 13:23:37 +01:00
Roberto Scolaro ff73cf54f5 chore(libsinsp): remove unused find_env funcs
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-16 13:23:37 +01:00
Roberto Scolaro 797e8841bc chore(libsinsp): remove unused function event_name_by_id
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-16 13:23:37 +01:00
Roberto Scolaro 686ca9eb99 chore(libsinsp): remove unused function
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-16 13:23:37 +01:00
Gerald Combs cc835bd942 update(cmake): Use the static CRT on Windows by default
Set CMAKE_MSVC_RUNTIME_LIBRARY to "MultiThreaded" unless it was set
externally or if we're building shared libs. This

- uses CMake's documented variable to control CRT linking.
- ensures that we use the static CRT by default.
- allows the CRT setting to be overridden.

Add a Windows shared CRT CI job.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-02-16 10:26:36 +01:00
Federico Di Pierro 7d5b201250 fix(ci): fixed update-syscalls input.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-16 10:25:35 +01:00
Luca Guerra 3b8e4f1d10 fix(libscap): free proclist info upon platform close
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-15 19:34:33 +01:00
Luca Guerra 3d5d2d3d45 cleanup(libsinsp): populate procinfo event params with scap_event_encode_params
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-14 21:38:27 +01:00
Luca Guerra b243b658a1 cleanup(libsinsp): cleaner cast in operand comparison
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-14 21:38:27 +01:00
Luca Guerra 5ce02349bc cleanup(libsinsp): add default value for container type
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-14 19:41:28 +01:00
Luca Guerra 237212e8df fix(libsinsp): initialize m_exe_... in threadinfo
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-14 19:33:27 +01:00
Gianmatteo Palmieri f7437f17d8 new(test): add sendto and sendmg udp connection tests
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-14 09:26:25 +01:00
Gianmatteo Palmieri fee3c5023f fix(modern_bpf): null destination address in sendmsg syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-14 09:26:25 +01:00
Gianmatteo Palmieri 4a077429f0 chore(modern_bpf): add more detailed comment
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-14 09:26:25 +01:00
Gianmatteo Palmieri b20b1f750d fix(modern_bpf): null destination address in sendto syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-14 09:26:25 +01:00
Roberto Scolaro 9c50108f95 fix(chisel): don't fail if directory doesn't exist
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-13 21:11:23 +01:00
Federico Di Pierro e54666d1f1 fix(ci): fixed pages workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-12 10:14:14 +01:00
Wiktor Gołgowski 6d47405bd2 fix(driver): configure newfstatat with UF_ALWAYS_DROP
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
2024-02-10 07:20:07 +01:00
Jason Dellaluce 9932142d91 fix(userspace/libsinsp): avoid macro redefinition
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-09 17:10:05 +01:00
Jason Dellaluce d5a0c9d112 update(userspace/libsinp): allocate str buffer only when needed in filters
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-09 17:10:05 +01:00
Jason Dellaluce 8453c92b6a fix(userspace/libsinsp): solve evt encoding issues in plugin tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-09 17:10:05 +01:00
Jason Dellaluce b2c84aeee6 refactor(userspace/libsinsp): cleanup filtercheck classes
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-09 17:10:05 +01:00
Federico Aponte 8a5cbfb5ef fix: Make include paths more precise
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-02-09 17:09:05 +01:00
Federico Aponte 7805d84004 fix: include path in pkg-config files
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-02-09 17:09:05 +01:00
Federico Aponte 158820a48e fix: include paths when installed
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-02-09 17:09:05 +01:00
Federico Di Pierro 08ae1c0e9c cleanup(ci): use new kernel-testing provided composite action.
Moreover, bumped the framework to v0.3.0.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-09 15:40:04 +01:00
Leonardo Grasso 36ab4098fe fix(cmake/modules): correct missing includes for libbpf
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-02-09 11:14:04 +01:00
Luca Guerra 0c8c5d8a05 cleanup(libscap): fix unaligned memory reads
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-08 13:17:00 +01:00
Luca Guerra 553a77239a cleanup(libsinsp): cleanup unaligned access in plugin framework+tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-02-08 10:21:59 +01:00
RohithRaju 5d811ce582 "Revert: made changes as per review request"
This reverts commit 41208ceaeea0fe5c17944c78a27a0c6b6a67ee1f.

Signed-off-by: RohithRaju <rohithraju488@gmail.com>
2024-02-07 10:04:56 +01:00
RohithRaju 71c85a26ef update: made changes as per review request
Signed-off-by: RohithRaju <rohithraju488@gmail.com>
2024-02-07 10:04:56 +01:00
RohithRaju 9241311a77 update: use unsigned long
Signed-off-by: RohithRaju <rohithraju488@gmail.com>
2024-02-07 10:04:56 +01:00
RohithRaju e21c203e27 update: address review requests
Signed-off-by: RohithRaju <rohithraju488@gmail.com>
2024-02-07 10:04:56 +01:00
rohith-raju 3211999fab update(bpf): introduce the BPF commands name
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2024-02-07 10:04:56 +01:00
Gianmatteo Palmieri 3f44a07417 fix(libsinsp): return false on set_config when api symbol is not defined
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri be0e88704a new(libsinsp): add return code to plugin set_config
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri 5c6814cd1c new(libsinsp): enforce plugin initialization on set_config
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri fd35852b8a chore(userspace/plugin): bump plugin api version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri 86e079b2df chore(userspace/plugin): add plugin_set_config docs
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri f226e68e16 new(test): add plugin_set_config test
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Gianmatteo Palmieri 24a87fa907 new(libsinsp): add plugin dynamic reconfiguration
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-02-06 18:40:54 +01:00
Melissa Kilby 082e08adc9 cleanup(libsinsp): adjust setting max_thread_table_size
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-02-06 18:36:55 +01:00
Lorenzo Susini 1fc578d1de refactor(userspace/libsinsp): modularize parse_check and split into different functions
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-02-06 18:28:54 +01:00
Jason Dellaluce 73a99e0cb9 refactor(userspace/libsinsp)!: adopt new accessors to use class member fields
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-06 14:35:53 +01:00
Jason Dellaluce 33e2ff5d77 refactor(userspace/libsisp)!: remove VISIBILITY macros and friend classes
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-06 14:35:53 +01:00
Roberto Scolaro 3942a2c957 fix(driver): always retrieve the local iov
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro 2db07b6f7a fix(test/drivers): write on parent memory
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro 0e5a881264 fix(driver): set appropriate schema version
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro debac3f3e3 fix(test/drivers): wait the right pid
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro 69b41f2bcd chore(driver): bump schema version
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro 4502d4c188 fix(driver): don't push redundant size with process_vm syscall
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro a4f0a943df feat(driver): add support for process_vm syscalls
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 13:19:54 +01:00
Roberto Scolaro efa13659cc chore: remove HAS_CAPTURE define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 11:20:53 +01:00
Gerald Combs a89fd5d510 update(cmake): Set our preferred Visual C++ runtime the same way everywhere
If we're using CMake 3.15 or later, select our Visual C++ runtime using
CMAKE_MSVC_RUNTIME_LIBRARY. Otherwise use FALCOSECURITY_LIBS_DEBUG_FLAGS
and FALCOSECURITY_LIBS_RELEASE_FLAGS.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2024-02-06 11:18:54 +01:00
Roberto Scolaro b753fe8647 cleanup(libsinsp): remove CYGWING_AGENT feature gate
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-06 10:36:53 +01:00
Jason Dellaluce 2e2833f7f1 fix(userspace/libsinsp): fix some warnings and failed assertions in debug mode
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-05 23:23:51 +01:00
Jason Dellaluce 93a04bb92f fix(userspace/libsinsp): link issue in shared lib build
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
Jason Dellaluce d92af0898f fix(userspace/libsinsp): solve comparison issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
Jason Dellaluce 3e4adaa15a chore(userspace/libsinsp): avoid ambiguities on compare functions
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
Jason Dellaluce b14e0c16d2 fix(userspace/libsinsp): prevent filter outputting from overwriting comparison values
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
Jason Dellaluce d3e7ab2aff refactor(userspace/libsinsp): cleanup filter and checks interfaces
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
Jason Dellaluce 47e245f3d3 refactor(userspace/libsinsp)!: drop gen_event filter interfaces
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 11:52:36 +01:00
poiana c9aa2b954e update(driver): update syscalls tables and driver report.
Signed-off-by: GitHub <noreply@github.com>
2024-02-01 10:56:36 +01:00
Roberto Scolaro fa62e251d5 fix(modern_bpf): consider arg len = MAX_PROC_ARG_ENV edge case
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-01 10:47:36 +01:00
Roberto Scolaro 41385b0354 fix(modern_bpf): fix args/env retrival in case of large args/env
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-02-01 10:47:36 +01:00
Jason Dellaluce 0e61a93ea1 fix(userspace/libsinsp/test): put a bound to threat table max size test
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 10:27:37 +01:00
Jason Dellaluce 6602651df0 chore(userspace/libsinsp/test): reduce duration of mpsc queue test
This will hopefully accomodate the Windows runners of our CI,
which seem to produce ~64 elements per second :/

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 10:17:37 +01:00
Jason Dellaluce 171a735076 fix(userspace/libsinsp/test): avoid deadlocks in mpsc queue tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-02-01 10:17:37 +01:00
Federico Di Pierro 0f8c43ef12 chore(ci): bumped rn2md to latest master.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-31 18:24:35 +01:00
Luca Guerra 9cd289cb27 update(ci): allow libelf testing for musl
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-31 17:46:35 +01:00
Luca Guerra 96f47ee971 new(build): allow building with dynamic libelf
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-31 17:46:35 +01:00
Andrea Terzolo d75fb11d53 docs(sinsp): avoid `<>` in filter checks description
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-01-31 16:07:34 +01:00
Andrea Terzolo 74fdfc1883 docs(sinsp): fix description for k8s fields
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-01-31 16:07:34 +01:00
Federico Di Pierro 3d757a2ef3 chore(tests): pin event-generator 0.10.2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-31 10:48:34 +01:00
Federico Di Pierro b505879301 fix(test/e2e): fixed event-generator cmdline arguments.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-31 10:48:34 +01:00
Jason Dellaluce bfbc0076b4 fix(userspace/libsinsp): restore windows build
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-30 13:09:32 +01:00
Jason Dellaluce 781ecf895f fix(userspace/libsinsp): solve compilation issues with ifinfo tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-29 18:27:28 +01:00
Jason Dellaluce 1f91d58cc3 refactor(userspace/libsinsp): move ifinfo tests under test dir and run it
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-29 18:27:28 +01:00
Roberto Scolaro 97359207be fix(modern_bpf): define MAP_RENAME only on powerpc
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-29 18:09:29 +01:00
Roberto Scolaro ceda2188d7 fix(modern_bpf): fix wrong sign when getting quotactl cmd arg
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-29 15:03:28 +01:00
Roberto Scolaro eb09ef297d fix(libsinsp): check on requested severity
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-29 10:18:27 +01:00
Roberto Scolaro 6600ae9390 chore(libsinsp/test): remove some more relative includes leftovers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-26 17:13:18 +01:00
Roberto Scolaro e563bfae4a chore(ci): reorganize semgrep files
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-26 17:13:18 +01:00
Roberto Scolaro f7c1321b3c fix: remove some relative paths leftovers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-26 17:13:18 +01:00
Roberto Scolaro cc8e78b33c feat(ci): add checks for relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-26 17:13:18 +01:00
Federico Aponte 4055928c48 fix: Clang warning pessimizing move
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-26 12:08:18 +01:00
Gianmatteo Palmieri fd72377dc8 new(libsinsp): fallback to plugin name when logging component is null
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 5aca30474a chore(userspace/plugin): improved docs in plugin api
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 5708422554 update(userspace/plugin): bump plugin API version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri ff525c0485 new(libsinsp): add unit test for plugin logging
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 74947a34d1 refactor(libsinsp): better plugin logging function naming
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri db14578158 chore(libsinsp): add more detailed docs to plugin_api
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 4673bface3 new(libsinsp): add component string to plugin log function
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 09ab1704a0 new(libsinsp): add logging to plugin examples
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 6585c201b0 fix(libsinsp): use const char pointers in plugin_api
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Gianmatteo Palmieri 78b4807d14 feat(libsinsp): add logging capabilities to plugin api
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-26 10:59:18 +01:00
Federico Di Pierro 7f329c95ee fix(userspace/libsinsp): revert to old `concatenate_paths` helper function for perf reasons.
Also, added some small fixes and lots of new tests.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-26 10:01:18 +01:00
Jason Dellaluce a956750df9 fix(userspace/libsinsp): solve segfault when formatting string views
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-25 17:18:16 +01:00
Jason Dellaluce 0b46216c2a fix(userspace/libsinsp): solve init data races in logger
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-25 17:18:16 +01:00
Roberto Scolaro 83f9723038 chore(cmake): move kmod/bpf options under linux
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-25 17:16:15 +01:00
Roberto Scolaro 489068cc34 feat(cmake): selectively disable bpf and kmod engines
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-25 17:16:15 +01:00
Andrea Terzolo 1bd8c1baf3 fix(driver/bpf): decrease limits to support some GKE env
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2024-01-24 18:35:14 +01:00
Roberto Scolaro 7c4cb27e06 fix(driver): fix another potential deadlock
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-24 14:23:14 +01:00
Roberto Scolaro c7dd87c905 fix(driver): fix potential deadlock
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-24 14:23:14 +01:00
Federico Di Pierro eb7233a354 fix(userspace/libpman): only add ProbeSkeleton dep if ProbeSkeleton is a target.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-24 11:07:13 +01:00
Federico Di Pierro bf6e77ad88 new(ci): added drivers_ci job to test external modern_bpf skeleton scap-open build (like kernel tests and Falco do).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-24 11:07:13 +01:00
Jason Dellaluce 8b05ac9c8e refactor(userspace/libsinsp)!: access file descriptor tables through apis
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-23 16:10:09 +01:00
Jason Dellaluce 06ec6258a5 refactor(userspace/libsinsp)!: file descriptor management
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-23 16:10:09 +01:00
Gianmatteo Palmieri 645315e764 chore(driver): add comment about flag definition
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Gianmatteo Palmieri 86bc16df33 chore(driver): remove unnecessary comments
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Gianmatteo Palmieri 8834045cb0 fix: indentation issues
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Gianmatteo Palmieri 5b1fb98ecd chore(driver): bump schema version
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Gianmatteo Palmieri a9a31c6ac7 fix(driver): don't send buffer pointer to userspace
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Gianmatteo Palmieri fc465f63aa feat(driver): add support for newfstatat syscall
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
2024-01-23 14:04:09 +01:00
Jason Dellaluce 940257a9da clenup(userspace/libsinsp): remove unused filter compiler flag
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-23 09:00:08 +01:00
Jason Dellaluce e2734c72b0 refactor(userspae/libsinsp): api methods for controlling automatic routines
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 18:50:08 +01:00
Jason Dellaluce 9d2ff1e2cc refactor(userspace/libsinsp): cleanup chisel metrics
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 15:52:07 +01:00
Jason Dellaluce e0a1a15148 refactor(userspace/libsinsp): deprecate unused legacy SIMULATE_DROP_MODE flag
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 15:52:07 +01:00
Jason Dellaluce 06810a5748 cleanup(userspace/libsinsp): remove unused defines
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 15:52:07 +01:00
Jason Dellaluce 0e0bb190b0 chore(userspace/libsinsp): remove useless ifdefs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 15:52:07 +01:00
Jason Dellaluce 31fc3665e9 refactor(userspace/libsinsp): make tid collision a property of the observer
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-22 15:42:07 +01:00
Federico Aponte b13c5f9118 cleanup: Modernize C++ struct/enum/union declarations
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-22 11:19:06 +01:00
Roberto Scolaro cc1f37d18d fix(libscap): restore configurable cmake variables
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 440f9e8bee fix(test/libscap): remove libs relative imports
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 5e9072d133 fix(cmake): include correct directories in pkg-config
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 981294868d refactor(driver): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 2d9f549038 refactor(test): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 57c3da815e refactor(chisel): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 66731b0f6c refactor(libpman): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro c573887e51 refactor(plugin): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 6f8cb4707e refactor(libsinsp): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 1ce4d9f03e refactor(libscap): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Roberto Scolaro 78dce916fd refactor(cmake): remove libs relative include paths
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-19 17:59:00 +01:00
Federico Aponte 1e86789bf6 build: Make a few more functions const
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-19 11:34:59 +01:00
Federico Aponte d6b5e12ba3 refactor: Add some const-correctness
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-19 11:34:59 +01:00
Federico Di Pierro 1abab55847 chore(ci): properly use actuated helper action to install arm64 headers.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-18 09:28:57 +01:00
Roberto Scolaro 1c644a45a7 fix(libsinsp): set glob_match to be case insensitve by default
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-18 08:28:56 +01:00
Roberto Scolaro 2c1ef6cbb5 new(libsinsp): add iglob operator
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-18 08:28:56 +01:00
Federico Aponte a7c88dcfbf build: Improve scap-engine-noop dependency
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-18 07:59:56 +01:00
Luca Guerra fc4b79c87a cleanup(libsinsp): use string_view in user/group functions
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-17 10:17:55 +01:00
Luca Guerra 393da1e812 cleanup(libsinsp): use string instead of character buffer
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-17 10:17:55 +01:00
Luca Guerra cb7d0f14ff fix(libsinsp): use std::string in add_filename(_raw)
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-17 10:17:55 +01:00
Luca Guerra 30ab07a176 cleanup(libsinsp): use native comparison operators for string_view
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-17 10:17:55 +01:00
Luca Guerra d67fdf5735 cleanup(libsinsp): use string_view in parse_dirfd
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-17 10:17:55 +01:00
Federico Aponte ae2f8a1c49 fix(pman): missing probe skeleton header file
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-17 10:08:54 +01:00
Roberto Scolaro 48277b17e1 fix(libsinsp): address more review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro cb309fa80c refactor(libsinsp): use smart pointers for cri_settings
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro 4ef81e12b2 chore(test): add test for cri_settings
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro 93a8bd8fb3 refactor(libsinsp): move cri settings in another file
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro 445bc5f965 refactor(libsinsp): use static global instead of static local instance
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro 851da8eee9 refactor(libsinsp): make cri::settings funcs static
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro 42f220c2c7 refactor(libsinsp): remove extern cri vars
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:17:52 +01:00
Roberto Scolaro dae7cb7817 fix(libsinsp): avoid double dumping containers and users
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro aa8b9d7cb7 fix(libsinsp): properly cleanup sinsp_cycledumper
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro b2264b0e3f fix: address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro 060b3a206e refactor(libsinsp): use ONE_SECOND_IN_NS macro
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro 213cd5987b refactor(libsinsp): use smart pointers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro 34c4c7ee83 refactor(libsinsp): use smart pointer consistently
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Roberto Scolaro 269ebc3b16 refactor: replace cyclewriter with sinsp_cycledumper
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-16 17:05:52 +01:00
Gerlando Falauto 21bdac22fb fix(driver): add preprocessor guards for oldest 2.6.32 kernels
recent updates to the driver broke the driver build for very
ancient 2.6.32 kernels on CentOS 6 (e.g. 2.6.32-71.24.1.el6):

socketcall_to_syscall.h:208:7: error: 'SYS_SENDMMSG' undeclared (first use in this function)
   case SYS_SENDMMSG:
        ^
So add the appropriate preprocessor guards to get it to compile.

Signed-off-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
2024-01-16 12:51:50 +01:00
Federico Aponte 77dc7ded07 Fix another Lua version issue on CI
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-16 10:24:50 +01:00
Federico Aponte b96054d34f Fix a missing update of deprecated libLua functions
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-16 10:24:50 +01:00
Federico Aponte eec0cac0ee Use liblua5.2 for CI builds
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-16 10:24:50 +01:00
Federico Aponte c233d96199 chore: Use modern Lua functions in chisels
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2024-01-16 10:24:50 +01:00
Luca Guerra c9a7613017 cleanup(gvisor): lint (indentation)
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-15 15:09:48 +01:00
Luca Guerra f271fd47eb cleanup(gvisor): use scap_gvisor_platform in params
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-15 15:09:48 +01:00
Luca Guerra 4b1a35a6de cleanup(libscap): do not assert on unsupported getpid_global
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-15 15:09:48 +01:00
Luca Guerra cee52a706e fix(gvisor): handle arbitrary sandbox IDs
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-15 15:09:48 +01:00
Melissa Kilby 35083ad4de update(libsinsp): double thread_table_absolute_max_size
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2024-01-15 09:49:48 +01:00
Everett Badeaux b993f6db91 fix(libsinsp): modify switch case
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2024-01-15 09:39:48 +01:00
Luca Guerra 8f4598a8bc fix(ci): do not install headers if drivers are not modified
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-12 19:31:41 +01:00
Luca Guerra d78fc369e9 fix(libsinsp): fix compiler warning
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-12 08:34:39 +01:00
Luca Guerra 9ae91924bf fix(libsinsp): fix compiler warning
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-12 08:34:39 +01:00
Luca Guerra 35b38b80fe fix(cmake): reintroduce -Werror with BUILD_WARNINGS_AS_ERRORS
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-01-12 08:34:39 +01:00
Federico Di Pierro ff0f8114c5 chore(ci): bumped rn2md to latest master.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-11 09:52:38 +01:00
Matthew Knight 8a5b3e7aea add new cgroup layout for podman
Signed-off-by: Matthew Knight <matthew.knight@sysdig.com>
2024-01-11 09:23:37 +01:00
Jason Dellaluce ad3e824cdf chore(userspace/libsinsp): improve docs about thread info filtering
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-08 19:46:30 +01:00
Jason Dellaluce 2870b06559 chore(userspace/libsinsp): apply review suggestions
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-08 19:46:30 +01:00
Jason Dellaluce ee9bccf1ca fix(userspace/libsinsp): consistent thread info filtering while dumping
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-01-08 19:46:30 +01:00
Roberto Scolaro 934a639468 refactor(libsinsp): avoid to include sinsp.h where not necessary
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 688add7901 refactor(libsinsp): move logger macros in separate file
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 22d8109fb5 refactor(libsinsp): move logger outside sinsp class
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 8807da6bb4 fix(libsinsp): rename get_logger() to logger()
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 97667256fd refactor(libsinsp): use static global instead of static local instance
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 406e2bec2e refactor(libsinsp): always use sinsp::get_logger accessor
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 0ad99ff221 feat(libsinsp): add getter for log instance
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro 012e59648e refactor(libsinsp): adopt the new logger interface
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Roberto Scolaro bf832cfdab refactor: singleton sinsp_logger
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2024-01-04 19:44:15 +01:00
Angelo Puglisi 128f345e9d fix(userspace/libscap): scap_log macro
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2024-01-03 17:07:14 +01:00
Jason Dellaluce 2d6cccedde fix(userspace/libsinsp): not report container id as host on failed lookups
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-22 15:35:21 +01:00
Luca Guerra e9333d9738 fix(libscap): remove ASSERT(false) on handled errors
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-22 12:29:20 +01:00
Jason Dellaluce 12732fe5d7 fix(userspace/libsinsp): do not suppress zero ptids
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-20 22:12:13 +01:00
Luca Guerra e2dbeb3a85 fix(libscap/gvisor): use consistent new/delete functions for gvisor platform
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-20 22:09:14 +01:00
Jason Dellaluce 37e31d2001 fix(userspace/libsinsp): fix resolved PT_FSPATH and PT_FSRELPATH evt args
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-20 14:08:12 +01:00
Roberto Scolaro 0d65836866 fix: always initialize threadinfo on the stack
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-12-19 16:06:08 +01:00
Luca Guerra 0eb94452f8 fix(libsinsp): fix -WReorder warning
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-19 11:33:07 +01:00
Luca Guerra ee01ba2b66 cleanup(ci): remove ssh debug job for actuated
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-18 18:07:01 +01:00
Andrea Terzolo 921409a2ba new(sinsp): use common helpers around the code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby 17f96d3566 fix(libsinsp): also init argid for proc.aenv filter
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby 59dcd8d5a8 cleanup(libsinsp): adjust env iterator and key matching
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby d4f74ed243 refactor(libsinsp): expand usage of proc.aenv filtercheck
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby a048f656b7 cleanup(libsinsp): adjust desc of proc.aenv, tag as EXPERIMENTAL
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby 0c9dec0664 chore: lint proc fields descriptions
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby 26bc24afcc new(libsinsp): expose proc.aenv and proc.aenv[ENV_NAME] filter and display fields
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Melissa Kilby 956ccc233a new(libsinp): expose proc.env[ENV_NAME] without changing default proc.env behavior
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-18 18:02:02 +01:00
Angelo Puglisi 4706f4c639 fix(scap): Potential leak of memory pointed to by 'heap_tinfo'
```
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:144:11: warning: Potential leak of memory pointed to by 'heap_tinfo' [clang-analyzer-unix.Malloc]
                        return scap_errprintf(error, errno, "can't allocate procinfo struct");
                               ^
/code/falcosecurity/libs/userspace/libscap/strerror.h:30:24: note: expanded from macro 'scap_errprintf'
                       ^
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:82:5: note: Assuming 'fdinfo' is equal to NULL
        if(fdinfo != NULL)
           ^~~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:82:2: note: Taking false branch
        if(fdinfo != NULL)
        ^
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:141:33: note: Memory is allocated
                scap_threadinfo *heap_tinfo = malloc(sizeof(*heap_tinfo));
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:142:6: note: Assuming 'tinfo' is equal to NULL
                if(tinfo == NULL)
                   ^~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:142:3: note: Taking true branch
                if(tinfo == NULL)
                ^
/code/falcosecurity/libs/userspace/libscap/scap_procs.c:144:11: note: Potential leak of memory pointed to by 'heap_tinfo'
                        return scap_errprintf(error, errno, "can't allocate procinfo struct");
                               ^
```

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2023-12-18 16:08:01 +01:00
Angelo Puglisi 613409134e fix(sinsp): Called C++ object pointer is null
```
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:450:5: warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage]
        if(m_inspector->is_offline() || (m_inspector->is_plugin() && !m_inspector->is_syscall_plugin()))
           ^
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:287:6: note: Assuming the condition is false
                if(m_last_accessed_fd != -1 && fd == m_last_accessed_fd)
                   ^~~~~~~~~~~~~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:287:31: note: Left side of '&&' is false
                if(m_last_accessed_fd != -1 && fd == m_last_accessed_fd)
                                            ^
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:301:14: note: Value assigned to field 'm_inspector'
                if(fdit == m_table.end())
                           ^~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:301:3: note: Taking false branch
                if(fdit == m_table.end())
                ^
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:311:8: note: Assuming pointer value is null
                        if (m_inspector != nullptr && m_inspector->m_sinsp_stats_v2)
                            ^~~~~~~~~~~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:311:31: note: Left side of '&&' is false
                        if (m_inspector != nullptr && m_inspector->m_sinsp_stats_v2)
                                                   ^
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:318:4: note: Calling 'sinsp_fdtable::lookup_device'
                        lookup_device(&(fdit->second), fd);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/code/falcosecurity/libs/userspace/libsinsp/fdinfo.cpp:450:5: note: Called C++ object pointer is null
        if(m_inspector->is_offline() || (m_inspector->is_plugin() && !m_inspector->is_syscall_plugin()))
           ^~~~~~~~~~~
```

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2023-12-18 16:08:01 +01:00
Andrea Terzolo 0754fba03e cleanup(sinsp): remove some dead code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-18 14:15:01 +01:00
Andrea Terzolo e6db0e6534 cleanup(sinsp): add some inline and const
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-18 14:15:01 +01:00
Federico Di Pierro e4585f2533 chore(ci): gvisor is only allowed on x86_64.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-18 13:54:01 +01:00
Federico Di Pierro f0b808356e fix(ci): fixed drivers ci on actuated.dev arm64 node with a workaround.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-18 13:54:01 +01:00
Federico Di Pierro 2157c88449 chore(driver): bumped API version patch.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-18 13:54:01 +01:00
Federico Di Pierro bf0afa0cac fix(driver): fixed build against linux v6.7-rc5.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-18 13:54:01 +01:00
Gerald Combs f8999099ef update(cmake): Make sure we install our library on Windows
We build re2.lib on Windows; make sure we install that.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-12-16 17:03:52 +01:00
Melissa Kilby 3b75dacfb8 cleanup(libsinsp): improve k8s and container field desc even more + k8s test variable naming fix
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby 2fe0898bc1 cleanup(libsinsp): simplify k8s sandbox id filterchecks
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby 93cae84b0f cleanup(libsinsp): enhance container.* fields descriptions
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby e9726b9896 cleanup(libsinsp): apply reviewers suggestions
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby 941cc8156c chore: make container label tests more robust
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby b8c8037458 chore: move k8s.ns.name up in k8s fields definitions
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby edfd6a9b10 new(libsinsp): support k8s.pod.label lookup with brackets
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby 4a9b698f18 refactor(cri): keep legacy k8s.pod.id for pod UID, introduce new sandbox ID fields
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby e54ef0e769 new(cri): expose full container and pod ids
* Allow for more flexibility in adoption as truncated IDs can cause collisions
* Considered as feature completeness

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Melissa Kilby d4b312ad2a feat/fix(cri): send correct k8s.pod.id and introduce k8s.pod.uid
* k8s.pod.id incorrectly sends the pod uid which is a different identifier. Note that this is not a refactor nor a change intended for semantic adjustments, it is a bug.
* introduce k8s.pod.uid instead so the uid field is still accesible
* do not yet refactor the container engine and continue extracting these fields from the container labels

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-16 11:28:51 +01:00
Federico Di Pierro 9d8c0a4bab new(ci): added actuated ssh workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-15 09:45:49 +01:00
Andrea Terzolo 407f54c93d cleanup(sinsp): remove unused file
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-14 19:02:47 +01:00
Melissa Kilby ef8ca6037e cleanup(libsinsp): apply reviewers suggestions
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-14 17:28:47 +01:00
Melissa Kilby 66c1830eca fix(libsinsp): fix null termination string issues in fs.path filterchecks
Co-authored-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-14 17:28:47 +01:00
Melissa Kilby 50927fc2a5 fix(libsinsp): fix some path handling in fs.path + cleanup
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-14 17:28:47 +01:00
Federico Di Pierro f8a333397a chore(cmake): allow user to override GIT_COMMIT from cmake.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-14 12:43:47 +01:00
Luca Guerra 38ce00f039 fix(libsinsp): do not include null terminator in enter event strings
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-13 18:17:45 +01:00
Andrea Terzolo ea092b0d97 cleanup(tests): remove compilation warnings
`resp_sandbox_container_info` variable is unused

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-13 16:43:46 +01:00
Andrea Terzolo a84c3cd16f fix(tests): include grpc definitions in container tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-13 16:43:46 +01:00
Federico Di Pierro ea23169c13 chore(ci): skip each step to avoid issue like https://github.com/orgs/community/discussions/9141.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Di Pierro 26e2098473 chore: drivers_ci new name.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Di Pierro 05a4b246bc chore(ci): make sure required status checks jobs are always run (and skipped eventually).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Di Pierro 94b10a562d chore: avoid build-libs-linux- job name breaking change.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Di Pierro 59413447a5 chore(ci): consistent naming between ci and drivers_ci for amd64 and arm64.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Di Pierro 058399607e new(ci): make use of `automated` arm64 nodes for arm64 jobs.
Moreover, split up `drivers_ci` from main `ci` to simplify maintenance.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-13 15:35:46 +01:00
Federico Aponte 1165d2635a build: Fix more errors for shared lib scenarios
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 06a07b9646 build: Fix CI errors for shared lib scenarios
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 1fa37e3db3 build: remove STATIC from libs to be left unspecified
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 23b250bd97 Remove PMAN_DEPENDENCIES variable
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 035895cab2 Fix include path version.h
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte cac135811b Fix after rebase to latest revision
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 20db357fd3 build: add PRIVATE link property when missing
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Federico Aponte 49a77161ad build: add its own include path to each library
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-13 12:10:45 +01:00
Mark Stemm 68e4e79be8 Add unit test for sinsp_filter_check::can_have_argument
This loops through all filtercheck fields, creates a check, and
verifies that can_have_argument() only returns true for those checks
with EPF_ARG_* flags.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2023-12-13 10:46:45 +01:00
Mark Stemm e178243fd1 Add EPF_ARG_ALLOWED to filterchecks that can have arguments
Add EPF_ARG_ALLOWED flags to fields that can have arguments. This
will result in more accurate info about the field and will ensure that
filterchecks for these fields can not be cached.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2023-12-13 10:46:45 +01:00
Mark Stemm 9303491d8c Add can_have_argument(), don't cache anything for fields w/ args
Add a can_have_argument() method that checks the flags for the field
for either EPF_ARG_REQUIRED/EPF_ARG_ALLOWED.

When can_have_argument() is true, skip caching of both extractions and
comparisons. This ensures that two fields that are the same but have
different arguments are not mistakenly cached together.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2023-12-13 10:46:45 +01:00
Melissa Kilby 0672305e1e cleanup(libsinsp/test): update cri tests reflecting change in pod labels handling
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 5845581570 cleanup(libsinsp/test): apply reviewers suggestions
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 8f6956ee6e new(libsinsp/test): expand cri unit tests to cri-o + test all fields
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 68494eb7de cleanup(cri): convert to inline functions in cri.hpp
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 74f9e33ed3 chore: fix some test includes
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 40c39253df chore: move container_info.ut.cpp to container_engine folder
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby 72495afa84 new(libsinsp/test): test container filterchecks w/ mock API input data
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby fcf7cd8aae new(libsinsp/test): mock cri containerd runtime socket API and test cri parsers
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Melissa Kilby ee3c52319a new(libsinsp/test): new container_manager_cache_threadtable_lifecycle test
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-13 10:10:45 +01:00
Gerald Combs 32edd30f69 update(libsinsp,libscap): Make our .pc file paths relative
Set the various paths in our .pc files based on the `pcfiledir` variable
instead of using absolute paths. This should make it possible to install
using a DESTDIR that differs from CMAKE_INSTALL_PREFIX.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-12-13 10:08:45 +01:00
Aldo Lacuku 3a92e8af12 chore(libsinsp): remove redundant semicolon
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-12-13 09:34:45 +01:00
Andrea Terzolo 1cef7b4045 fix(sinsp): avoid a double free when an exception is thrown
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-12 21:07:44 +01:00
Aldo Lacuku dc1c41d7ef cleanup(libsinsp/container_engine): remove unused method
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-12-12 18:45:44 +01:00
Aldo Lacuku a43ab4a2f1 fix(container/cri-engine): populate labels field for pod sandbox containers.
The CRI differentiates the normal containers from the pause container. The pause container
is the same as the "pod sandbox". In the CRI context the "pod sandbox" is the only place
where the labels of the pod (as in kubernetes pod) are set. When handling a "pod sandbox"
we populate the the labels field that are extracted when the "k8s.pod.labels" field is needed.

At the same time we make sure that the normal containers have a special label, "io.kubernetes.sandbox.id=podSandboxID".
The special labels is used by the filterchecks to retrive the right "pod sandbox" and then get its labels.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-12-12 18:45:44 +01:00
Luca Guerra e330772dfb update(libsinsp): add windows path workaround
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-12 18:15:44 +01:00
Luca Guerra 45cdc28322 refactor(libsinsp): use a std::string_view in sinsp_threadinfo::set_cwd
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-12 18:15:44 +01:00
Luca Guerra 1a3178ed58 fix(libsinsp): update concatenate_paths signature, avoid ssize_t and clarify output
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-12 18:15:44 +01:00
Melissa Kilby 04e6019faf fix(libsinsp): adjust g_invalidchar to allow emojis, cyrillic, chinese etc
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Melissa Kilby 78124c803d cleanup(libsinsp): apply reviewers suggestions
Co-authored-by: Nathan Baker <nathan.baker@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Melissa Kilby 0f863730ef cleanup(libsinsp): apply reviewers suggestions
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Melissa Kilby ddfc29867a cleanup(test): adjust new concatenate_paths test
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Melissa Kilby 7c79383a19 fix(libsinp): correct new concatenate_paths for set_cwd
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Melissa Kilby b97eb99acf fix(libsinp): correct new concatenate_paths for openat* parsing
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 18:15:44 +01:00
Luca Guerra ebd86c909d refactor(libsinsp): rewrite concatenate_paths with std::filesystem
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-12 18:15:44 +01:00
Andrea Terzolo aa191bab83 new(tests): add a logging function for scap tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-12 17:57:44 +01:00
Andrea Terzolo dae6bcf1bb update(CI): try to catch at least some events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-12 17:57:44 +01:00
Melissa Kilby 1d4cabc91a cleanup(libsinsp/test): adjust sinsp_dns_manager test
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 17:56:44 +01:00
Melissa Kilby c8d86ff1ec fix(cmake): add tbb to unit-test-libsinsp
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 17:56:44 +01:00
Melissa Kilby 3c7463448c new(libsinsp/test): simple test for sinsp_dns_manager
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 17:56:44 +01:00
Melissa Kilby ad0f08b735 refactor(libsinsp): use smart pointer for m_resolver in sinsp_dns_manager
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-12-12 17:56:44 +01:00
Andrea Terzolo f693d52841 fix(CI): partially revert 404e6491b8
KERNELDIR is still needed when usign QEMU

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-12 14:45:43 +01:00
Andrea Terzolo 6efe5f12bd new(test): check `k8s.pod.label` syntax
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-12 12:37:43 +01:00
Andrea Terzolo 404e6491b8 fix(CI): remove KERNELDIR= since the default should be enough
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-11 16:24:39 +01:00
Everett Badeaux 8eb2fc2a07 cleanup(driver): unlinkat & linkat flags
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-12-11 12:19:39 +01:00
Gerald Combs 1845bb6d88 update(libsinsp): Add sinsp_evt::set_num
Event extraction can be cached based on the event number. Add a setter
so that externally constructed events can be cached correctly.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-12-11 10:59:39 +01:00
Gerald Combs 21746900e6 fix(libsinsp): Add a CPU count check
In a scap file I have here, minfo->num_cpus is 0 when
sinsp_filter_check_thread::extract_exectime is called. We handle this in
debug builds with an ASSERT, but need to check for this in release
builds as well. Bail out early if we either have no CPUs or if minfo is
NULL.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-12-11 10:53:39 +01:00
Federico Aponte cc5ceddece build: fix some more Clang warnings
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-11 10:45:39 +01:00
Federico Aponte 50131fb9e2 build: address some PR review concerns
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-11 10:45:39 +01:00
Federico Aponte 5cf1b22dfd build: Fix Clang warnings
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-11 10:45:39 +01:00
Federico Aponte 6509c8e539 fix: potentially uninitialized variables
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-06 14:33:27 +01:00
Federico Di Pierro 2809baf9b0 fix(ci): fixed update-syscalls syscalls-bumper action version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 10:42:26 +01:00
FedeDP 4db52f3817 update(driver): update syscalls tables and driver report.
Signed-off-by: GitHub <noreply@github.com>
2023-12-05 20:42:24 +01:00
Andrea Terzolo 000d576ef8 revert: commit `9198f61759b7bf32e2aa207d8a1973b696f9875a`
This PR https://github.com/falcosecurity/libs/pull/1160 is no more
necessary since the issue is now fixed in libbpf library

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:08:25 +01:00
Andrea Terzolo 0927ac9839 chore(libbpf): bump libbpf to `v1.3.0`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:08:25 +01:00
Andrea Terzolo c5c9574845 test: add new tests for k8s fields
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:05:25 +01:00
Andrea Terzolo 6b900ece0c fix(tests): remove a possible memleak from tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:05:25 +01:00
Andrea Terzolo b912dcdc65 update(libsinsp)!: k8s fields return a value only when we are in a pod
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:05:25 +01:00
Andrea Terzolo 1394beb502 cleanup(cmake): update minimal build description
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-12-05 18:05:25 +01:00
Hendrik Brueckner 98410bc7d9 fix(test/drivers): correct socketcall SYS_ACCEPT failures on s390x
The modern BPF driver maps the SYS_ACCEPT to SYS_ACCEPT4 which is being
tested in the socketcall SYS_ACCEPT tests.

The kmod and bpf drivers do not switch directly but rather ensure to
use the PPM event instead of syscall.  The socketcall SYS_ACCEPT tests
contain a specific handling for kmod.  Enable this handling to also for
the bpf driver.

Signed-off-by: Hendrik Brueckner <brueckner@de.ibm.com>
2023-12-05 01:00:23 +01:00
Jason Dellaluce 1aad982901 fix(userspace/libsinsp): zero-init time before string parsing
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-02 20:09:15 +01:00
Hendrik Brueckner 33c87ad13b fix(test): drop `socketcall`s in syscall enter events
Commit a094db8f "cleanup: align modern bpf behavior with other drivers"
changed the drivers test in the system exit events.  This commit also
ignores `socketcall`s with wrong call IDs in the system enter event
tests.

Signed-off-by: Hendrik Brueckner <brueckner@de.ibm.com>
2023-12-01 23:51:14 +01:00
Jason Dellaluce 12a257d343 fix(userspace/libsinsp): restore support to containers
This attempts fixing a regression introduced in 6332c34a64

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-01 23:46:14 +01:00
Roberto Scolaro 68c7ba9a44 fix(chisel): resolve compilation issue on win32
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-12-01 17:08:13 +01:00
Jason Dellaluce 6044d7baaf fix(userspace/libsinsp): make sure all destructors are invoked
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-12-01 14:08:13 +01:00
Federico Aponte 443bca539b build: remove some clang compiler warnings
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-12-01 14:05:13 +01:00
Melissa Kilby 8fee2fb479 fix(libsinsp): memleak in sinsp_dns_manager
LeakSanitizer: detected memory leaks
Direct leak of 8 byte(s) in 1 object(s) allocated from: ... 0x7f84317d54c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95 ... 0x56319abb44cc in sinsp_dns_manager::match(char const*, int, void*, unsigned long) /build/falcosecurity-libs-repo/falcosecurity-libs-prefix/src/falcosecurity-libs/userspace/libsinsp/dns_manager.cpp:121

add destructor to class sinsp_dns_manager to ensure m_resolver is always released when the object goes out of scope

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-30 11:25:07 +01:00
Andrea Terzolo 68a96aa5b7 new: add the possibility to link external test files
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-29 18:19:05 +01:00
mdafsanhossain 9677b66916 CI:Set fail-fast to false and change s390x/ppc64le job name
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain d20a314308 CI:Remove scap-open; build drivers_test for s390x/ppc64le
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 6b480718c3 fix: Rename powerpc macro and include riscv64 syscall headers
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain bf6f862750 new(CI): Add paths-filter to s390x/ppc64le job
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain bf00310232 new(CI):Combine s390x,ppc64le build jobs and remove libsinsp-unit-test
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 8caaf16c49 fix(test_suite): execveat_x fix for powerpc
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain d9faff0f30 new(kmod):PPC64 fixes for ia32_syscall
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 010d6dcc6f fix:remove extra parentheses
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 518aee5c63 new(bpf):Adds PPC64 config for BPF_SUPPORTS_RAW_TRACEPOINTS
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain e0138f60eb paths-filter for ppc64le build libs job
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 97266675f0 CI: build libs kmod,bpf,scap,unit-test-libsinsp on ppc64le
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
mdafsanhossain 1b13a9650f Add checks to support kmod,bpf on ppc64le
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-29 17:19:06 +01:00
Jason Dellaluce cabe6d3930 fix(usespace/libsinsp): check for null inspector before accessing stats
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-29 15:26:05 +01:00
Jason Dellaluce d144fdc938 fix(userspace/libscap): return error when silently skipping unknown or invalid proc infos
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-29 15:26:05 +01:00
Jason Dellaluce 123d9992bf fix(userspace/libsinsp): assign inspector platform before importing system info
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-29 15:26:05 +01:00
Luca Guerra e3f9c5ff8f fix(libsinsp): fix snprintf size warning
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-29 15:10:06 +01:00
Luca Guerra 546fec16b2 cleanup(libsinsp): remove get_param_as_json
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-29 15:10:06 +01:00
Hendrik Brueckner f61e7fff24 fix(update/drivers): correct `s390x` build break
Use `__NR_accept4` instead of `__NR_accept`.

Signed-off-by: Hendrik Brueckner <brueckner@de.ibm.com>
2023-11-29 13:53:05 +01:00
Melissa Kilby 6332c34a64 fix(libsinsp): fix possible segv in parse_connect_exit + cleanups
ERROR: AddressSanitizer: SEGV on unknown address 0x000000001578 ... The signal is caused by a WRITE memory access. #0 0x56074dd65dc8 in sinsp_parser::parse_connect_exit(sinsp_evt*) /build/falcosecurity-libs-repo/falcosecurity-libs-prefix/src/falcosecurity-libs/userspace/libsinsp/parsers.cpp:3361

Plus refactor few parsers to feature early returns if evt->m_tinfo is a nullptr

Remove some inconsistent debug ASSERT statements

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-29 10:59:06 +01:00
Federico Aponte 8d269a81b0 build: remove some warning suppressions
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-11-29 10:24:05 +01:00
Everett Badeaux 89ec22f38c cleanup: params inconsistencies
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-11-29 10:17:06 +01:00
Federico Aponte 1cc167d13b Remove outdated USE_BUNDLED_TINYDIR var
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-11-29 10:14:05 +01:00
Federico Aponte 055e1419db build: remove unused library b64
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-11-29 10:14:05 +01:00
Federico Di Pierro fb17551505 fix(test/drivers): skip unimplemented syscalls tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-28 13:01:04 +01:00
Federico Aponte 02877435e2 build: fix several compiler warnings
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-11-28 12:04:04 +01:00
Federico Aponte 4a57dbde21 chore: replace library tinydir with std::filesystem
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
2023-11-28 11:31:04 +01:00
Andrea Terzolo 041477e3ac fix: return a TIMEOUT instead of an EOF
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-27 16:00:00 +01:00
Luca Guerra a894e67c27 refactor(libsinsp): clarify comments and string conditions
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra ec9d62cac7 update(libsinsp): move exception to a separate function to facilitate inlining
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra 1e3caf1896 refactor(libsinsp): update get_param_as_str to remove potential ub
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra 955e3a28e0 refactor(libsinsp): use param->as<>() to interpret params
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra 44a11dcb25 refactor(libsinsp): simplify evt param, enforce const correctness
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra aa255fa773 refactor(libsinsp): const correctness for sinsp_evt_param
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Luca Guerra b6ed1192ec refactor(libsinsp): get_param_value_raw -> get_param_by_name
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-27 10:33:58 +01:00
Everett Badeaux c2fd3086ff cleanup(dup3): fix flags param
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-11-25 18:30:54 +01:00
Everett Badeaux 77b4328001 cleanup(dup3): fix flags param
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-11-25 18:30:54 +01:00
rohith-raju 76c72a7504 update: address review requests
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-24 23:12:51 +01:00
rohith-raju 370c644ac5 update: add cmd to bpf exit event
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-24 23:12:51 +01:00
Luca Guerra 1cd1cc1ce0 fix(libsinsp): return strings in syslog when they may be stack-allocated
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-24 18:49:50 +01:00
Jason Dellaluce f72e40c52f fix(userspace/libsinsp): dispose async event handler in emscripten
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 17:28:50 +01:00
Jason Dellaluce 5bd0c0eb83 refactor(userspace/libsinsp): remove meta events
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 17:28:50 +01:00
Luca Guerra 682a4a9ea9 update(libsinsp/tests): support async event generation from sinsp_with_test_input
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-24 17:07:50 +01:00
Jason Dellaluce d9a75112a9 refactor(userspace/libsinsp)!: drop support to protodecoders
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 16:59:50 +01:00
Melissa Kilby 7611bb8f8f update(test/vm): use local modern-falco-builder image
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-24 15:27:50 +01:00
Melissa Kilby eca946c6aa chore(test/vm): update localhost test vm kernels
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-24 15:27:50 +01:00
Jason Dellaluce ace53901af fix(userspace/libsinsp): minor code fixes
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce 90eee1d5a0 update(driver): bump api version by one major number
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce c18442e2f3 refactor(driver)!: remove support to tracers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce 01ed981666 refactor(userspace/libscap)!: remove support to tracers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce 55369bd603 refactor(userspace/libsinsp)!: deprecate tracers flags
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce 6c0637886a refactor(userspace/libsinsp)!: solve compilation issues with tracers deprecation
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce 0402a6320d refactor(userspace/libsinsp)!: remove references to tracers in code
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Jason Dellaluce c46b86c342 refactor(userspace/libsinsp)!: remove tracer source files
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-24 09:58:49 +01:00
Andrea Terzolo a094db8f48 cleanup: align modern bpf behavior with other drivers
when we receive a wrong socketcall code we drop the event

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-24 09:44:48 +01:00
Andrea Terzolo 99b2ba1905 cleanup
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-24 09:44:48 +01:00
Federico Di Pierro 1c78cac37f fix(driver,test): drop `socketcall`s called with wrong `SYS_` argument in all 3 drivers.
Uniformed: modern-bpf was already doing that after all.

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

Co-authored-by: brandonxin <brandonxin@tencent.com>
2023-11-24 09:44:48 +01:00
Jason Dellaluce b1f439ec29 update(userspace/libsinsp): elems in mpsc queue with same priority follow push order
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-23 20:34:45 +01:00
Luca Guerra 7cb284c385 cleanup(libsinsp): remove assert false on condition that can happen
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-23 20:05:45 +01:00
Luca Guerra 4c34acc4d3 cleanup(libsinsp): add scanf formats and fixed size variables
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-23 20:05:45 +01:00
Jason Dellaluce 78330cfbda fix(userspace/libsinsp): remove warning in scanf on uint64_t
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-23 17:40:45 +01:00
Roberto Scolaro 86b72e50b3 chore: remove jq dependency
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-22 14:31:42 +01:00
Roberto Scolaro ec613ef329 cleanup(libsinsp): remove unused sinsp_test.cpp
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-22 12:29:41 +01:00
Andrea Terzolo 4e9a3cc18e update: adopt the same behavior in all drivers
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-21 16:15:40 +01:00
Andrea Terzolo 919ddeee07 chore: bump API and SCHEMA version
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-21 16:15:40 +01:00
rohith-raju 915981ead4 update: address review requests
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-21 16:15:40 +01:00
rohith-raju 06c87d77e0 update: retain original parameter order
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-21 16:15:40 +01:00
rohith-raju 7733becc97 update: seperate getrlimit and setrlimit
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-21 16:15:40 +01:00
rohith-raju c269ce111e update(setrlimit): update args in setrlimit exit event
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-21 16:15:40 +01:00
rohith-raju fa1af58850 update(prlimit): update args in prlimit exit event
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
2023-11-21 16:15:40 +01:00
Roberto Scolaro fafd37df1c cleanup(libsinsp): remove stopwatch
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-21 13:13:39 +01:00
vadim.zyarko 011b081d7a update(userspace/libsinsp): add factory method for sinsp_evt from a given scap buffer
Co-authored-by: Vadim Zyarko <vadim.zyarko@sysdig.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-20 15:06:36 +01:00
Jason Dellaluce 60e5b748ea fix(userspace/libsinsp): solve test issues with emscripten and windows
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Jason Dellaluce e19b11390e update(userspace/libsinsp): avoid unwanted allocation when popping from async queue
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Jason Dellaluce cc21cded88 refactro(userspace/libsinsp): make mpsc queue api a bit more friendly
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Jason Dellaluce 35adc4b148 refactor(userspace/libsinsp): add tests scoped to mpsc queue
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Jason Dellaluce 00e449ebe5 fix(userspace/libsinsp): allow events with same timestamp to be fetched
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Jason Dellaluce 9764082fca fix(userspace/libsinsp): solve data race in mpsc priority queue
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-18 02:58:26 +01:00
Federico Di Pierro 364422d622 chore(ci): use syscalls-bumper composite action.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-18 02:54:26 +01:00
Melissa Kilby 9866af1640 cleanup(libsinsp): apply reviewers suggestions re sinsp stats v2
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby 1182f956b2 cleanup(libsinsp): don't count sanboxes as missing_container_images
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby 917741bd07 cleanup(libsinsp): add enable option for m_sinsp_stats_v2
* make m_sinsp_stats_v2 a smart pointer initialized only when enabling sinsp_stats_v2 counters
* only keep m_inspector nullptr check for `sinsp_thread_manager::remove_thread(int64_t tid)`

Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby ac4363519a fix(cmake): adjust setup re sinsp stats
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby e2492e8285 new(libsinsp): expose crucial container cache stats
- Get container cache stats via hijacking the periodic container cache flush functionality
- Includes some general cleanup

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby 7d3a3095f5 new(libsinsp): expose full threadtable drops to libsinsp stats
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby 7cdaf54202 feat(libsinsp): remove legacy libsinsp stats GATHER_INTERNAL_STATS
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby df02f0f64f cleanup(libsinsp): refactor legacy libsinsp stats
- Finalize exposing valuable legacy libsinsp stats / metrics / counters related to the sinsp state tables (e.g. adding, removing, storing, failed lookup activities) to the consolidated libsinsp stats
- Add counter of currently cached containers as well
- Includes additional cleanups

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby de038b98e2 new(test): add sinsp_stats unit test
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Melissa Kilby 4a84d4800a feat(libsinsp): move resource utilization to sinsp stats
- Prepare m_sinsp_stats_v2 buffer to hold more stats and metrics than resource utilization metrics
- Expand resource utilization metrics (e.g. include overall host CPU and memory usages)

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
2023-11-17 19:53:25 +01:00
Jason Dellaluce 5b8e3bf71e fix(test/libscap): adjust stats expectations for libbpf
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-15 21:09:16 +01:00
Jason Dellaluce 1b68561a24 fix(userspace/libscap): prevent libbf stats from being collected with no bpf stats
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-15 21:09:16 +01:00
Federico Di Pierro 477b6a0ac3 chore(docs): add `ppc64le` arch to architectures badge.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-15 20:04:15 +01:00
Andrea Terzolo ddf04d0747 cleanup: move a macro in a shared file
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 931c073707 cleanup(userspace/engine): remove udig engine
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 8cb44c8c14 cleanup(libscap): remove some udig stuff from libscap
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 0948718473 cleanup(driver): remove some ifdefs needed for the userspace integration
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 6ee32b7063 cleanup(cmake): remove `HAS_ENGINE_UDIG`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 817d4fb1f4 cleanup(.github): remove udig from PR template
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 0a19f9dca0 cleanup(libsinsp): remove udig open method
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Andrea Terzolo 805dea2c6d cleanup(kmod): remove udig ifdef from the driver code
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-15 18:21:15 +01:00
Luca Guerra 429e19aa69 update(build): upgrade openssl to 3.1.4
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-15 18:01:16 +01:00
Afsan Hossain 7092b1ec4e powerpc support in bpf_in_ia32_syscall
Signed-off-by: Afsan Hossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
Afsan Hossain 03a1c9d1f3 Rename SYSCALL and TRACEPOINT to avoid conflicts
Signed-off-by: Afsan Hossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
mdafsanhossain 8ec0c9efa0 Generated syscall_compat_* header files
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
mdafsanhossain 5197085cb1 Update README to add ppc64le modern-bpf as EXPERIMENTAL
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
mdafsanhossain 11a4a177b2 Remove endif
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
Afsan Hossain 3a6fd9bdab Skip SYSCALL redefinition on powerpc
Signed-off-by: Afsan Hossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
mdafsanhossain 5b3600f1cc vmlinux.h created on fedore 35
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
mdafsanhossain 43400390b7 update(modern_bpf):Add ppc64le definitions
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-15 16:02:16 +01:00
Afsan Hossain 2316995e7f Check minimum kernel version for ppc64le
Signed-off-by: Afsan Hossain <84701952+mdafsanhossain@users.noreply.github.com>
2023-11-15 16:02:16 +01:00
Afsan Hossain ce673ea66f Include ppc64le vmlinux.h
Signed-off-by: Afsan Hossain <84701952+mdafsanhossain@users.noreply.github.com>
2023-11-15 16:02:16 +01:00
Afsan Hossain a798c59f6e Add powerpc registers management and definitions to vmlinux.h
Signed-off-by: Afsan Hossain <84701952+mdafsanhossain@users.noreply.github.com>
2023-11-15 16:02:16 +01:00
Jason Dellaluce 7cbc03a535 fix(cmake): solve win32 linking issues with zlib
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-15 15:54:17 +01:00
Roberto Scolaro bd9b04b4c7 cleanup(libsinsp): substitute static g_screen_w
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-15 15:38:17 +01:00
Everett Badeaux 4dd9c8a251 cleanup(integer consistencies): use only int_t types
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-11-14 09:43:14 +01:00
Luca Guerra 99f764d509 fix(libsinsp): remove more ub from integer copies
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-14 00:02:48 +01:00
Grzegorz Nosek 3284fa8781 cleanup(scap): move scap_alloc_proclist_info to scap_procs.c
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek a85056cd9a cleanup(scap): remove unused parameter from scap_fd_add
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 00cdb5ed95 cleanup(scap): remove scap_proc_free
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek d7d6bd08fe cleanup(scap,sinp): do not allocate scap_threadinfo for scap_proc_get
We don't need a heap-allocated tinfo just to pass it to
sinsp_threadinfo::init

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 8d2b3aec51 cleanup(scap): remove scap_proc_alloc
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek ab30c8ec1a cleanup(scap): remove scap_t from scap_fd_add
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek d811b8ab25 cleanup(scap): remove scap_t from scap_proc_free
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek d24085c9f5 cleanup(scap): remove proclist from vtable->get_proc
It was always unclear (to me) what the proclist is used for, exactly.
It turns out it's just a holder for the callback which was ignored
in the previous implementation and now is replaced by a completely
different temporary proclist.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek ffdbfe2b6a cleanup(scap): remove proclist from scap_proc_read_thread
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek caa6230e31 cleanup(scap): remove procinfo from scap_proc_add_from_proc
This is effectively a special-case single-entry proclist

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek f69eceb794 cleanup(scap): flatten scap_proc_scan_vtable a bit
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek e256b532cb cleanup(scap): remove some unused includes
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek ad9369305f cleanup(scap): inline scap_add_fd_to_proc_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek cc7dd66d8c cleanup(scap): use default proc callback instead of NULL checks
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 0b8187d933 cleanup(scap): introduce helper for initializing the proclist
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek d91876d7ed cleanup(scap): introduce default proc callback
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 1297c7cf44 cleanup(scap): extend proc_callback type for future expansion
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek f17248bfe8 cleanup(scap): remove fdinfo alloc/free functions
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 8a07088264 cleanup(scap): only touch the internal fdlist when proc callback is not set
(in scap_fd_add_to_proc_table)

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 1751be64d3 cleanup(scap): delay allocations in scap_proc_add_from_proc
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek e204b8ef5c cleanup(scap): inline scap_fd_scan_vtable
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 913d01a8af cleanup(scap): handle allocations internally in scap_add_fd_to_proc_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek 852f9b74ee cleanup(scap): avoid allocations in scap_proc_scan_vtable
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Grzegorz Nosek a0f7a42657 doc(scap): remove misleading comment
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-10 19:24:34 +01:00
Gerald Combs 289df4fa9c update(cmake): Install libraries into CMAKE_INSTALL_LIBDIR
Pull in and update a patch from Dima Kogan which installs libraries into
CMAKE_INSTALL_LIBDIR:

https://salsa.debian.org/debian/falcosecurity-libs/-/blob/master/debian/patches/fix-library-install-path.patch

This simplifies things when BUILD_SHARED_LIBS is enabled since it
reduces the need to mess with LD_LIBRARY_PATH or DYLD_LIBRARY_PATH.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-11-10 08:55:31 +01:00
Jason Dellaluce efda90bc7c refactor(userspace/libsinsp): remove k8s and mesos clients from codebase
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-09 11:25:26 +01:00
Jason Dellaluce cc90ecb95a refactor(userspace/libsinsp)!: remove mesos and k8s clients
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-09 11:25:26 +01:00
mdafsanhossain f98ad8f250 Add semicolon and declare errno_value variable
Signed-off-by: mdafsanhossain <Mdafsan.Hossain@ibm.com>
2023-11-09 10:20:26 +01:00
Andrea Terzolo 3f767c940b update(test): add new logging function for scap_open and tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-08 17:38:25 +01:00
Andrea Terzolo 0f1459cf72 cleanup(libscap/modern_bpf): remove no longer used config
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-11-08 17:38:25 +01:00
Grzegorz Nosek ec188eb2f9 cleanup(scap): remove proc (re)scan from dump open path
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek 53f1ddd6a3 cleanup(sinsp): remove threads_from_sinsp param from sinsp_dumper::fdopen
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek c41a0c7269 cleanup(sinsp): remove threads_from_sinsp param from sinsp_dumper::open
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek 4c285c685a cleanup(scap): remove now unused scap_get_proc_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek 4712cac21a cleanup(sinsp): remove import_thread_table
Threads from captures are now imported directly into the sinsp
thread table, so we do not need a separate processing step

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek 80c40d0d08 cleanup(sinsp): remove scap threadinfo filtering
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek c91ec54a98 cleanup(sinsp): use sinsp thread table instead of scap one for captures
* use proc callback in open_savefile; We need to handle tinfo==nullptr
  when adding fds

* always pass threads_from_sinsp=true to sinsp_dumper::open

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek f22fc5f7c9 new(sinsp): support (capture) filtering of sinsp threads
We can now mark a sinsp threadinfo as filtered out and use this flag
instead of relying on the scap one

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Grzegorz Nosek 12492fbbfe tests(sinsp): basic capture filtering test
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-07 14:59:23 +01:00
Federico Di Pierro 660477f2ae update(driver): manually bumped generic syscalls through syscalls-bumper.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-07 14:38:22 +01:00
Roberto Scolaro dc5f0d959a cleanup(userspace/libsibsp): remove ASSERT_TO_LOG define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro b8bfabade1 cleanup(userspace): remove INCLUDE_UNKNOWN_SOCKET_FDS define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro f567e60eea cleanup(userspace/libsinsp): remove BRK define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro d42859faf0 cleanup(userspace/libsinsp): remove MAX_JSON_SIZE_B define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro 92de89186d cleanup(userspace/libsinsp): remove MIN_USER_EVT_BUFFER define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro 79d1fd37d4 cleanup(userspace/libsinsp): remove DIR_PATH_SEPARATOR define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Roberto Scolaro 9bfce03bd5 cleanup(userspace/libsinsp): remove NOCURSESUI define
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-06 18:19:18 +01:00
Grzegorz Nosek 75303dffc6 fix(build): remove JQ_LDFLAGS
jq's build system passes it to gcc, which then promptly fails
to compile anything as -all-static isn't a valid gcc option.

We still see mto build a fully static libjq.a, so nothing's
broken, at least at a glance.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 14:58:17 +01:00
Grzegorz Nosek 406e075b66 cleanup(build): enable cmake CMP0135 policy
Enabling this changes the behavior of timestamps for
downloaded/extracted file timestamps, but more importantly
avoids a ton of cmake warnings during build.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 14:58:17 +01:00
Grzegorz Nosek e0aeca55ec cleanup(scap): remove m_platform from scap_t
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek c0041e3c00 cleanup(sinsp): call get_platform inside dumper.cpp
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek cee6041c90 cleanup(scap): pass platform to scap_get_fdlist
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 70c364bf86 cleanup(scap): pass platform to scap_get_threadlist
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 8f42fe8abf cleanup(scap): pass platform to scap_get_agent_info
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek e629d0203d cleanup(scap): pass platform to scap_get_machine_info
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 3ec04f6692 cleanup(scap): pass platform to scap_getpid_global
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 88c6cd9046 cleanup(scap): pass platform to scap_is_thread_alive
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 2bc098708a cleanup(scap): pass platform to scap_get_proc_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek da2c451928 cleanup(scap): pass platform to scap_refresh_proc_table
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 608f60cbed cleanup(scap): pass platform to scap_proc_get
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 120a48d3af cleanup(scap): pass platform to scap_get_device_by_mount_id
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 0e47e75394 cleanup(scap): pass platform to scap_get_user_list
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 576e664994 cleanup(scap): pass platform to scap_refresh_iflist
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek f3ecfbf603 cleanup(scap): pass platform to scap_get_ifaddr_list
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek 08a29ebf9f new(sinsp): expose platform pointer via sinsp
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Grzegorz Nosek da5c235c08 cleanup(scap): do not touch scap_t->m_platform from savefile engine
Rather than relying on the platform pointer from the main scap_t
handle, keep a pointer in the savefile engine params.

Apart from removing a dependency on scap_t->m_platform (just about
the only real one), int underscores the fact that the savefile
engine absolutely needs a platform to function properly.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-06 11:30:16 +01:00
Luca Guerra b2f5c20cf8 update(libsinsp): handle buflen as int64 and not pointer in filterchecks
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-03 14:16:08 +01:00
Luca Guerra 210ab62fbf chore(tests): use get_param_const_char and get_param<> in tests
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-03 14:16:08 +01:00
Luca Guerra 6cdf0b67f8 refactor(libsinsp): safer parameter extraction from events
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-03 14:16:08 +01:00
Roberto Scolaro e262d464bc fix(cmake/modules): avoid macro pollution on sinsp consumers
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-11-03 13:42:08 +01:00
Angelo Puglisi 047bc33f25 fix: grpc ninja build
Restore CMAKE_MAKE_PROGRAM for grpc, since it gets built with cmake and
inherits the generator

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2023-11-02 17:47:06 +01:00
Mauro Ezequiel Moltrasio bb5445f084 feature(sinsp): expose container engine list.
Exposing the list of container engines allows for more control over what
is loaded. This would allow adopters to load custom container engines
that might not fit in Falco.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-11-02 16:24:07 +01:00
Jason Dellaluce ae66407a73 refactor(userspace/libsinsp): apply review suggestions
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-02 15:13:06 +01:00
Jason Dellaluce beb1285525 chore(userspace/plugin): update docs for API version 3.2.0
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-02 15:13:06 +01:00
Jason Dellaluce 3c45785353 update(userspace/plugin): bump plugin API to 3.2.0
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-02 15:13:06 +01:00
Jason Dellaluce da31f7936e chore(userspace/libsinsp/test): add some tolerance in time-based test
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-02 15:13:06 +01:00
Vadim Zyarko b3554a10a8 update(userspace/libsinsp): support timestamp priority in async event injection
Co-authored-by: Vadim Zyarko <vadim.zyarko@sysdig.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-11-02 15:13:06 +01:00
Everett Badeaux 9326b1dd23 cleanup(driver) inconsistent int types
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-11-02 12:27:06 +01:00
Grzegorz Nosek 129a62c72f cleanup(scap,sinsp): remove all references to userspace/common
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-02 09:41:06 +01:00
Grzegorz Nosek dfb2a15ce9 cleanup(scap): move strl.h into libscap
Yes, the strl* functions are used in libsinsp too, but that
doesn't make them too different from all the other helper
functions.

Eventually this could become a tiny library of its own but we're
not quite there yet.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-02 09:41:06 +01:00
Grzegorz Nosek 5ee8c6ce98 cleanup(scap): remove common/types.h
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-02 09:41:06 +01:00
Grzegorz Nosek bf501ada9f cleanup(scap): move common/falcosecurity/log.h to userspace/libscap/scap_log.h
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-11-02 09:41:06 +01:00
Angelo Puglisi 17590f3ae0 fix: ninja build
When CMAKE_GENERATOR is Ninja, CMAKE_MAKE_PROGRAM is ninja, and all the
ExternalProject_Add commands utterly fail.

Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
2023-11-01 11:00:04 +01:00
Grzegorz Nosek 0a7b8ef3dc fix(sinsp): don't free scap_threadinfo/scap_fdinfo in proc callback
They're not ours to free (they may be stack allocated, for example)

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-31 00:26:58 +01:00
Marco Vito Moscaritolo 7566a713f9 fix comment for file descriptor list reader function
Signed-off-by: Marco Vito Moscaritolo <mavimo@gmail.com>
2023-10-30 21:43:56 +01:00
Grzegorz Nosek cbab0d8d7e cleanup(sinsp): rename scap_mode_t and its values
scap_mode_t is now named sinsp_mode_t to reflect that it's not used
in libscap at all, and all the enum values are renamed from SCAP_MODE_*
to SINSP_MODE_*

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek fb1226ca8e cleanup(scap): move scap_mode_t to sinsp
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 4c5c748b93 docs(scap): document why we initialize the engine first
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 99609765d6 cleanup(scap): rename scap_init_int to scap_init_engine
It matches the new role of the function better

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 72836d3109 cleanup(scap): rename scap_linux_platform variable to scap_linux_platform_vtable
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 178d6f6c48 cleanup(scap,sinsp): remove oargs->mode and scap_vtable->mode
libscap doesn't need it any more and sinsp can pass it to the only
place that needs it (sinsp::open_common) directly.

Note: we could just also set m_mode in the individual sinsp::open_*
methods but this way we save a tiny bit of code duplication.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 5379f2e6fb cleanup(scap,sinsp): remove scap_nodriver_engine_params
They are handled by the (Linux) platform, not the engine

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 90384c14f5 cleanup(scap,sinsp): move engine selection to sinsp
AS of now, libscap doesn't know anything about selecting engines
or platforms and defers this to sinsp (or the consumer, when using
scap directly)

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek da6279babb cleanup(scap, sinsp): remove proc callback params from scap_open_args
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 9b7302c774 cleanup(scap): move bpf_stats check to the engines
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek aa0686bd95 cleanup(scap,sinsp): move platform selection to sinsp
Note: we also allow having no platform at all, even though some
engines, notably savefile, won't work without a platform

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 7049749d53 new(sinsp): only implement open_* methods for supported engines
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 857a2e1370 cleanup(build): move engine selection to a separate cmakefile
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 6021dab0e6 cleanup(build): introduce scap_config.h
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 879b4a5f24 chore(scap): extract two helpers from scap_init
We now have:
- scap_handle_alloc_platform which chooses and allocates the right
  platform based on oargs
- scap_handle_init_engine which chooses and initializes the right
  engine based on oargs
- scap_init which ties the two together

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 83e34ca934 cleanup(scap): remove outdated comment
We do have a single function now :)

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 0053f8dd95 chore(scap): move scap_generic_init_platform call to scap_platform_init
We no longer need to run scap_generic_init_platform before engine open
(proc callbacks are set up in the allocation phase), so pull it into
scap_platform_init and reduce the number of steps we have to do to open
a scap handle properly

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 22ca001ff1 chore(scap): set up proc callbacks in platform alloc functions
The proc callbacks are the one part of the platform that needs to be
initialized very early (before the engine is open).

Move the proc callback setup to the allocation function so that we never
need to worry about the callback not getting set up early enough.

This isn't too pretty at an abstract level (we're mixing allocation
and a subset of initialization) but it's more practical this way.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 98c13b3ad0 chore(scap): initialize platform in scap_init, not scap_init_int
We want to decouple the engines from platforms further, so push
the common points higher up the call chain

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek fed39cb375 fix(build): wrap scap_engines.h in C++ check
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 0018a3f6af fix(build): missing bpf engine dependency on zlib
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 6cfa1114c1 fix(build): missing modern_bpf dependencies
The modern_bpf engine depends on scap_engine_util and scap_engine_noop
but they're not specified in its dependencies. Fix this.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek ba1e1e34e6 fix(build): fix shadowing of a local variable
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Grzegorz Nosek 19d0ccfc85 fix(tests): SCAP_MODE_NODRIVER is invalid for the test_input engine
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-30 21:24:56 +01:00
Everett Badeaux c8b971ecbf cleanup(bpf/fillers.h): create integer consistencies u32/s32 -> int32_t
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-30 15:58:56 +01:00
brandonxin df16538f19 fix(userspace/libscap): fix memleak in scap_linux_get_fdlist
Signed-off-by: brandonxin <brandonxin@tencent.com>
2023-10-30 11:57:55 +01:00
Nitro Cao 2d118d79e5 fix(userspace/libscap): initialize bpf_engine.m_attached_progs.efd to -1
Signed-off-by: Nitro Cao <jaycecao520@gmail.com>
2023-10-26 16:10:45 +02:00
Everett Badeaux a5730f7a18 cleanup(driver/ppm_fillers.c): resolve inconsistent integer types
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-26 09:32:46 +02:00
Roberto Scolaro 7560806908 fix(libsinsp): ignore maybe-uninitialized for valijson
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-10-25 11:36:43 +02:00
Everett Badeaux 56b6e591cf cleanup(driver/ppm_fillers.c): create consistencies (u16 to uint16_t)
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-25 08:34:31 +02:00
Everett Badeaux 93240ff110 cleanup(driver/ppm_events.c): create consistencies(all integer types)
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-25 08:29:31 +02:00
Roberto Scolaro 204c1d742d fix(driver): move declaration before code
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-10-24 16:21:29 +02:00
Andrea Terzolo 8fe98066e3 fix(bpf): fix a verifier issue on debian10(4.19.0-25-amd64)
The verifier issue is:

2446: (07) r3 += 16
2447: (bf) r1 = r10
2448: (07) r1 += -40
2449: (b7) r2 = 8
2450: (85) call bpf_probe_read#4
2451: (79) r3 = *(u64 *)(r10 -32)
BPF program is too large. Processed 131073 insn

-- END PROG LOAD LOG --
terminate called after throwing an instance of 'scap_open_exception'
  what():  libscap: bpf_load_program() event=raw_tracepoint/filler/open_by_handle_at_x_extra_tail_1: Operation not permitted

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-24 15:13:29 +02:00
Everett Badeaux 5c9b3cd3eb cleanup(driver/ppm_fillers.c): create consistencies (s32 to int32_t)
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-24 10:15:29 +02:00
Luca Guerra 2f16738ac7 update(gha): upgrade setup docker and others
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-23 12:52:17 +02:00
Luca Guerra a414a2809e fix(gha): fix bad c-and-p
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-23 12:52:17 +02:00
Everett Badeaux 0736581e22 cleanup(driver): create consistencies (syscall_arg_t)
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-23 11:35:17 +02:00
Luca Guerra 29cc22e250 chore(ci): replace tags with hashes
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-23 10:50:17 +02:00
Luca Guerra 1bf07bcf27 update(ci): update checkout action
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-23 10:50:17 +02:00
Federico Di Pierro fa1265d001 chore(userspace/libsinsp): add tests around evt.rawarg.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-23 10:19:17 +02:00
Federico Di Pierro 7326e56429 fix(userspace/libsinsp): properly inherit rawarg PT_DYN print format.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-23 10:19:17 +02:00
Marco Vito Moscaritolo 4ed2a61da9 docs: fix comment on user list function
The comment indicate "interface list" in the "user list" function

Signed-off-by: Marco Vito Moscaritolo <mavimo@gmail.com>
2023-10-23 09:19:03 +02:00
Jason Dellaluce faebb36da8 fix(userspace/libsinsp): solve user resolution issues with musl
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-21 11:12:45 +02:00
Jason Dellaluce 3a41d14066 fix(userspace/libscap): solve gvisor build issues in with musl
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-20 20:29:24 +02:00
Jason Dellaluce 07b9212b1f update(ci): add a job for static libs builds
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-20 20:29:24 +02:00
Grzegorz Nosek 6a9a0ec14d update(sinsp): implement suppressed tid cache in sinsp_suppress
As opposed to the scap_suppress implementation, we only cache
tids (not hash tabe entries), because iterators pointing
at individual entries can get invalidated.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-20 20:26:24 +02:00
Grzegorz Nosek 1054418f33 cleanup(scap,sinsp): move suppressed comm/tids to sinsp
Note: this commit does not implement the suppressed tid cache.
It's in the next commit for easier review of the cache-specific
parts.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-20 20:26:24 +02:00
Matthew Knight c0f73f54d5 fix(userspace/libscap): add common directory to libscap includes
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Matthew Knight <matthew.knight@sysdig.com>
2023-10-20 18:31:23 +02:00
Roberto Scolaro 0262474202 fix: add defensive nullptr checks
Co-authored-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-20 18:31:23 +02:00
Federico Aponte 29d6baf27b fix(userspace/libsinsp): avoid minor warning with recent C++ standards and compilers
An unusual syntax of the declaration of a constructor (`libsinps::events::set<T>()`) raises a
warning when the compiler is gcc-11 and the build is done with C++20.

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Federico Aponte <federico.aponte@sysdig.com>
2023-10-20 18:31:23 +02:00
Grzegorz Nosek 8c2043e860 fix(build): take a vector of ppm_event_code in parse_suppressed_types
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-20 18:31:23 +02:00
Sahas Panda 4acb99e071 fix(userspace): minor missing imports and nullptr checks
Co-authored-by: Sahas Panda <sahasranshu.panda@sysdig.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-20 18:31:23 +02:00
Grzegorz Nosek c0090d4c74 update(userspace/libsinsp): add plugin directory to included dirs for consistency
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authred-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-20 18:31:23 +02:00
Gerlando Falauto 3374d44050 fix(driver): silence drop enter/exit event delayed insert messages
Such messages might end up flooding kernel logs.
Silence them unless the "verbose" module parameter is enabled.
Also, add information about the consumer.

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Gerlando Falauto <gerlando.falauto@sysdig.com>
2023-10-20 18:31:23 +02:00
Lorenzo Susini 923f3d3fb8 update(userspace/libsinsp): lower log severity for failed scap_get_fdlist
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-20 16:39:23 +02:00
Federico Di Pierro b48ca3f9f9 chore(userspace/libsinsp): set puevt even when the event is fitlered out.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-19 17:32:22 +02:00
Federico Di Pierro d3aa3632b2 chore(userspace/libsinsp): always clear `m_fds_to_remove` even when no matching `ptinfo` is found.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-19 17:32:22 +02:00
Federico Di Pierro 5b53bc7658 fix(userspace/libsinsp): avoid a possible source of segfault in libsinsp next.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-19 17:32:22 +02:00
Andrea Terzolo 309d9b1047 test: add support for cgroups in clone and execve events
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-19 12:40:20 +02:00
Federico Di Pierro a525563a3e fix(driver,test/drivers): properly support more ia32 syscalls "manual" translation to x86_64 ones.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-18 18:01:17 +02:00
Jason Dellaluce ed241aaa81 refactor(userspace/libsinsp): split sinsp filtercheck in its own source file
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 2152fbdca1 refactor(userspace/libsinsp): split filter.cpp history (2/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce d1465820ab refactor(userspace/libsinsp): split filter.cpp history (1/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 09cbd8cb3c refactor(userspace/libsinsp): final renaming pass to filtercheck sources
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 5a24c5a839 refactor(userspace/libsinsp): polish name of filtercheck sources
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 6d97e59750 refactor(userspace/libsinsp): split filterchecks.h content
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 94a1293112 refactor(userspace/libsinsp): split filterchecks.h history (2/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 724d663e0d refactor(userspace/libsinsp): split filterchecks.h history (1/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce 35ee8ebd61 refactor(userspace/libsinsp): move filter compare defs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce a4fa85b3a3 refactor(userspace/libsinsp): finish splitting filtercheck sources
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce ea03fdcd63 refactor(userspace/libsinsp): split filterchecks.cpp history (2/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Jason Dellaluce ffc2ba8016 refactor(userspace/libsinsp): split filterchecks.cpp history (1/2)
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-18 17:02:16 +02:00
Andrea Terzolo 7d7a052473 cleanup
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-10-18 12:09:15 +02:00
Andrea Terzolo 69fdaf6cfb cleanup
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-10-18 12:09:15 +02:00
Andrea Terzolo 8ed4d88cd5 fix(modern): perform an exact check on `BPF_TRACE_RAW_TP` attach type
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-18 12:09:15 +02:00
Roberto Scolaro 5b4e28d44f fix(driver/modern_bpf): address review comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-17 18:54:15 +02:00
Roberto Scolaro 581e9d667f fix(driver): null ptr deref on kernel >=6.5
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-17 18:54:15 +02:00
Andrea Terzolo e6da2ab553 fix(libscap/engines): move some checks in `start_capture`
Doing these checks in the init method could cause some issues.
In the kernel module engine, an old driver with different IOCTL codes
could be loaded and if we use IOCTL codes before checking the
compatibility we could face a not user friendly error. For this reason,
we move this `mark_syscall` check when the `check_api_compatibility`
method is already called by scap.

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-17 16:07:15 +02:00
Federico Di Pierro 0bba33c670 fix(driver): fixed build against linux 6.6.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-17 15:41:15 +02:00
Federico Di Pierro 026d21932c chore(ci): properly set driverversion in latest-kernel workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-17 15:41:15 +02:00
Grzegorz Nosek 006687d5cd cleanup(scap,sinsp): return event flags directly
The event flags are (currently) specific to the savefile engine
but accessing them requires an awkward reacharound through
a dedicated vtable method to a field stored on each call to next().

We can simplify this a bit and express the intent better by simply
returning the flags from next() via an out pointer.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-17 15:15:16 +02:00
Grzegorz Nosek 080b02b966 chore(scap): rename pcpuid to pdevid
The device id does not necessarily correspond to the CPU id even
for the kmod engine (when CPUs are offline). Rename the parameter
to match reality a bit better.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-17 15:15:16 +02:00
Grzegorz Nosek 891c2a70f8 fix(build): remove unused variable
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-17 15:15:16 +02:00
Jason Dellaluce 55de7c6d06 fix(userspace/libsinsp): make plugin formatter work again
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-17 14:59:15 +02:00
Joseph Pittman d50072b6a4 Addressed review comment: restored empty cwd for CLONE_20_X event
generated by parse_container_start handler.

Signed-off-by: Joseph Pittman <joseph.pittman@sysdig.com>
2023-10-17 12:35:15 +02:00
Joseph Pittman 82cf19871a Update and improve gVisor support:
- Implement event handlers for recently-added gVisor native events, including WRITE
- Enhance event handlers to explicitly document which SCAP event fields are invalid
  (e.g. where info is not provided by the native gVisor event)
- Improve gvisor config generator, to configure all fields needed by the event
  parser, and only those fields
- Zero fill allocated scap_gvisor_platform structure, to avoid crash on startup
- Return SCAP_TIMEOUT instead of SCAP_EOF on interrupted socket read
- Add new gvisor parser unit tests for new event handlers; and fix existing unit
  tests to reflect updated functionality of existing event handlers

Signed-off-by: Joseph Pittman <joseph.pittman@sysdig.com>
2023-10-17 12:35:15 +02:00
Matthew Knight a45e51ae0e add common include for sinsp and scap for pkg-config
Signed-off-by: Matthew Knight <matthew.knight@sysdig.com>
2023-10-17 12:25:15 +02:00
Matthew Knight 77a590b99f Make target_include public
Signed-off-by: Matthew Knight <matthew.knight@sysdig.com>
2023-10-17 12:25:15 +02:00
Matthew Knight e33db127e0 try target include on examples
Signed-off-by: Matthew Knight <matthew.knight@sysdig.com>
2023-10-17 12:25:15 +02:00
Matthew Knight 52f9b30f2e incorporate libpman to libsinsp logging
Signed-off-by: Matthew Knight <matthew.knight@sysdig.com>
2023-10-17 12:25:15 +02:00
Lorenzo Susini 03ab1bfc0c fix(userspace): ensure scap_get_fdlist can return SCAP_SUCCESS
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-16 17:18:10 +02:00
Lorenzo Susini 2fbbf09e7e fix(userspace/libscap): use %lu for uint64 as modifier
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-16 15:05:11 +02:00
Federico Di Pierro be8912041e new(driver,docs): bumped syscalls with latest version of syscalls-bumper.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-16 11:29:56 +02:00
Federico Di Pierro a8037438d7 fix(test/drivers): ensure that `buf` is not paged out by the kernel while running tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-13 12:37:50 +02:00
Federico Di Pierro 55cff53344 fix(test): fixed execveat new test.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-13 12:37:50 +02:00
Xeonacid dcd01a14c2 feat(driver-kmod): Add RISC-V kernel module support
Signed-off-by: Xeonacid <h.dwwwwww@gmail.com>
2023-10-13 12:37:50 +02:00
Lorenzo Susini 9daa2db7a3 update(test/drivers): handle msgcontrol parameters also in socketcall tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini e877f74d03 update(userspace/libsinsp): check correct allocation of thread info, remove useless forward decl
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini bc224c32e9 new(test/driver): add test for ancillary data in recvmsg
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini e278602e63 update(driver): bump SCHEMA_VERSION to 2.12.1
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini 828dfc1456 update(test/drivers): update test suite with the new msg_control parameter in recvmsg
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini 774b75cee5 update(userspace/libsinsp): add new parsing logic for SCM_RIGTHS
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini 36f9d9c549 update(userspace/libscap): introduce new platform api to retrieve file descriptors of a process from procfs
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini 9c3d5074cc update(driver/bpf): add msgcontrol parameter to recvmsg in bpf
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini 5de050cc2a update(driver/modern_bpf): add msgcontrol parameter to recvmsg in modern bpf
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Lorenzo Susini ca4d2a56b4 update(driver): add msgcontrol parameter to recvmsg in kmod
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-10-13 12:04:49 +02:00
Federico Di Pierro e0b9ea0a63 fix(ci): fixed kernel tests properly using correct `inputs.` variables.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-13 10:01:48 +02:00
Federico Di Pierro ebef0c4b30 chore(ci): improve descriptions.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-13 06:31:48 +02:00
Federico Di Pierro 3992048902 chore(ci): allow to specify a fork for kernel-testing framework.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-13 06:31:48 +02:00
Federico Di Pierro 8e7482fa78 fix(driver/bpf): fixed fedora-5.8 bpf verifier.
See kernel testing matrix on amd64 in master.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-12 16:39:46 +02:00
Jason Dellaluce 379e7dc9c8 fix(userspace/libsinsp/examples): solve compilation issues
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce 549b1279fd refactor(userspace/libsinsp): remove g_filterlist from tests
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce 10f6616494 refactor(userspace/libsinsp): remove g_filterlist from formatter and filter factories
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce 2f9695632d refactor(userspace/libsinsp): remove sinsp_evt_formatter_cache
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce e79ba937bc refactor(userspace/libsinsp/test): remove g_filterlist
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce a7faa0f126 refactor(userspace/chisel): remove g_filterlist
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce 39f227da54 refactor(userspace/libsinsp): remove get_filtercheck_fields_info
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:51:46 +02:00
Jason Dellaluce 9b787bdb7d fix(userspace/libsinsp): make plugin_filtercheck arg parsing more resilient
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-10-12 08:49:45 +02:00
Federico Di Pierro 4ed9349eb6 chore(driver): regenerated ia32_64 map with latest syscalls-bumper fixes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 0222a70334 chore(test/drivers): add mmap test to ia32 tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 2eee6dffce fix(driver): do not support socketcall on old ebpf when raw tracepoints are not available.
This limitation was already set in stone on master.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Andrea Terzolo f9770899e6 fix(modern): move some code to fix verifier on old kernels <5.11
Moving `extract__network_args` before the ringbuf initialization keeps
the `ringbuf` variable into BPF registers.

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 09134be37b chore(test/drivers): updated test name.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Andrea Terzolo f38cce7e6a cleanup(modern): add some comments and clean some code paths
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-11 18:16:46 +02:00
Andrea Terzolo fa80bd7130 cleanup(driver): add some comments and clean some code paths
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-11 18:16:46 +02:00
Andrea Terzolo 132b3ca2c5 cleanup(bpf): add some comments and clean some code paths
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro b44d4ee2b7 chore(test/drivers): do not assert openat2 exit return code in ia32, since it may have different values.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro b8a8034a7b chore(test/drivers): move to use openat2 exit event to test at least an exit event.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 046833885e chore(driver/modern_bpf): try to simplify `extract__network_args`.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 7b65dfcf0b chore(test/drivers): allow ia32 helper build even on system without openat2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro dc0b457204 chore(test/drivers): added new tests for ia32 to check pushed params.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro ee50841ce8 chore(test/drivers): add cmake option to skip ia32 tests, skipping new required deps (ia32 gcc and glibc).
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 2f236d4b16 chore(test/drivers): add specific test for execve exit behavior.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro e58a683dbb fix(driver): handle id == __NR_ia32_socketcall case in old bpf and kmod.
Modern bpf was not affected since it has no PPME_ event fallback for socketcall extraction logic.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 8c2f5c27b7 chore(test/drivers): properly test that execve exit is received even when coming from a task that is transitioning to COMPAT.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Andrea Terzolo bd69fc11b8 fix(bpf): initialize some variables
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro ac23d67e02 fix(driver/bpf): reassure bpf verifier about read length.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro a5bb2dbdc8 chore(test): send an unexistent SYS_ code too.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro ab4e34fd79 chore(driver,test): update ia32 script to call SYS_SEND and SYS_ACCEPT socketcalls.
The behavior of these syscalls is different between modern bpf (whose jump table is syscalls-indexed),
and other drivers (whose jump table is events-indexed).

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 9f9fbafc5d chore: only build ia32 test on x86_64 arch.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro eb05bd38a4 chore(ci): install gcc-multilib.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 24db0d6c0c new(test): added initial driver tests for ia32.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro ca2384d3e5 fix(userspace/libscap): bumped SCAP_MINIMUM_DRIVER_API_VERSION.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro f03e67ed6e chore(driver): bumped maj API version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 6b0d5bbfe8 cleanup(driver): made socketcall support fully dynamic.
We don't need either CAPTURE_SOCKETCALL nor _HAS_SOCKETCALL anymore.
Moreover, added support for x86 ia32 socketcall for modern bpf.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 0448d84f6d clenup(driver,driver/bpf): socketcall_to_syscall file can now use 64bit syscalls.
Since we do not use a 32bit syscall table anymore.
Moreover, moved `socketcall_code_to_syscall_code` to its header file making it `static inline`,
allowing its usage in old bpf probe too.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 8fa373657a chore(driver,userspace): properly generate ia32 mapping table filled with -1 when there is no 64bit mapped value.
This allows us to properly use `-1` (ie: an invalid syscall number) as a canary value,
instead of using `0` that, on x86_64, is `read` syscall.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro fa069f3452 fix(driver/bpf): implemented proper x86 ia32 socketcall support.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 155f57954b fix(driver): implemented execve and execveat logic to bpf and modern bpf too.
A 64bit process that execve's to a 32bit one (eg: a bash shell that executes a 32bit executable),
will receive the execve exit event as 64bit event, even if the compat flag is already set
on the task.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro cde33b6a8f fix(driver): added back x86_64 ia32 socketcall support for kmod.
Still missing to add support for it on bpf and modern bpf.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro aad5f2e648 chore(driver): properly only support ia32 for x86_64 architecture.
This is that kmod already supported. Start with feature parity then eventually expand to support
compat binaries on all supported architectures.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 19894311a4 cleanup(driver): dropped unused syscall_table32.c.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 978deaed42 new(driver): ported kmod to new design for ia32 support.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro cbfa5d59a5 new(driver/modern_bpf): implemented new map converting ia32 syscall number to 64 in modern_bpf.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro 76ca6b06eb new(driver/bpf): added a syscalls-bumper generated ia32 to x64 map table.
Use it in old bpf probe to dynamically load the converting map between x32 and x64 syscall numbers.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro b560368f0e new(driver/modern_bpf): initial ia32 support for modern bpf.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Federico Di Pierro a9d160ba67 new(driver/bpf): initial ia32 support for old bpf probe.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-11 18:16:46 +02:00
Luca Guerra a884db5834 update(build): upgrade libcurl to 8.4.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-11 14:57:45 +02:00
Grzegorz Nosek 687aead386 fix(scap): map unsupported fd types to SCAP_FD_UNSUPPORTED
This lets us read captures written with newer versions
that add new fd types.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-10-11 14:56:44 +02:00
Federico Di Pierro ae0bb5a455 cleanup(readme): drop unused badge.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-10 14:27:37 +02:00
Roberto Scolaro bedb19f6bb cleanup(filterchecks.cpp): remove useless ifndef
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-10-10 13:08:36 +02:00
Gerald Combs 392a5d9e64 fix(libsinsp): Add a NULL check
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-10-10 10:59:36 +02:00
Gerald Combs f17af2337c update(ci): Add a build-shared-libs-macos-amd64 job
Add build-shared-libs-macos-amd64 based on build-libs-others-amd64 which
builds and tests shared library support on macOS.

Windows will require some nontrivial work.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-10-10 10:19:36 +02:00
Everett Badeaux 2bea7ba762 cleanup(drivers):driver inconsistencies CHECK_RES
Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

more check res additons

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

fix else statement

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

fix minimal errors

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

fix syntax errors

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

fix additional syntax errors

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>

fix brace

Signed-off-by: Everett Badeaux <everettc1810@gmail.com>
2023-10-06 16:08:05 +02:00
Gerald Combs 0b578760c9 fix(libsinsp): Add a couple of NULL checks
Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-10-06 15:19:05 +02:00
Leonardo Grasso c042300bb7 docs(driver): add license header and SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-06 14:42:06 +02:00
Leonardo Grasso 0e39668518 docs(driver): add SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-06 14:42:06 +02:00
Mauro Ezequiel Moltrasio 7c82b44772 build(modern_bpf): relax bpftool version test.
For most use cases, bpftool version checking works fine, However, when
using bpftool compiled from a kernel with backported patches, the
version might not be the most reliable way to see if the required
capabilities are avilable. As an example, RHEL 8.8 uses a bpftool with
versions that match 4.18, but because of it having backported patches
the modern probe can be compiled without errors. With this patch we move
from checking a specific version to trying to catch if bpftool supports
the gen command.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-10-06 12:28:05 +02:00
Leonardo Grasso f350a42b6b docs: add license header and SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-05 11:25:59 +02:00
Leonardo Grasso 205a5d7c57 docs(cmake): add license header and SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-05 11:25:59 +02:00
Leonardo Grasso 9791f72795 docs(userspace/libsinsp): add license header and SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-05 11:25:59 +02:00
Leonardo Grasso 4e398e4708 docs(userspace/libscap): add license header and SPDX identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-05 11:25:59 +02:00
Leonardo Grasso a6df8fc90e docs(userspace): add SPDX license identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-05 11:25:59 +02:00
Federico Di Pierro 672bcb7521 chore(ci): there is no need to add specific artifact name for kernel testing matrixes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-05 10:09:58 +02:00
Federico Di Pierro ba78ce5c31 fix(ci): finally fixed kernel-testing related workflows.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 18:04:56 +02:00
Mauro Ezequiel Moltrasio 0cc5352293 fix(ci): download or use bundled uthash
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-10-04 15:32:56 +02:00
Mauro Ezequiel Moltrasio 0d58f798ab build(modules): unify uthash module behaviour with other header libraries
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 15:32:56 +02:00
Federico Di Pierro db3f9f69f2 fix(ci): fixed download-artifacts for kernel testing matrixes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 14:06:55 +02:00
Federico Di Pierro 4e14e582df fix(ci): fixed download matrixes step for pages and relase-body-driver.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 12:07:55 +02:00
Federico Di Pierro 8a00101d4e chore(ci): workflow_call supports concurrency key.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 08:11:55 +02:00
Federico Di Pierro 1ee33b7ef5 chore(docs): updated release.md.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 08:11:55 +02:00
Federico Di Pierro b28c349fbd new(ci): autogenerate release body for libs and driver "latest" tags.
kernel_tests becomes a reusable workflow; pages is now triggered on master pushes and uses
the reusable_kernel_tests workflow.
release-body-driver is now triggered on github releases events only for releases set as "latest",
and calls the reusable_kernel_tests workflow.
release-body-libs is triggered on github releases events only for releases set as "latest".

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 08:11:55 +02:00
Federico Di Pierro 3cf07332b7 new(ci): autogenerate release body for drivers and libs releases.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-04 08:11:55 +02:00
Andrea Terzolo 3d1f481008 new(tests): change meaning to actual `field_exists` helper
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-03 17:20:54 +02:00
Luca Guerra 6a0ec26f72 fix(ci): pin semgrep to 1.41.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-10-03 17:03:54 +02:00
Andrea Terzolo 2e76d0d679 cleanup(libscap): add some comments and minor cleanups to the CPU logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-03 13:36:54 +02:00
Federico Di Pierro bcb74e7392 fix(userspace/libscap): fixed ebpf init loop on online CPUs.
Moreover, made kmod loop more robust too.

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

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-10-03 13:36:54 +02:00
Federico Di Pierro 98d7df69b6 chore(driver): bumped patch schema version.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-10-02 12:39:48 +02:00
poiana 3dd7b15f28 update(driver): update syscalls tables and driver report.
Signed-off-by: GitHub <noreply@github.com>
2023-10-02 12:39:48 +02:00
Mauro Ezequiel Moltrasio 5333d0b417 build(scap): add libdirs to pkgconfig
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-09-29 10:31:21 +02:00
Mauro Ezequiel Moltrasio 903749cd80 build(minimal-build): allow using eBPF driver with minimal builds
Historically, the minimal build was only able to run using the kernel
module driver, but since the addition of the modern probe this has also
become an option for running with minimal builds. I believe there's
value in allowing adopters of the libs to use the minimal build with the
eBPF probe.

This change means that scap will always be linked against zlib and
libelf, but I believe this is a worthwhile trade off.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-09-29 10:31:21 +02:00
Roberto Scolaro 3d61b0a328 fix(ci): install-deps on build-shared-libs-linux-amd64
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-09-28 10:14:19 +02:00
Roberto Scolaro 428e161a67 chore(cmake): include tinydir
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-09-28 10:14:19 +02:00
Lorenzo Susini 00fa5c5196 fix(userspace/libsinsp/test): fix cmake include dir for tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-09-27 17:06:14 +02:00
Lorenzo Susini edc3c84d0b update(userspace/libsinsp): implement version operators <,>,== and rename check to compatible_with
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-09-27 17:06:14 +02:00
Andrea Terzolo 52bcabb445 update: handle 2 params in seccomp enter event
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-27 16:14:14 +02:00
Jason Dellaluce a4a7dc800d update(driver/SCHEMA_VERSION): bump minor version
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-09-27 16:14:14 +02:00
Jason Dellaluce a51e7be961 fix(driver): update param count of seccomp enter event
Co-authored-by: Gerald Combs <gerald@wireshark.org>

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-09-27 16:14:14 +02:00
Gerald Combs 762c23b98b fix(cmake): Make some dependency scopes private
Make the base sinsp dependency scopes PRIVATE. This fixes compilation
here on macOS when BUILD_SHARED_LIBS=ON.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-09-25 15:00:05 +02:00
Andrea Terzolo b61c2977c3 docs: add some comments in the plugin flow
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 14:58:05 +02:00
Andrea Terzolo aba0162c77 cleanup: simplify `resolve_dylib_json_strlist` logic
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 14:58:05 +02:00
Andrea Terzolo 1c59026325 docs: fix some comments in the plugin API
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 14:58:05 +02:00
Andrea Terzolo e5db23d45e docs: add some comments to the plugin tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 14:58:05 +02:00
Andrea Terzolo 9eef3d7984 chore: add a new cmake option to compile out scap-file tests
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 14:58:05 +02:00
Andrea Terzolo 5c27cc180e cleanup!: remove support for kernel versions <= 2.6.20
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-25 12:32:04 +02:00
Mauro Ezequiel Moltrasio 2cd2c1a900 test(scap): add unit tests for scap_cgroup_prefix_path
Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-21 14:37:47 +02:00
Mauro Ezequiel Moltrasio fff34ee899 fix(scap): remove the trailing slash when traversing cgroups
Without this change, having multiple levels of cgroups nested result on
the path removing the /.. sections, but leaves the prefix locked at the
first slash that is found.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
2023-09-21 14:37:47 +02:00
Andrea Terzolo e999e61fa8 update(scap): add a `memset` to clear `m_agent_info`
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
Co-authored-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-21 12:32:47 +02:00
Grzegorz Nosek 3ec6a15e69 fix(scap): do not access /proc in generic platform code
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-21 12:32:47 +02:00
Andrea Terzolo 71641ff33d cleanup(userspace): provide an error message
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-20 10:45:30 +02:00
Andrea Terzolo 0e79c2e691 fix(userspace): report a clear message when the '/proc' directory is not
available

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-20 10:45:30 +02:00
Andrea Terzolo d1cddcb2a4 fix(userspace): avoid a segmentation fault when `m_input_plugin` is not
initialized

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-20 10:45:30 +02:00
Nathan Baker e2cdf1e084 fix(libsinsp): Don't loop forever on container api
Add an escape clause on the container lookup path to make sure we're not just constantly getting timeouts.

/kind bug
/area libsinsp

```release-note
NONE
```

Signed-off-by: Nathan Baker <nathan.baker@sysdig.com>
2023-09-15 10:41:32 +02:00
Federico Di Pierro 7c0b0b2939 fix(ci): fixed release-body double quoted string usage.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-14 11:44:43 +02:00
Federico Di Pierro 027d40b2a5 fix(driver/modern_bpf): fixed modern bpf driver.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Andrea Terzolo <andreaterzolo3@gmail.com>
2023-09-14 09:46:43 +02:00
Federico Di Pierro 749845c53c chore(ci): improve latest-kernel workflow.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-14 09:46:43 +02:00
Federico Di Pierro 8da58058f2 fix(driver): fixed build against 6.6 rc kernel.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-14 09:46:43 +02:00
Federico Di Pierro 0714308cba chore(ci): reworked to avoid using weird gh commands.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Luca Guerra <luca@guerra.sh>
2023-09-13 15:36:40 +02:00
Federico Di Pierro d1af5c2f90 fix(ci): fixed release body step.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-13 15:36:40 +02:00
Federico Di Pierro b17bae8a11 fix(ci): properly skip release-body workflow in non-drivers tags.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-13 15:36:40 +02:00
Leonardo Grasso 4c762944e6 docs: add LICENSE
This commit creates a copy of https://github.com/falcosecurity/libs/blob/master/COPYING (which is kept for historical reasons) to address the recommendation reported by https://github.com/falcosecurity/evolution/issues/317

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-09-12 06:40:34 +02:00
Federico Di Pierro bd5395295a new(ci): append SCHEMA and API versions to drivers release body.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-11 10:34:14 +02:00
Angelo Puglisi 92d0574852 fix(kmod): safer ppm_get_mm_exe_file
Leverage `get_file_rcu` being a define to use the safer version of
`get_mm_exe_file`.
This will allow kernel versions prior to 4.1, but with the fix being
backported don't suffer RCU violations.

Co-authored-by: Joseph Pittman <joseph.pittman@sysdig.com>
Signed-off-by: Angelo Puglisi <angelo.puglisi@sysdig.com>
2023-09-08 13:38:02 +02:00
Federico Di Pierro bd2f9d3f37 chore(ci): enforce bundled deps generated binary (sinsp-example) to be as static as possible.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-09-08 13:23:03 +02:00
Gerald Combs 1a6ab9f29c update(libsinsp): Make sinsp::fseek public
Give consumers random access to scap files.

Signed-off-by: Gerald Combs <gerald@wireshark.org>
2023-09-07 10:44:03 +02:00
Grzegorz Nosek 23b3576cf1 fix(scap): don't use generic platform for nodriver full proc scan
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:43:03 +02:00
Grzegorz Nosek 9d930bf783 fix(sinsp): disable get_cwd assert, it breaks tests with non-live platforms
This should technically be controlled by the platform, but we're
not quite there yet, so as long as we have test_input setups
where threads may not have a main thread, disable this assert.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:41:03 +02:00
Grzegorz Nosek f026f1c80e cleanup(tests): Log sinsp-example messages in e2e tests
They were logged as JSON parse errors before, but we can simply
print them without trying to parse them.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 91266cb838 new(sinsp): add raw output to sinsp-example
This is *really* raw (basic header info and a hexdump
of each parameter) but it may come in handy any time we need
to go deeper in analyzing individual events.

Note: to get an actual raw dump, we could use two extra features:
* show the sentinel if available
* verify the total event length vs the lengths of all parameters

Note 2: I really couldn't be bothered to fight with C++ iostreams
to get a usable hex dump so I went for classic C stdio.

To do this, we'd need the access to the raw `scap_evt`, which
would violate the abstraction layering even more.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 4fbbc2fbb3 cleanup(sinsp): remove all non-formatter fields from output
The formatter output should be good enough now

Note: we keep the old format in JSON mode for e2e tests compatibility

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 84a3a8f1d0 cleanup(sinsp): move "is main thread" logic to main()
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 8636ec9863 cleanup(sinsp): inline json_dump_init
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 31e5faa29d fix(sinsp): add missing event category names
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 3b9a74288f new(sinsp): use sinsp formatters for plaintext output in sinsp-example
This makes sinsp-example actually useful for looking at events
in non-JSON mode.

--output-fields-json now also affects plaintext output and has been renamed
to --output-fields.

The default output format has been trimmed too, removing the items that
are present in the default output format. Effectively this leaves only
the container id (or `HOST`) and the event category.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 9b5bce534f cleanup(sinsp): move getting the event out of the dump function
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek 9cb66224bf chore(sinsp): use unique_ptr in sinsp-example
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Grzegorz Nosek ebfcb1f6fb fix(sinsp): check the correct parameter for PT_PID type
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
2023-09-07 10:38:03 +02:00
Roberto Scolaro a0a8d1294c fix(libscap,libsinsp): correctly manage pidfd in scapfiles
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-09-06 10:34:00 +02:00
Roberto Scolaro c4f75889b2 fix(libscap): handle fname with memfd
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-09-05 18:46:58 +02:00
Roberto Scolaro 7a5d1a21a6 fix(libscap,libsinsp): correctly manage memfd in scapfiles
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-09-05 18:46:58 +02:00
Luca Guerra 0a4765f99d update(build): update elfutils to 0.189
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-09-05 15:24:59 +02:00
Luca Guerra d984dc8afc update(build): update libtbb to 2021.9
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-09-05 10:47:56 +02:00
Luca Guerra 7f1d4a6d31 chore(cmake): update OpenSSL to 3.1.2
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-09-05 10:46:56 +02:00
1501 changed files with 307889 additions and 136293 deletions

View File

@ -1,157 +0,0 @@
version: 2.1
jobs:
# Here we test drivers and also engines
"test-drivers-engines-arm64":
machine:
enabled: true
image: ubuntu-2204:2022.10.2
resource_class: arm.large
steps:
- run:
name: Install deps ⛓️
command: |
sudo apt update -y
sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends ca-certificates cmake build-essential git pkg-config autoconf automake libelf-dev libcap-dev linux-headers-$(uname -r) clang-14 llvm-14
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
git clone https://github.com/libbpf/bpftool.git --branch v7.0.0 --single-branch
cd bpftool
git submodule update --init
cd src && sudo make install
- checkout:
path: /tmp/libs
- run:
name: Print kernel info 🔢
command: |
uname -a
# Gvisor is not supported on ARM64
- run:
name: Build drivers and engines tests 🏗️
command: |
mkdir -p /tmp/libs/build
cd /tmp/libs/build && cmake -DUSE_BUNDLED_DEPS=On -DENABLE_DRIVERS_TESTS=On -DBUILD_LIBSCAP_GVISOR=Off -DBUILD_BPF=True -DBUILD_LIBSCAP_MODERN_BPF=On -DCREATE_TEST_TARGETS=On -DENABLE_LIBSCAP_TESTS=On ..
make drivers_test driver bpf libscap_test scap-open -j6
- run:
name: Run drivers_test with modern bpf 🏎️
command: |
cd /tmp/libs/build
sudo ./test/drivers/drivers_test -m
- run:
name: Run drivers_test with bpf 🏎️
command: |
cd /tmp/libs/build
sudo ./test/drivers/drivers_test -b
- run:
name: Run drivers_test with kernel module 🏎️
command: |
cd /tmp/libs/build
sudo ./test/drivers/drivers_test -k
- run:
name: Run engine tests 🏎️
command: |
cd /tmp/libs/build
sudo ./test/libscap/libscap_test
- run:
name: Run scap-open with modern bpf 🏎️
command: |
cd /tmp/libs/build
sudo ./libscap/examples/01-open/scap-open --modern_bpf --num_events 0
- run:
name: Run scap-open with bpf 🏎️
command: |
cd /tmp/libs/build
sudo ./libscap/examples/01-open/scap-open --bpf ./driver/bpf/probe.o --num_events 0
- run:
name: Run scap-open with kmod 🏎️
command: |
cd /tmp/libs/build
sudo insmod ./driver/scap.ko || true
sudo ./libscap/examples/01-open/scap-open --kmod --num_events 0
sudo rmmod scap
# Here we test libraries
"test-libraries-arm64":
machine:
enabled: true
image: ubuntu-2204:2022.10.2
resource_class: arm.large
steps:
- run:
name: Install deps ⛓️
command: |
sudo apt update -y
sudo DEBIAN_FRONTEND=noninteractive 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 liblua5.1-dev
- checkout:
path: /tmp/libs
- run:
name: Install valijson and other external deps ⛓️
command: |
cd /tmp/libs
sudo .github/install-deps.sh
- run:
name: Build and run libraries tests 🏗️🏎️
command: |
mkdir -p /tmp/libs/build
cd /tmp/libs/build && cmake -DUSE_BUNDLED_DEPS=Off -DBUILD_BPF=Off -DBUILD_DRIVER=Off ..
make run-unit-tests -j6
"test-clang-7":
machine:
image: ubuntu-2004:202107-02
steps:
- run:
name: Install deps ⛓️
command: |
sudo apt update -y
sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends ca-certificates git make build-essential clang-7 libelf-dev libcap-dev cmake linux-headers-$(uname -r)
ls /usr/bin/ | grep clang
ls /usr/bin/ | grep llc
sudo ln -s /usr/bin/clang-7 /usr/bin/clang
- checkout:
path: /tmp/libs
- run:
name: Print kernel info 🔢
command: |
uname -a
- run:
name: Build drivers and engines tests 🏗️
command: |
mkdir -p /tmp/libs/build
cd /tmp/libs/build && cmake -DUSE_BUNDLED_DEPS=On -DENABLE_DRIVERS_TESTS=On -DBUILD_LIBSCAP_GVISOR=Off -DBUILD_BPF=True -DBUILD_LIBSCAP_MODERN_BPF=Off -DCREATE_TEST_TARGETS=On ..
make drivers_test driver bpf -j6
- run:
name: Run drivers_test with kernel module 🏎️
command: |
cd /tmp/libs/build
sudo ./test/drivers/drivers_test -k --gtest_filter=-'GenericTracepoints.page_fault_kernel'
- run:
name: Run drivers_test with bpf 🏎️
command: |
cd /tmp/libs/build
sudo ./test/drivers/drivers_test -b --gtest_filter=-'GenericTracepoints.page_fault_kernel'
workflows:
version: 2.1
build_and_test:
jobs:
- "test-drivers-engines-arm64"
- "test-libraries-arm64"
- "test-clang-7"

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
<!--
@ -58,8 +60,6 @@ Please remove the leading whitespace before the `/kind <>` you uncommented.
> /area libscap-engine-savefile
> /area libscap-engine-udig
> /area libscap
> /area libpman

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

@ -1,15 +1,19 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2022 The Falco Authors.
# 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.
#
set -e
@ -17,7 +21,7 @@ set -e
mkdir -p third_party
cd third_party
# === Valijson ===
# === Valijson ===
echo "=== Building and installing valijson v0.6 ==="
wget "https://github.com/tristanpenman/valijson/archive/refs/tags/v0.6.tar.gz"
@ -39,7 +43,7 @@ make install -j
popd
# === RE2 ===
# === RE2 ===
echo "=== Building and installing re2 (v2022-06-01) ==="
wget "https://github.com/google/re2/archive/refs/tags/2022-06-01.tar.gz"
@ -52,16 +56,18 @@ cd build-re2
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DRE2_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
..
make -j
make install -j
popd
# === Tinydir ===
echo "=== Building and installing tinydir (1.2.5) ==="
# === uthash ===
echo "=== Downloading uthash.h (1.9.8) ==="
wget "https://github.com/cxong/tinydir/archive/refs/tags/1.2.5.tar.gz"
tar xzf 1.2.5.tar.gz
pushd tinydir-1.2.5/
cp tinydir.h /usr/include
popd
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

@ -14,49 +14,42 @@ concurrency:
cancel-in-progress: true
jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
driver_changed: ${{ steps.filter.outputs.driver }}
libscap_changed: ${{ steps.filter.outputs.libscap }}
libsinsp_changed: ${{ steps.filter.outputs.libsinsp }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
driver:
- 'driver/**'
libscap:
- 'userspace/libscap/**'
libsinsp:
- 'userspace/libsinsp/**'
build-libs-linux-amd64:
name: build-libs-linux-amd64 😁
build-libs-linux:
name: build-libs-linux-${{ matrix.arch }} 😁 (${{ matrix.name }})
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
fail-fast: false
matrix:
name: [system_deps, bundled_deps, system_deps_w_chisels, system_deps_minimal]
arch: [amd64, arm64]
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_w_chisels
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=False -DWITH_CHISEL=True
- name: system_deps_minimal
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=False -DMINIMAL_BUILD=True
runs-on: ubuntu-latest
- 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 liblua5.1-dev linux-headers-amd64
# 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@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -68,32 +61,58 @@ 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
build-libs-linux-amd64-asan:
name: build-libs-linux-amd64-asan 🧐
- 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
container:
image: debian:buster
image: alpine:3.17
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 liblua5.1-dev linux-headers-amd64
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
- name: Install deps ⛓️
run: |
.github/install-deps.sh
- name: Git safe directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
@ -101,50 +120,46 @@ jobs:
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && LDFLAGS="-lpthread" cmake -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address -DUSE_BUNDLED_DEPS=False ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
make run-unit-tests
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: 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 liblua5.1-dev linux-headers-$(uname -r)
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Git safe directory
- name: Install deps ⛓️
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
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 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 -DUSE_BUNDLED_VALIJSON=True -DCMAKE_INSTALL_PREFIX=/tmp/libs-test ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
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
- name: Install
run: |
cd build
make install
- name: Test sinsp-example build with pkg-config
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: |
cd userspace/libsinsp/examples
export LD_LIBRARY_PATH=/tmp/libs-test/lib/falcosecurity
export LD_LIBRARY_PATH=/tmp/libs-test/lib
./sinsp-example -h
build-libs-others-amd64:
@ -152,30 +167,66 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
os: [windows-latest]
crt: [MultiThreaded, MultiThreadedDLL]
include:
- os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
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 -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
# This job run all engine tests and scap-open
test-scap-x86:
name: test-scap-x86 😆 (bundled_deps)
runs-on: ubuntu-22.04
needs: paths-filter
if: needs.paths-filter.outputs.driver_changed == 'true' || needs.paths-filter.outputs.libscap_changed == 'true'
build-shared-libs-macos-amd64:
name: build-shared-libs-macos-amd64 😨
runs-on: macos-latest
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install c-ares re2 tbb jq jsoncpp openssl uthash
- name: Build 🏗️
run: |
mkdir -p build
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: |
cd build
make install
- name: Test sinsp-example build with pkg-config 🧪
run: |
cd userspace/libsinsp/examples
export PKG_CONFIG_PATH=/tmp/libs-test/lib/pkgconfig
c++ --std=c++17 -o sinsp-example test.cpp util.cpp $(pkg-config --cflags --libs libsinsp)
- name: Test sinsp-example runtime linker 🧪
run: |
cd userspace/libsinsp/examples
export DYLD_LIBRARY_PATH=/tmp/libs-test/lib
./sinsp-example -h
# This job checks that a bundled deps of libs is as static as possible
test-libs-static:
name: test-libs-static (bundled_deps)
runs-on: ubuntu-22.04
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
@ -187,205 +238,35 @@ jobs:
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: Build scap-open and drivers 🏗️
- name: Build sinsp-example
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=On -DCREATE_TEST_TARGETS=On -DENABLE_LIBSCAP_TESTS=On ../
make scap-open
make driver bpf
make libscap_test
cd build && cmake -DUSE_BUNDLED_DEPS=On -DBUILD_DRIVER=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DBUILD_BPF=On -DBUILD_LIBSCAP_GVISOR=On -DCREATE_TEST_TARGETS=Off -DENABLE_LIBSCAP_TESTS=Off ../
make -j$(nproc) sinsp-example
- name: Run scap-open with modern bpf 🏎️
- name: Ensure that sinsp-example with bundled deps is as static as possible
run: |
cd build
sudo ./libscap/examples/01-open/scap-open --modern_bpf --num_events 0
- name: Run scap-open with bpf 🏎️
run: |
cd build
sudo ./libscap/examples/01-open/scap-open --bpf ./driver/bpf/probe.o --num_events 0
- name: Run scap-open with kmod 🏎️
run: |
cd build
sudo insmod ./driver/scap.ko
sudo ./libscap/examples/01-open/scap-open --kmod --num_events 0
sudo rmmod scap
- name: Run libscap_test 🏎️
run: |
cd build
sudo ./test/libscap/libscap_test
test-drivers-x86:
name: test-drivers-x86 😇 (bundled_deps)
runs-on: ubuntu-22.04
needs: paths-filter
if: needs.paths-filter.outputs.driver_changed == 'true' || needs.paths-filter.outputs.libscap_changed == 'true'
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deps ⛓️
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 linux-headers-$(uname -r) 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
- name: Build drivers tests 🏗️
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 ../
make drivers_test
make driver bpf
- name: Run drivers_test with modern bpf 🏎️
run: |
cd build
sudo ./test/drivers/drivers_test -m
- name: Run drivers_test with bpf 🏎️
run: |
cd build
sudo ./test/drivers/drivers_test -b
- name: Run drivers_test with kmod 🏎️
run: |
cd build
sudo ./test/drivers/drivers_test -k
build-libs-s390x:
name: build-libs-s390x 😁 (system_deps)
runs-on: ubuntu-22.04
needs: paths-filter
if: needs.paths-filter.outputs.driver_changed == 'true' || needs.paths-filter.outputs.libsinsp_changed == 'true'
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: uraimo/run-on-arch-action@v2.2.0
name: Run s390x build 🏗️
with:
arch: s390x
distro: ubuntu22.04
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 libgtest-dev libprotobuf-dev linux-headers-generic
git clone https://github.com/libbpf/bpftool.git --branch v7.0.0 --single-branch
cd bpftool
git submodule update --init
cd src && make install
cd ../../
git clone https://github.com/libbpf/libbpf.git --branch v1.0.1 --single-branch
cd libbpf/src && BUILD_STATIC_ONLY=y DESTDIR=/ make install
ln -s /usr/lib64/libbpf.a /usr/lib/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 -DBUILD_LIBSCAP_GVISOR=OFF ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make scap-open driver bpf unit-test-libsinsp -j6
./libsinsp/test/unit-test-libsinsp
ldd "build/libsinsp/examples/sinsp-example" | cut --fields=2 | cut --delimiter=' ' --fields=1 | rev | cut --delimiter='/' --fields=1 | rev | sort --unique --version-sort > ldd_out.txt
cat > expected_ldd_out.txt <<EOF
ld-linux-x86-64.so.2
libc.so.6
libgcc_s.so.1
libm.so.6
libstdc++.so.6
linux-vdso.so.1
EOF
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, system_deps_w_chisels, asan]
include:
- name: system_deps
cmake_opts: -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DUSE_BUNDLED_DEPS=True
- name: system_deps_w_chisels
cmake_opts: -DUSE_BUNDLED_DEPS=False -DWITH_CHISEL=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 \
liblua5.1-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@v3
with:
fetch-depth: 0
- 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@v3
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: |
@ -393,17 +274,13 @@ 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@v3
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
cd build && emcmake cmake -DUSE_BUNDLED_DEPS=True ../
KERNELDIR=/lib/modules/$(ls /lib/modules)/build emmake make -j4
KERNELDIR=/lib/modules/$(ls /lib/modules)/build emmake make run-unit-tests -j4
emmake make -j4
emmake make run-unit-tests -j4

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

@ -6,8 +6,12 @@ name: Driver API_VERSION checks
on:
pull_request_target:
paths:
- 'driver/ppm_fillers.c'
- 'driver/bpf/fillers.h'
- 'userspace/libscap/engine/bpf/**'
- 'userspace/libscap/engine/modern_bpf/**'
- 'userspace/libscap/engine/kmod/**'
- 'driver/ppm_events_public.h'
- 'driver/bpf/maps.h'
- 'driver/modern_bpf/maps/maps.h'
jobs:
paths-filter:
@ -15,8 +19,8 @@ jobs:
outputs:
driver_api_changed: ${{ steps.filter.outputs.driver_api }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@ -31,7 +35,7 @@ jobs:
if: needs.paths-filter.outputs.driver_api_changed == 'false'
steps:
- name: Check driver API_VERSION
uses: mshick/add-pr-comment@v2
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

@ -6,6 +6,8 @@ name: Driver SCHEMA_VERSION checks
on:
pull_request_target:
paths:
- 'driver/ppm_fillers.c'
- 'driver/bpf/fillers.h'
- 'driver/event_table.c'
- 'driver/ppm_events_public.h'
- 'driver/event_stats.h'
@ -17,8 +19,8 @@ jobs:
outputs:
driver_schema_changed: ${{ steps.filter.outputs.driver_schema }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@ -32,14 +34,14 @@ jobs:
needs: paths-filter
if: needs.paths-filter.outputs.driver_schema_changed == 'false'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check driver SCHEMA_VERSION
uses: mshick/add-pr-comment@v2
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:

363
.github/workflows/drivers_ci.yml vendored Normal file
View File

@ -0,0 +1,363 @@
name: Drivers CI Build
on:
pull_request:
push:
branches:
- master
- 'release/**'
- 'maintainers/**'
workflow_dispatch:
# we cannot use paths key here since otherwise required_status_checks jobs won't run.
# See https://github.com/orgs/community/discussions/26251.
# We need to use the paths-filter job.
# 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:
paths-filter:
runs-on: ubuntu-latest
outputs:
driver: ${{ steps.filter.outputs.driver }}
libscap: ${{ steps.filter.outputs.libscap }}
libpman: ${{ steps.filter.outputs.libpman }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
driver:
- 'driver/**'
libscap:
- 'userspace/libscap/**'
libpman:
- 'userspace/libpman/**'
# This job run all engine tests and scap-open
test-scap:
name: test-scap-${{ matrix.arch }} 😆 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
needs: paths-filter
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
enable_gvisor: True
- arch: amd64
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
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 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: 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 -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 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
cd build
sudo ./libscap/examples/01-open/scap-open --modern_bpf --num_events 10
- name: Run scap-open with bpf 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
cd build
sudo ./libscap/examples/01-open/scap-open --bpf ./driver/bpf/probe.o --num_events 10
- name: Run scap-open with kmod 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
cd build
sudo insmod ./driver/scap.ko
sudo ./libscap/examples/01-open/scap-open --kmod --num_events 10
sudo rmmod scap
- name: Run libscap_test 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
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' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
needs: paths-filter
strategy:
matrix:
arch: [amd64, arm64]
fail-fast: false
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
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 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 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 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 -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 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
cd build
sudo ./test/drivers/drivers_test -m
- name: Run drivers_test with bpf 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
run: |
cd build
sudo ./test/drivers/drivers_test -b
- name: Run drivers_test with kmod 🏎️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
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 == '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 }}
key: ${{ secrets.PPC64LE_KEY }}
port: ${{ secrets.PPC64LE_PORT }}
envs: GIT_BRANCH,GITHUB_REPOSITORY,GITHUB_SERVER_URL
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 -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=$?
sudo ./test/drivers/drivers_test -b
rc_bpf=$?
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
needs: paths-filter
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- 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:
arch: s390x
distro: ubuntu22.04
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 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 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_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: 'ubuntu-latest'
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
container: fedora:41
steps:
# Always install deps before invoking checkout action, to properly perform a full clone.
- name: Install build dependencies
run: |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build modern BPF skeleton
run: |
mkdir skeleton-build && cd skeleton-build
cmake -DUSE_BUNDLED_DEPS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DCREATE_TEST_TARGETS=Off ..
make ProbeSkeleton -j6
- name: Upload skeleton
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
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:
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'
steps:
- name: Install build dependencies
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
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download skeleton
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bpf_probe_x86_64.skel.h
path: /tmp
- name: Prepare project
run: |
mkdir build && cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_BUNDLED_DEPS=On \
-DBUILD_LIBSCAP_MODERN_BPF=ON \
-DMODERN_BPF_SKEL_DIR=/tmp \
-DBUILD_DRIVER=Off \
-DBUILD_BPF=Off \
..
- name: Build project
run: |
cd build
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

169
.github/workflows/e2e_ci.yml vendored Normal file
View File

@ -0,0 +1,169 @@
name: libsinsp e2e CI
on:
pull_request:
push:
branches:
- master
- 'release/**'
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 }}
cancel-in-progress: true
jobs:
build-test-e2e:
name: build-test-e2e-${{ matrix.arch }} 😇 (bundled_deps)
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install deps ⛓️
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
clang \
llvm \
git \
ccache \
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)
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 multilib compilers for ia32 tests
if: matrix.arch == 'amd64'
run: |
sudo apt install -y --no-install-recommends gcc-multilib g++-multilib
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
- name: Build e2e tests 🏗️
env:
SCCACHE_GHA_ENABLED: "true"
run: |
mkdir -p build
cd build && \
cmake \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DBUILD_BPF=ON \
-DUSE_BUNDLED_DEPS=ON \
-DUSE_ASAN=ON \
-DUSE_UBSAN=ON \
-DENABLE_LIBSINSP_E2E_TESTS=ON \
-DBUILD_LIBSCAP_MODERN_BPF=ON \
-DBUILD_LIBSCAP_GVISOR=OFF \
-DUSE_BUNDLED_LIBBPF=ON \
-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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: always()
id: cache
with:
path: build
key: build-e2e-${{ matrix.arch }}-${{ github.run_id }}
test-e2e:
name: test-e2e-${{ matrix.arch }}-${{ matrix.driver.name }} 😇 (bundled_deps)
needs: [build-test-e2e]
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
matrix:
arch: [amd64, arm64]
driver: [ {name: kmod, option: -k}, {name: bpf, option: -b}, {name: modern-bpf, option: -m} ]
fail-fast: false
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Restore build
id: cache
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
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Update apt index
run: |
sudo apt update
- 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 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: |
pushd build
make -B driver bpf
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'
env:
UBSAN_OPTIONS: print_stacktrace=1
run: |
cd build/test/libsinsp_e2e/
sudo -E ./libsinsp_e2e_tests ${{ matrix.driver.option }}
# 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'
env:
UBSAN_OPTIONS: print_stacktrace=1
run: |
cd build/test/libsinsp_e2e/
sudo -E ./libsinsp_e2e_tests ${{ matrix.driver.option }} --gtest_filter=-sys_call_test.quotactl_ok

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

@ -1,26 +0,0 @@
name: Insecure API check
on:
pull_request:
branches:
- master
- 'release/**'
- 'maintainers/**'
jobs:
insecure-api:
name: check-insecure-api
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Scan PR for insecure API usage 🕵️
run: |
semgrep scan \
--error \
--metrics=off \
--baseline-commit ${{ github.event.pull_request.base.sha }} \
--config=./semgrep

View File

@ -1,98 +0,0 @@
name: Test drivers against a matrix of kernels/distros
on:
workflow_dispatch:
inputs:
libsversion:
description: libs version to be tested
type: string
required: false
default: master
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+\+driver'
concurrency:
group: kernel-tests
cancel-in-progress: true
jobs:
test-kernels:
strategy:
fail-fast: false
matrix:
architecture: [X64, ARM64]
runs-on: [ "self-hosted", "linux", "${{matrix.architecture}}" ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: falcosecurity/kernel-testing
ref: v0.2.3
- name: Generate vars yaml
working-directory: ./ansible-playbooks
run: |
LIBS_V=${{ github.event.inputs.libsversion }}
LIBS_VERSION=${LIBS_V:-${{ github.ref_name }}}
cat > vars.yml <<EOF
run_id: "id-${{ github.run_id }}"
output_dir: "~/ansible_output_${{ github.run_id }}"
repos:
libs: {name: "falcosecurity-libs", repo: "https://github.com/falcosecurity/libs.git", version: "$LIBS_VERSION"}
EOF
- name: Bootstrap VMs
working-directory: ./ansible-playbooks
run: |
ansible-playbook bootstrap.yml --extra-vars "@vars.yml"
- name: Common setup
working-directory: ./ansible-playbooks
run: |
ansible-playbook common.yml --extra-vars "@vars.yml"
- name: Prepare github repos
working-directory: ./ansible-playbooks
run: |
ansible-playbook git-repos.yml --extra-vars "@vars.yml"
- name: Run scap-open tests
working-directory: ./ansible-playbooks
run: |
ansible-playbook scap-open.yml --extra-vars "@vars.yml" || :
- name: Tar output files
run: |
tar -cvf ansible_output.tar ~/ansible_output_${{ github.run_id }}
- uses: actions/upload-artifact@v3
with:
name: ansible_output_${{matrix.architecture}}
path: ansible_output.tar
- name: Build matrix_gen
working-directory: ./matrix_gen
env:
GOPATH: /root/go
GOCACHE: /root/.cache/go-build
run: |
go build .
- name: Generate new matrix
working-directory: ./matrix_gen
run: |
./matrix_gen --root-folder ~/ansible_output_${{ github.run_id }} --output-file matrix_${{matrix.architecture}}.md
- uses: actions/upload-artifact@v3
with:
name: matrix_${{matrix.architecture}}
path: ./matrix_gen/matrix_${{matrix.architecture}}.md
- name: Cleanup
if: always()
working-directory: ./ansible-playbooks
run: |
ansible-playbook clean-up.yml --extra-vars "@vars.yml" || :

View File

@ -4,33 +4,31 @@ on:
workflow_dispatch:
inputs:
linux-version:
description: 'Archlinux kernel version to build a driver against, eg: 6.2.arch1-1'
required: true
description: 'Archlinux kernel version to build a driver against, eg: 6.2.arch1-1 or empty to build latest mainline'
required: false
type: string
schedule:
- 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
echo " probe: probe.o" >> dk.yaml
@ -44,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@v3
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@v1.6.0
if: always() && inputs.linux-version == ''
uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0
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

@ -1,53 +1,144 @@
name: Deploy Github Pages
on:
workflow_run:
workflows: ["Test drivers against a matrix of kernels/distros"]
types: [completed]
push:
branches: [master]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
group: pages
cancel-in-progress: true
jobs:
kernel-tests-master:
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,perf-libs-master]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download matrixes
uses: dawidd6/action-download-artifact@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download matrix X64
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
workflow: kernel_tests.yaml
branch: master
name: matrix_*
name_is_regexp: true
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@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
- name: Move ARM64 matrix under docs
run: mv matrix.md docs/matrix_ARM64.md
- name: Disable Table Of Content for matrixes pages
run: |
mv matrix_*/*.md docs/
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@v2
- 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@v1
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: 'site'
- id: deployment
uses: actions/deploy-pages@v1
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

@ -1,42 +1,177 @@
name: Generate release body
name: Generate release body for published releases
on:
workflow_run:
workflows: ["Test drivers against a matrix of kernels/distros"]
types: [completed]
branches-ignore: ['master'] # ignore master runs (we could skip this given the below extract semver check; still, this is a small optimization)
permissions:
contents: write
release:
types: [published]
# Checks if any concurrent jobs is running for driver release CI and eventually wait for it.
concurrency:
group: "release-body"
cancel-in-progress: true
group: release
cancel-in-progress: false
jobs:
release-body:
release-settings:
runs-on: ubuntu-latest
outputs:
is_latest: ${{ steps.get_settings.outputs.is_latest }}
is_driver: ${{ steps.get_settings.outputs.is_driver }}
steps:
- name: Get latest release
uses: rez0n/actions-github-release@27a57820ee808f8fd940c8a9d1f7188f854aa2b5 # v2.0
id: latest_release
env:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
type: "stable"
- name: Get settings for this release
id: get_settings
shell: python
run: |
import os
import re
import sys
semver_no_meta = '''^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'''
tag_name = '${{ github.event.release.tag_name }}'
is_valid_version = re.match(semver_no_meta, tag_name) is not None
if not is_valid_version:
print(f'Release version {tag_name} is not a valid full or pre-release. See RELEASE.md for more information.')
sys.exit(1)
is_prerelease = '-' in tag_name
# 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
permissions:
contents: write
runs-on: ubuntu-latest
steps:
# Note: there is no `tag` filter for `workflow_run`.
# We need to manually check whether we are running on a tag.
- name: Extract semver
uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ github.event.workflow_run.head_branch }}
regex: '[0-9]+.[0-9]+.[0-9]+\+driver$'
- name: Clone repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Skip on non driver tag
if: steps.regex-match.outputs.match == ''
run: exit 0
- name: Download matrixes
uses: dawidd6/action-download-artifact@v2
- 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)
prefix="#define SCAP_MINIMUM_DRIVER_API_VERSION PPM_API_VERSION"
MIN_API_VER=${MIN_API_VER/#$prefix}
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)
prefix="#define SCAP_MINIMUM_DRIVER_SCHEMA_VERSION PPM_API_VERSION"
MIN_SCHEMA_VER=${MIN_SCHEMA_VER/#$prefix}
MIN_SCHEMA_VER=$(echo $MIN_SCHEMA_VER | tr -d "(" | tr -d ")")
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:
workflow: kernel_tests.yaml
name: matrix_*
name_is_regexp: true
run_id: ${{ github.event.workflow_run.id }}
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@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
tag_name: ${{ github.event.release.tag_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
uses: ./.github/workflows/reusable_kernel_tests.yaml
with:
libsversion: ${{ github.event.release.tag_name }}
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
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Clone libs repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create release body file
run: |
touch release-body.md
- name: Extract API and SCHEMA versions
run: |
touch release-body.md
API_VERS=$(cat driver/API_VERSION)
SCHEMA_VERS=$(cat driver/SCHEMA_VERSION)
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@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@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
- name: Rename ARM64 matrix
run: mv matrix.md matrix_ARM64.md
# Steps:
# Remove everything after the table (ie: since the first line that starts with "# ",
# ie: a markdown section start.
@ -45,18 +180,31 @@ jobs:
# Finally, merge them together
- name: Append matrixes to create release body
run: |
mv matrix_*/*.md .
sed -i -n '/# /q;p' matrix_X64.md
sed -i -n '/# /q;p' matrix_ARM64.md
sed -i 's/\[\(.\)\]([^)]*)/\1/g' matrix_X64.md
sed -i 's/\[\(.\)\]([^)]*)/\1/g' matrix_ARM64.md
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
cat matrix_X64.md matrix_ARM64.md >> release-body.md
- name: Generate release notes
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
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
append_body: true
tag_name: ${{ github.event.workflow_run.head_branch }}
tag_name: ${{ github.event.release.tag_name }}
name: ${{ github.event.release.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

@ -0,0 +1,58 @@
name: Test drivers against a matrix of kernels/distros
on:
workflow_dispatch:
inputs:
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'
workflow_call:
inputs:
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'
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}}" ]
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:
libsversion: ${{ inputs.libsversion }}
libsrepo: ${{ inputs.libsrepo }}
build_matrix: 'true'
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: matrix_${{matrix.architecture}}
path: ${{ steps.kernel_tests.outputs.matrix_output }}

44
.github/workflows/semgrep_checks.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Semgrep Checks
on:
pull_request:
branches:
- master
- 'release/**'
- 'maintainers/**'
jobs:
insecure-api:
name: check-insecure-api
runs-on: ubuntu-latest
container:
image: docker.io/semgrep/semgrep:1.85.0@sha256:b4c2272e0a2e59ca551ff96d3bbae657bd2b7356e339af557b27a96d9e751544
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Scan PR for insecure API usage 🕵️
run: |
semgrep scan \
--error \
--metrics=off \
--baseline-commit ${{ github.event.pull_request.base.sha }} \
--config=./semgrep/insecure-api
absolute-include-paths:
name: check-absolute-include-paths
runs-on: ubuntu-latest
container:
image: docker.io/semgrep/semgrep:1.85.0@sha256:b4c2272e0a2e59ca551ff96d3bbae657bd2b7356e339af557b27a96d9e751544
steps:
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Scan PR for libs relateive include paths 🕵️
run: |
semgrep scan \
--error \
--metrics=off \
--baseline-commit ${{ github.event.pull_request.base.sha }} \
--config=./semgrep/absolute-include-paths.yaml

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

@ -7,29 +7,26 @@ on:
jobs:
update-syscalls:
runs-on: ubuntu-latest
container:
image: falcosecurity/syscalls-bumper:latest
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Git set-up
run: |
apk update && apk add git
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: master
path: libs
- name: Bump syscalls
run: |
syscalls-bumper --repo-root $(pwd) --overwrite
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5-rc
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@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
path: libs
signoff: true
base: master
branch: update/syscalls

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

@ -1,33 +1,33 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2022 The Falco Authors.
# 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.
#
# 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)
@ -37,16 +37,36 @@ 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.
if(NOT (CMAKE_MSVC_RUNTIME_LIBRARY OR BUILD_SHARED_LIBS))
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
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 eBPF probe driver, no kubernetes, no mesos, no marathon and 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)
if(${CMAKE_VERSION} VERSION_LESS "3.1.0" AND BUILD_SHARED_LIBS)
# scap_engine_savefile uses target_sources
@ -56,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)
@ -87,15 +106,13 @@ set(LIBS_PACKAGE_NAME "falcosecurity")
include(CompilerFlags)
option(WITH_CHISEL "Include chisel implementation" OFF)
option(CREATE_TEST_TARGETS "Enable make-targets for unit testing" ON)
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}")
@ -105,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)
@ -122,8 +138,15 @@ if(CREATE_TEST_TARGETS)
add_subdirectory(test/libscap)
endif()
if(ENABLE_VM_TESTS)
add_subdirectory(test/vm)
if(ENABLE_LIBSINSP_E2E_TESTS)
message(WARNING "LIBSINSP_E2E_TESTS are experimental!")
add_subdirectory(test/libsinsp_e2e)
add_subdirectory(test/libsinsp_e2e/resources)
endif()
endif()
option(ENABLE_BENCHMARKS "Enable Benchmarks" OFF)
if(ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
endif()

View File

@ -1,17 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 The Falco Authors.
# 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)
@ -19,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
```

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] 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.

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

@ -3,16 +3,15 @@
[![Falco Core Repository](https://github.com/falcosecurity/evolution/blob/main/repos/badges/falco-core-blue.svg)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#core-scope) [![Stable](https://img.shields.io/badge/status-stable-brightgreen?style=for-the-badge)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#stable) [![License](https://img.shields.io/github/license/falcosecurity/libs?style=for-the-badge)](./COPYING)
[![CI Build](https://github.com/falcosecurity/libs/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/falcosecurity/libs/actions/workflows/ci.yml)
[![Architectures](https://img.shields.io/badge/ARCHS-x86__64%7Caarch64%7Cs390x-blueviolet)](#drivers-officially-supported-architectures)
[![Architectures](https://img.shields.io/badge/ARCHS-x86__64%7Caarch64%7Cs390x%7Criscv64%7Cppc64le-blueviolet)](#drivers-officially-supported-architectures)
[![Drivers](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/FedeDP/1cbc5d42edf8e3a02fb75e76625f1072/raw/kernel.json)](https://github.com/falcosecurity/libs/actions/workflows/latest-kernel.yml)
[![Kernel Tests](https://github.com/falcosecurity/libs/actions/workflows/kernel_tests.yaml/badge.svg)](https://github.com/falcosecurity/libs/actions/workflows/kernel_tests.yaml)
[![Github Pages](https://github.com/falcosecurity/libs/actions/workflows/pages.yml/badge.svg)](https://falcosecurity.github.io/libs/)
This repository contains **libsinsp**, **libscap**, the **kernel module** and the **eBPF probes** sources.
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:
@ -23,8 +22,7 @@ An image is worth a thousand words, they say:
* [_driver/_](./driver) contains kernel module and eBPF probe source code,
so-called **drivers**.
* [_userspace/_](./userspace) contains libscap and libsinsp libraries code,
plus chisels related code and common utilities.
* [_userspace/_](./userspace) contains libscap and libsinsp libraries code.
* **libscap** (aka lib for *System CAPture*) is the userspace library
that directly communicates with the drivers, reading syscall events from
the ring buffer (where drivers place them), and forwarding them
@ -34,9 +32,6 @@ plus chisels related code and common utilities.
libscap and enriches them with machine state: moreover, it performs
events filtering with rule evaluation through its internal rule engine.
Finally, it manages outputs.
* **chisels** are just little Lua scripts to analyze an event stream
and perform useful actions. In this subfolder, the backend code for
chisels support can be found.
* [_proposals/_](./proposals) unexpectedly contains the list of proposals.
* [_cmake/modules/_](./cmake/modules) contains modules to build
external dependencies, plus the libscap and libsinsp ones; consumers
@ -46,11 +41,13 @@ external dependencies, plus the libscap and libsinsp ones; consumers
Our drivers officially support the following architectures:
| | Kernel module | eBPF probe | Modern eBPF probe | Status |
| ----------- |----------------------------------------------------------------------------------------------| ---------- | ----------------- | ------ |
| **x86_64** | >= 2.6 | >= 4.14 | >= 5.8 | _STABLE_ |
| **aarch64** | >= [3.16](https://github.com/torvalds/linux/commit/055b1212d141f1f398fca548f8147787c0b6253f) | >= 4.17 | >= 5.8 | _STABLE_ |
| **s390x** | >= 2.6 | >= [5.5](https://github.com/torvalds/linux/commit/6ae08ae3dea) | >= 5.8 | _EXPERIMENTAL_ |
| | Kernel module | eBPF probe | Modern eBPF probe | Status |
| ----------- |----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| ----------------- | ------ |
| **x86_64** | >= 2.6 | >= 4.14 | >= 5.8 | _STABLE_ |
| **aarch64** | >= [3.16](https://github.com/torvalds/linux/commit/055b1212d141f1f398fca548f8147787c0b6253f) | >= 4.17 | >= 5.8 | _STABLE_ |
| **s390x** | >= 2.6 | >= [5.5](https://github.com/torvalds/linux/commit/6ae08ae3dea) | >= 5.8 | _EXPERIMENTAL_ |
| **riscv64** | >= [5.0](https://github.com/torvalds/linux/commit/5aeb1b36cedd3a1dfdbfe368629fed52dee34103) | N/A | N/A | _EXPERIMENTAL_ |
| **ppc64le** | >= 2.6 | >= [5.1](https://github.com/torvalds/linux/commit/ed1cd6deb013a11959d17a94e35ce159197632da) | >= 5.8 | _STABLE_ |
To access up-to-date status reports on Falco drivers kernel testing, please visit this [page](https://falcosecurity.github.io/libs/). It provides a list of supported syscalls as well as the [report](https://falcosecurity.github.io/libs/report/).
@ -107,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`)
@ -138,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 ../;
@ -149,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:
@ -196,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 \
@ -210,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 \
@ -246,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).
@ -262,9 +259,11 @@ cmake \
-DCREATE_TEST_TARGETS=ON \
-DENABLE_LIBSCAP_TESTS=ON \
-DENABLE_DRIVERS_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.
> __TIP:__ Installing and using the package `ccache` can optimize repeated testing, but we don't offer official support or testing for it.
```bash
@ -302,9 +301,20 @@ 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
To correctly run the new libsinsp e2e tests on x86_64 `gcc-multilib` and `g++-multilib` are needed. To run the tests, use the following commands:
```bash
make -j$(($nproc-1)) libsinsp_e2e_tests;
# Run each drivers test via changing flags
sudo ./test/libsinsp_e2e/libsinsp_e2e_tests -m;
```
</details>

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);

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright (C) 2021 The Falco Authors.
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.
@ -14,10 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//
// mesos_common.h
//
#pragma once
#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

@ -1,3 +1,18 @@
# 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(BUILD_WARNINGS_AS_ERRORS "Enable building with -Wextra -Werror flags")
option(ENABLE_PIC "Build position independent libraries and executables" ${BUILD_SHARED_LIBS})
@ -10,30 +25,86 @@ endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(FALCOSECURITY_LIBS_USERSPACE_COMPILE_FLAGS "")
set(FALCOSECURITY_LIBS_USERSPACE_LINK_FLAGS "")
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")
set(FALCOSECURITY_LIBS_COVERAGE_FLAGS "-O0 -fprofile-arcs -ftest-coverage")
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-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-implicit-fallthrough -Wno-format-truncation")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -Wextra ${CMAKE_SUPPRESSED_WARNINGS}")
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}"
)
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"
)
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"
)
if(UBSAN_HALT_ON_ERROR)
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"
)
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}")
@ -42,21 +113,19 @@ if(NOT MSVC)
set(CMAKE_C_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_C_FLAGS_COVERAGE "${FALCOSECURITY_LIBS_COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS_COVERAGE "${FALCOSECURITY_LIBS_COVERAGE_FLAGS}")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DHAS_CAPTURE)
endif()
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_DEBUG_FLAGS "/MTd /Od")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "/MT")
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")
else()
# /MT vs /MD should be determined via CMAKE_MSVC_RUNTIME_LIBRARY
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "/Od")
endif()
set(CMAKE_C_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS}")
@ -67,5 +136,9 @@ else() # MSVC
set(CMAKE_C_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
add_definitions(-D_HAS_STD_BYTE=0)
# "_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 _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR NOMINMAX
)
endif()

View File

@ -1,43 +1,34 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 The Falco Authors.
# 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

@ -1,35 +1,33 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2022 The Falco Authors.
# 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

@ -1,191 +1,226 @@
# 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
# 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)
endfunction()
set(${_var}
"${dev_version}"
PARENT_SCOPE
)
endfunction()

View File

@ -1,29 +0,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.
#
# We take b64 implementation directly from:
# https://raw.githubusercontent.com/istio/proxy/1.18.2/extensions/common/wasm/base64.h
set(B64_DOWNLOAD_URL "https://raw.githubusercontent.com/istio/proxy/1.18.2/extensions/common/wasm/base64.h")
set(B64_INCLUDE "${CMAKE_BINARY_DIR}/b64")
if(NOT EXISTS "${B64_INCLUDE}/base64.h")
file(MAKE_DIRECTORY "${B64_INCLUDE}")
message(STATUS "Download 'base64.h' from: ${B64_DOWNLOAD_URL}")
file(DOWNLOAD
"${B64_DOWNLOAD_URL}"
"${B64_INCLUDE}/base64.h"
)
endif()
include_directories("${B64_INCLUDE}")

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,51 +0,0 @@
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 ${CMAKE_MAKE_PROGRAM}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${CARES_INCLUDE} ${CARES_LIB}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} 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

@ -1,23 +1,51 @@
# 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.
#
# 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
execute_process(COMMAND git rev-parse HEAD OUTPUT_VARIABLE GIT_COMMIT ERROR_QUIET WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
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,103 +0,0 @@
#
# libcurl
#
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_2_0/curl-8.2.0.tar.bz2"
URL_HASH "SHA256=080aaa5bef29ab3f592101e7a95f32ddbe88b92125cb28dde479d5a104928ea4"
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 ${CMAKE_MAKE_PROGRAM}
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

@ -0,0 +1,31 @@
option(CREATE_TEST_TARGETS "Enable make-targets for unit testing" ON)
if(CREATE_TEST_TARGETS)
# Add engine only used for testing
set(HAS_ENGINE_TEST_INPUT On)
endif()
set(HAS_ENGINE_NODRIVER On)
set(HAS_ENGINE_SAVEFILE On)
set(HAS_ENGINE_SOURCE_PLUGIN On)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
option(ENABLE_ENGINE_KMOD "Enable kernel module engine" ON)
option(ENABLE_ENGINE_BPF "Enable bpf engine" ON)
set(HAS_ENGINE_KMOD ${ENABLE_ENGINE_KMOD})
set(HAS_ENGINE_BPF ${ENABLE_ENGINE_BPF})
option(BUILD_LIBSCAP_MODERN_BPF "Enable modern bpf probe" OFF)
if(BUILD_LIBSCAP_MODERN_BPF)
set(HAS_ENGINE_MODERN_BPF On)
endif()
endif()
# gVisor is currently only supported on Linux x86_64
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)
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,208 +0,0 @@
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

@ -1,43 +1,77 @@
# 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_GTEST "Enable building of the bundled gtest" ${USE_BUNDLED_DEPS})
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

@ -1,79 +0,0 @@
#
# jq
#
option(USE_BUNDLED_JQ "Enable building of the bundled jq" ${USE_BUNDLED_DEPS})
if(JQ_INCLUDE)
# we already have jq
elseif(NOT USE_BUNDLED_JQ)
find_path(JQ_INCLUDE jq.h PATH_SUFFIXES jq)
find_library(JQ_LIB NAMES jq)
if(JQ_INCLUDE AND JQ_LIB)
message(STATUS "Found jq: include: ${JQ_INCLUDE}, lib: ${JQ_LIB}")
else()
message(FATAL_ERROR "Couldn't find system jq")
endif()
else()
set(JQ_SRC "${PROJECT_BINARY_DIR}/jq-prefix/src/jq")
message(STATUS "Using bundled jq in '${JQ_SRC}'")
set(JQ_INCLUDE "${JQ_SRC}/target/include/")
set(JQ_INSTALL_DIR "${JQ_SRC}/target")
if(BUILD_SHARED_LIBS)
set(JQ_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(JQ_STATIC_OPTION --enable-shared --disable-static)
set(JQ_LDFLAGS )
else()
set(JQ_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(JQ_STATIC_OPTION --enable-all-static)
set(JQ_LDFLAGS -all-static)
endif()
set(JQ_LIB "${JQ_INSTALL_DIR}/lib/libjq${JQ_LIB_SUFFIX}")
set(ONIGURUMA_LIB "${JQ_INSTALL_DIR}/lib/libonig${JQ_LIB_SUFFIX}")
if(APPLE)
unset(JQ_LDFLAGS)
set(CPPFLAGS -D_REENTRANT)
endif()
if(NOT TARGET jq)
message(STATUS "Bundled jq: include: ${JQ_INCLUDE}, lib: ${JQ_LIB}")
# Why we mirror jq here?
#
# In their readme, jq claims that you don't have
# to do autoreconf -fi when downloading a released tarball.
#
# However, they forgot to push the released makefiles
# into their release tarbal.
#
# For this reason, we have to mirror their release after
# doing the configuration ourselves.
#
# This is needed because many distros do not ship the right
# version of autoreconf, making virtually impossible to build libs on them.
# Read more about it here:
# https://github.com/stedolan/jq/issues/2061#issuecomment-593445920
ExternalProject_Add(
jq
PREFIX "${PROJECT_BINARY_DIR}/jq-prefix"
URL "https://download.falco.org/dependencies/jq-1.6.tar.gz"
URL_HASH "SHA256=787518068c35e244334cc79b8e56b60dbab352dff175b7f04a94f662b540bfd9"
CONFIGURE_COMMAND CPPFLAGS=${CPPFLAGS} ./configure --disable-maintainer-mode ${JQ_STATIC_OPTION} --disable-dependency-tracking --with-oniguruma=builtin --prefix=${JQ_INSTALL_DIR}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} clean all LDFLAGS=${JQ_LDFLAGS}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${JQ_LIB} ${ONIGURUMA_LIB}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install)
install(FILES "${JQ_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(FILES "${ONIGURUMA_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${JQ_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
endif()
endif()
if(NOT TARGET jq)
add_custom_target(jq)
endif()
include_directories("${JQ_INCLUDE}")

View File

@ -1,5 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
#
# JsonCpp
# 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_JSONCPP "Enable building of the bundled jsoncpp" ${USE_BUNDLED_DEPS})
@ -34,65 +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
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="/MTd /Od"
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
-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:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-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

@ -1,44 +1,80 @@
# SPDX-License-Identifier: Apache-2.0
#
# libbpf
# 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_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()
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.2.2.tar.gz"
URL_HASH
"SHA256=32b0c41eabfbbe8e0c8aea784d7495387ff9171b5a338480a8fbaceb9da8d5e5"
CONFIGURE_COMMAND mkdir -p build root
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} 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 ""
)
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

@ -1,59 +1,75 @@
# SPDX-License-Identifier: Apache-2.0
#
# LIBELF
# 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.
#
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)
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.187/elfutils-0.187.tar.bz2"
URL_HASH "SHA256=e70b0dfbe610f90c4d1fe0d71af142a4e25c3c4ef9ebab8d2d72b65159d454c8"
CONFIGURE_COMMAND ./configure LDFLAGS=-L${ZLIB_SRC} "CFLAGS=-I${ZLIB_INCLUDE}" --enable-deterministic-archives --disable-debuginfod --disable-libdebuginfod
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -C lib libeu.a
COMMAND ${CMAKE_MAKE_PROGRAM} -C libelf libelf${LIBELF_LIB_SUFFIX}
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
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

@ -1,125 +1,141 @@
# 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.
#
if(NOT HAVE_LIBSCAP)
set(HAVE_LIBSCAP On)
set(HAVE_LIBSCAP On)
# This should be renamed in `LIBS_DIR` not `LIBSCAP_DIR`
if(NOT LIBSCAP_DIR)
get_filename_component(LIBSCAP_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()
configure_file(${LIBSCAP_DIR}/userspace/common/common_config.h.in ${PROJECT_BINARY_DIR}/common/common_config.h)
include_directories(${PROJECT_BINARY_DIR}/common)
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 ${LIBSCAP_DIR}/userspace/libscap ABSOLUTE)
set(LIBSCAP_INCLUDE_DIRS ${LIBSCAP_INCLUDE_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(${LIBSCAP_DIR}/userspace/libscap ${PROJECT_BINARY_DIR}/libscap)
set(LIBSCAP_INSTALL_LIBS)
# All of the targets in userspace/libscap
get_directory_property(libscap_subdirs DIRECTORY ${LIBSCAP_DIR}/userspace/libscap SUBDIRECTORIES)
set(libscap_subdir_targets)
foreach(libscap_subdir ${LIBSCAP_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)
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)
list(APPEND libscap_link_libraries ${install_lib_link_library})
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}")
configure_file(${LIBSCAP_DIR}/userspace/libscap/libscap.pc.in ${PROJECT_BINARY_DIR}/libscap/libscap.pc @ONLY)
install(TARGETS ${LIBSCAP_INSTALL_LIBS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "scap" OPTIONAL)
install(DIRECTORY "${LIBSCAP_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
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 "${LIBSCAP_DIR}/userspace/common" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
COMPONENT "scap"
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "${PROJECT_BINARY_DIR}/common" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
COMPONENT "scap"
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "${LIBSCAP_DIR}/userspace/plugin" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
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/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

@ -1,103 +1,90 @@
# 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.
#
if(NOT HAVE_LIBSINSP)
set(HAVE_LIBSINSP On)
set(HAVE_LIBSINSP On)
if(NOT LIBSINSP_DIR)
get_filename_component(LIBSINSP_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)
option(WITH_CHISEL "Include chisel implementation" 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()
include(jsoncpp)
include(valijson)
include(re2)
include(ExternalProject)
include(libscap)
if (NOT EMSCRIPTEN)
include(tbb)
endif()
if(NOT WIN32 AND NOT APPLE)
include(b64)
include(jq)
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)
if(ENABLE_THREAD_POOL AND NOT EMSCRIPTEN)
include(bs_threadpool)
endif()
set(LIBSINSP_INCLUDE_DIRS ${LIBSINSP_DIR}/userspace/libsinsp ${LIBSINSP_DIR}/userspace/common ${LIBSCAP_INCLUDE_DIRS} ${DRIVER_CONFIG_DIR})
if(WITH_CHISEL)
list(APPEND LIBSINSP_INCLUDE_DIRS ${LIBSINSP_DIR}/userspace/chisel)
endif()
set(LIBSINSP_INCLUDE_DIRS)
if (NOT EMSCRIPTEN)
get_filename_component(TBB_ABSOLUTE_INCLUDE_DIR ${TBB_INCLUDE_DIR} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${TBB_ABSOLUTE_INCLUDE_DIR})
endif()
if(NOT USE_BUNDLED_TBB AND NOT EMSCRIPTEN)
list(APPEND LIBSINSP_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
endif()
get_filename_component(JSONCPP_ABSOLUTE_INCLUDE_DIR ${JSONCPP_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JSONCPP_ABSOLUTE_INCLUDE_DIR})
if(NOT USE_BUNDLED_JSONCPP)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JSONCPP_INCLUDE})
endif()
get_filename_component(VALIJSON_ABSOLUTE_INCLUDE_DIR ${VALIJSON_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${VALIJSON_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()
get_filename_component(RE2_ABSOLUTE_INCLUDE_DIR ${RE2_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${RE2_ABSOLUTE_INCLUDE_DIR})
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)
get_filename_component(B64_ABSOLUTE_INCLUDE_DIR ${B64_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${B64_ABSOLUTE_INCLUDE_DIR})
get_filename_component(JQ_ABSOLUTE_INCLUDE_DIR ${JQ_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JQ_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(${LIBSINSP_DIR}/userspace/libsinsp ${CMAKE_BINARY_DIR}/libsinsp)
install(TARGETS sinsp
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "sinsp")
install(DIRECTORY "${LIBSINSP_DIR}/userspace/libsinsp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h"
PATTERN "*third_party*" EXCLUDE
PATTERN "*examples*" EXCLUDE
PATTERN "*doxygen*" EXCLUDE
PATTERN "*scripts*" EXCLUDE
PATTERN "*test*" EXCLUDE)
install(DIRECTORY "${LIBSINSP_DIR}/common" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "${LIBSINSP_DIR}/userspace/async" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h")
if(WITH_CHISEL)
install(DIRECTORY "${LIBSINSP_DIR}/userspace/chisel" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
COMPONENT "sinsp"
FILES_MATCHING PATTERN "*.h")
endif()
install(FILES ${PROJECT_BINARY_DIR}/libsinsp/libsinsp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()

View File

@ -1,103 +0,0 @@
#
# LuaJIT
#
option(USE_BUNDLED_LUAJIT "Enable building of the bundled LuaJIT" ${USE_BUNDLED_DEPS})
if(LUAJIT_INCLUDE)
# we already have luajit
elseif(NOT USE_BUNDLED_LUAJIT)
find_path(LUAJIT_INCLUDE luajit.h PATH_SUFFIXES luajit-2.0 luajit-2.1 luajit)
find_library(LUAJIT_LIB NAMES luajit luajit-5.1)
if(LUAJIT_INCLUDE AND LUAJIT_LIB)
message(STATUS "Found LuaJIT: include: ${LUAJIT_INCLUDE}, lib: ${LUAJIT_LIB}")
else()
# alternatively try stock Lua
find_package(Lua51)
set(LUAJIT_LIB ${LUA_LIBRARY})
set(LUAJIT_INCLUDE ${LUA_INCLUDE_DIR})
if(NOT ${LUA51_FOUND})
message(FATAL_ERROR "Couldn't find system LuaJIT or Lua")
endif()
endif()
else()
set(LUAJIT_SRC "${PROJECT_BINARY_DIR}/luajit-prefix/src/luajit/src")
set(LUAJIT_INCLUDE "${LUAJIT_SRC}/")
if(NOT WIN32)
set(LUAJIT_LIB "${LUAJIT_SRC}/libluajit.a")
else()
set(LUAJIT_LIB "${LUAJIT_SRC}/lua51.lib")
endif()
if(NOT TARGET luajit)
message(STATUS "Using bundled LuaJIT in '${LUAJIT_SRC}'")
if(NOT WIN32)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
GIT_REPOSITORY "https://github.com/moonjit/moonjit"
GIT_TAG "2.1.2"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
UPDATE_COMMAND ""
INSTALL_COMMAND "")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "s390x")
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
GIT_REPOSITORY "https://github.com/linux-on-ibm-z/LuaJIT.git"
GIT_TAG "v2.1"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
UPDATE_COMMAND ""
INSTALL_COMMAND "")
elseif(APPLE)
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
URL "https://github.com/LuaJIT/LuaJIT/archive/8635cbabf3094c4d8bd00578c7d812bea87bb2d3.tar.gz"
URL_HASH "SHA256=835035b244c3dc3d3d19bdd5ac623af90b84207e6330fb78f9fa51d6e200d760"
CONFIGURE_COMMAND ""
BUILD_COMMAND make MACOSX_DEPLOYMENT_TARGET=10.14
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
INSTALL_COMMAND "")
else()
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
GIT_REPOSITORY "https://github.com/LuaJIT/LuaJIT"
GIT_TAG "f3c856915b4ce7ccd24341e8ac73e8a9fd934171"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
UPDATE_COMMAND ""
INSTALL_COMMAND "")
endif()
install(FILES "${LUAJIT_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps")
install(DIRECTORY "${LUAJIT_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}"
COMPONENT "libs-deps"
FILES_MATCHING PATTERN "*.h")
else()
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.1.0-beta3.tar.gz"
URL_HASH "SHA256=409f7fe570d3c16558e594421c47bdd130238323c9d6fd6c83dedd2aaeb082a8"
CONFIGURE_COMMAND ""
BUILD_COMMAND msvcbuild.bat
BUILD_BYPRODUCTS ${LUAJIT_LIB}
BINARY_DIR "${LUAJIT_SRC}"
INSTALL_COMMAND "")
endif()
endif()
endif()
if(NOT TARGET luajit)
add_custom_target(luajit)
endif()
include_directories("${LUAJIT_INCLUDE}")

View File

@ -1,51 +0,0 @@
#
# OpenSSL
#
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.1/openssl-3.1.1.tar.gz"
URL_HASH "SHA256=b3aa61334233b852b63ddb048df181177c2c659eb9d4376008118f9c08d07674"
CONFIGURE_COMMAND ./config ${OPENSSL_SHARED_OPTION} --prefix=${OPENSSL_INSTALL_DIR} --libdir=lib
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} 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

@ -1,3 +1,18 @@
# 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_PROTOBUF "Enable building of the bundled protobuf" ${USE_BUNDLED_DEPS})
if(PROTOBUF_INCLUDE)
@ -6,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()
@ -24,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.17.3/protobuf-cpp-3.17.3.tar.gz"
URL_HASH "SHA256=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb"
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}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
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

@ -1,6 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
#
# RE2
# 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_RE2 "Enable building of the bundled RE2" ${USE_BUNDLED_DEPS})
if(RE2_INCLUDE)
@ -29,56 +41,96 @@ else()
if(NOT WIN32)
set(RE2_LIB "${RE2_SRC}/lib/libre2${RE2_LIB_SUFFIX}")
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})
set(RE2_LIB_PATTERN "libre2*")
if(CMAKE_VERSION VERSION_LESS 3.29.1)
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
-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:
# https://github.com/google/re2/commit/9ebe4a22cad8a025b68a9594bdff3c047a111333
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
-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="/MTd /Od"
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
-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:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-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 "libre2*")
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

@ -1,6 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
#
# Intel tbb
# 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_TBB "Enable building of the bundled tbb" ${USE_BUNDLED_DEPS})
if(TBB_INCLUDE_DIR)
@ -41,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.8.0.tar.gz")
set(TBB_SRC_URL_HASH "SHA256=eee380323bb7ce864355ed9431f85c43955faaae9e9bce35c62b372d7ffd9f8b")
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="/MTd /Od"
-DCMAKE_CXX_FLAGS_RELEASE="/MT"
-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:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-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

@ -1,48 +0,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.
#
#
# Tinydir (https://github.com/cxong/tinydir/)
#
option(USE_BUNDLED_TINYDIR "Enable building of the bundled tinydir" ${USE_BUNDLED_DEPS})
if(TINYDIR_INCLUDE)
# we already have tinydir
elseif(NOT USE_BUNDLED_TINYDIR)
find_path(TINYDIR_INCLUDE tinydir.h)
if(TINYDIR_INCLUDE)
message(STATUS "Found tinydir: include: ${TINYDIR_INCLUDE}")
else()
message(FATAL_ERROR "Couldn't find system tinydir")
endif()
else()
set(TINYDIR_SRC "${PROJECT_BINARY_DIR}/tinydir-prefix/src/tinydir")
set(TINYDIR_INCLUDE "${TINYDIR_SRC}")
message(STATUS "Using bundled tinydir in '${TINYDIR_SRC}'")
ExternalProject_Add(tinydir
PREFIX "${PROJECT_BINARY_DIR}/tinydir-prefix"
URL "https://github.com/cxong/tinydir/archive/refs/tags/1.2.5.tar.gz"
URL_HASH "SHA256=7ab150a16fa78ea76e9fd58ef88922c03eca2334c023b8d9bc94755fdde522c7"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
endif()
if(NOT TARGET tinydir)
add_custom_target(tinydir)
endif()
include_directories("${TINYDIR_INCLUDE}")

View File

@ -1,23 +1,50 @@
# 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
# 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})
set(UTHASH_DOWNLOAD_URL "https://raw.githubusercontent.com/troydhanson/uthash/v1.9.8/src/uthash.h")
set(UTHASH_DOWNLOAD_DIR "${LIBSCAP_DIR}/userspace/libscap")
set(UTHASH_DOWNLOAD_DIR "${LIBS_DIR}/userspace/libscap")
if(NOT EXISTS "${UTHASH_DOWNLOAD_DIR}/uthash.h")
message(STATUS "Download 'uthash.h' from: ${UTHASH_DOWNLOAD_URL}")
file(DOWNLOAD
"${UTHASH_DOWNLOAD_URL}"
"${UTHASH_DOWNLOAD_DIR}/uthash.h"
if(UTHASH_INCLUDE)
# we already have uthash
elseif(NOT USE_BUNDLED_UTHASH)
find_path(UTHASH_INCLUDE uthash.h)
if(UTHASH_INCLUDE)
message(STATUS "Found uthash: include: ${UTHASH_INCLUDE}")
else()
message(FATAL_ERROR "Couldn't find system uthash")
endif()
else()
set(UTHASH_SRC "${PROJECT_BINARY_DIR}/uthash-prefix/src/uthash/src")
set(UTHASH_INCLUDE "${UTHASH_SRC}")
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 ""
)
endif()
if(NOT TARGET uthash)
add_custom_target(uthash)
endif()
include_directories("${UTHASH_INCLUDE}")

View File

@ -1,14 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2020 The Falco Authors.
# 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.
#
#
@ -27,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/v0.6.tar.gz"
URL_HASH "SHA256=e06bf78fc1d26d4956fabc182408ebbbc47e3a6699778cda4aa439c2a6110b09"
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

@ -1,51 +1,58 @@
# 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
# 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()
endfunction()
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

@ -1,6 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
#
# zlib
# 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_ZLIB "Enable building of the bundled zlib" ${USE_BUNDLED_DEPS})
if(ZLIB_INCLUDE)
@ -17,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"
@ -31,44 +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}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
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()
set(ZLIB_LIB "${ZLIB_SRC}/zlib.lib")
ExternalProject_Add(zlib
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()
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
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,381 +1,418 @@
| SYSCALL | SUPPORTED |
|-------------------------|-----------|
| _sysctl | 🟡 |
| accept | 🟢 |
| accept4 | 🟢 |
| access | 🟢 |
| acct | 🟡 |
| add_key | 🟡 |
| adjtimex | 🟡 |
| alarm | 🟡 |
| arch_prctl | 🟡 |
| bdflush | 🟡 |
| bind | 🟢 |
| bpf | 🟢 |
| brk | 🟢 |
| cachestat | 🟡 |
| capget | 🟡 |
| capset | 🟢 |
| chdir | 🟢 |
| chmod | 🟢 |
| chown | 🟢 |
| chroot | 🟢 |
| clock_adjtime | 🟡 |
| clock_getres | 🟡 |
| clock_gettime | 🟡 |
| clock_nanosleep | 🟡 |
| clock_settime | 🟡 |
| clone | 🟢 |
| clone3 | 🟢 |
| close | 🟢 |
| close_range | 🟡 |
| connect | 🟢 |
| copy_file_range | 🟢 |
| creat | 🟢 |
| create_module | 🟡 |
| delete_module | 🟡 |
| dup | 🟢 |
| dup2 | 🟢 |
| dup3 | 🟢 |
| epoll_create | 🟢 |
| epoll_create1 | 🟢 |
| epoll_ctl | 🟡 |
| epoll_ctl_old | 🟡 |
| epoll_pwait | 🟡 |
| epoll_pwait2 | 🟡 |
| epoll_wait | 🟢 |
| epoll_wait_old | 🟡 |
| eventfd | 🟢 |
| eventfd2 | 🟢 |
| execve | 🟢 |
| execveat | 🟢 |
| exit | 🟡 |
| exit_group | 🟡 |
| faccessat | 🟡 |
| faccessat2 | 🟡 |
| fadvise64 | 🟡 |
| fallocate | 🟡 |
| fanotify_init | 🟡 |
| fanotify_mark | 🟡 |
| fchdir | 🟢 |
| fchmod | 🟢 |
| fchmodat | 🟢 |
| fchown | 🟢 |
| fchownat | 🟢 |
| fcntl | 🟢 |
| fdatasync | 🟡 |
| fgetxattr | 🟡 |
| finit_module | 🟢 |
| flistxattr | 🟡 |
| flock | 🟢 |
| fork | 🟢 |
| fremovexattr | 🟡 |
| fsconfig | 🟢 |
| fsetxattr | 🟡 |
| fsmount | 🟡 |
| fsopen | 🟡 |
| fspick | 🟡 |
| fstat | 🟢 |
| fstatfs | 🟡 |
| fstatfs64 | 🟡 |
| fsync | 🟡 |
| ftruncate | 🟡 |
| futex | 🟢 |
| futex_waitv | 🟡 |
| futimesat | 🟡 |
| get_kernel_syms | 🟡 |
| get_mempolicy | 🟡 |
| get_robust_list | 🟡 |
| get_thread_area | 🟡 |
| getcpu | 🟡 |
| getcwd | 🟢 |
| getdents | 🟢 |
| getdents64 | 🟢 |
| getegid | 🟢 |
| geteuid | 🟢 |
| getgid | 🟢 |
| getgroups | 🟡 |
| getitimer | 🟡 |
| getpeername | 🟢 |
| getpgid | 🟡 |
| getpgrp | 🟡 |
| getpid | 🟡 |
| getpmsg | 🟡 |
| getppid | 🟡 |
| getpriority | 🟡 |
| getrandom | 🟡 |
| getresgid | 🟢 |
| getresuid | 🟢 |
| getrlimit | 🟢 |
| getrusage | 🟡 |
| getsid | 🟡 |
| getsockname | 🟢 |
| getsockopt | 🟢 |
| gettid | 🟡 |
| gettimeofday | 🟡 |
| getuid | 🟢 |
| getxattr | 🟡 |
| idle | 🟡 |
| init_module | 🟢 |
| inotify_add_watch | 🟡 |
| inotify_init | 🟢 |
| inotify_init1 | 🟢 |
| inotify_rm_watch | 🟡 |
| io_cancel | 🟡 |
| io_destroy | 🟡 |
| io_getevents | 🟡 |
| io_pgetevents | 🟡 |
| io_setup | 🟡 |
| io_submit | 🟡 |
| io_uring_enter | 🟢 |
| io_uring_register | 🟢 |
| io_uring_setup | 🟢 |
| ioctl | 🟢 |
| ioperm | 🟡 |
| iopl | 🟡 |
| ioprio_get | 🟡 |
| ioprio_set | 🟡 |
| ipc | 🟡 |
| kcmp | 🟡 |
| kexec_file_load | 🟡 |
| kexec_load | 🟡 |
| keyctl | 🟡 |
| kill | 🟢 |
| landlock_add_rule | 🟡 |
| landlock_create_ruleset | 🟡 |
| landlock_restrict_self | 🟡 |
| lchown | 🟢 |
| lgetxattr | 🟡 |
| link | 🟢 |
| linkat | 🟢 |
| listen | 🟢 |
| listxattr | 🟡 |
| llistxattr | 🟡 |
| lookup_dcookie | 🟡 |
| lremovexattr | 🟡 |
| lseek | 🟢 |
| lsetxattr | 🟡 |
| lstat | 🟢 |
| madvise | 🟡 |
| mbind | 🟡 |
| membarrier | 🟡 |
| memfd_create | 🟢 |
| memfd_secret | 🟡 |
| migrate_pages | 🟡 |
| mincore | 🟡 |
| mkdir | 🟢 |
| mkdirat | 🟢 |
| mknod | 🟢 |
| mknodat | 🟢 |
| mlock | 🟢 |
| mlock2 | 🟢 |
| mlockall | 🟢 |
| mmap | 🟢 |
| modify_ldt | 🟡 |
| mount | 🟢 |
| mount_setattr | 🟡 |
| move_mount | 🟡 |
| move_pages | 🟡 |
| mprotect | 🟢 |
| mq_getsetattr | 🟡 |
| mq_notify | 🟡 |
| mq_open | 🟡 |
| mq_timedreceive | 🟡 |
| mq_timedsend | 🟡 |
| mq_unlink | 🟡 |
| mremap | 🟡 |
| msgctl | 🟡 |
| msgget | 🟡 |
| msgrcv | 🟡 |
| msgsnd | 🟡 |
| msync | 🟡 |
| munlock | 🟢 |
| munlockall | 🟢 |
| munmap | 🟢 |
| name_to_handle_at | 🟡 |
| nanosleep | 🟢 |
| newfstatat | 🟡 |
| nfsservctl | 🟡 |
| nice | 🟡 |
| open | 🟢 |
| open_by_handle_at | 🟢 |
| open_tree | 🟡 |
| openat | 🟢 |
| openat2 | 🟢 |
| pause | 🟡 |
| perf_event_open | 🟡 |
| personality | 🟡 |
| pidfd_getfd | 🟢 |
| pidfd_open | 🟢 |
| pidfd_send_signal | 🟡 |
| pipe | 🟢 |
| pipe2 | 🟢 |
| pivot_root | 🟡 |
| pkey_alloc | 🟡 |
| pkey_free | 🟡 |
| pkey_mprotect | 🟡 |
| poll | 🟢 |
| ppoll | 🟢 |
| prctl | 🟢 |
| pread64 | 🟢 |
| preadv | 🟢 |
| preadv2 | 🟡 |
| prlimit64 | 🟢 |
| process_madvise | 🟡 |
| process_mrelease | 🟡 |
| process_vm_readv | 🟡 |
| process_vm_writev | 🟡 |
| pselect6 | 🟡 |
| ptrace | 🟢 |
| pwrite64 | 🟢 |
| pwritev | 🟢 |
| pwritev2 | 🟡 |
| query_module | 🟡 |
| quotactl | 🟢 |
| quotactl_fd | 🟡 |
| read | 🟢 |
| readahead | 🟡 |
| readdir | 🟡 |
| readlink | 🟡 |
| readlinkat | 🟡 |
| readv | 🟢 |
| reboot | 🟡 |
| recvfrom | 🟢 |
| recvmmsg | 🟢 |
| recvmsg | 🟢 |
| remap_file_pages | 🟡 |
| removexattr | 🟡 |
| rename | 🟢 |
| renameat | 🟢 |
| renameat2 | 🟢 |
| request_key | 🟡 |
| restart_syscall | 🟡 |
| rmdir | 🟢 |
| rseq | 🟡 |
| rt_sigaction | 🟡 |
| rt_sigpending | 🟡 |
| rt_sigprocmask | 🟡 |
| rt_sigqueueinfo | 🟡 |
| rt_sigreturn | 🟡 |
| rt_sigsuspend | 🟡 |
| rt_sigtimedwait | 🟡 |
| rt_tgsigqueueinfo | 🟡 |
| s390_guarded_storage | 🟡 |
| s390_pci_mmio_read | 🟡 |
| s390_pci_mmio_write | 🟡 |
| s390_runtime_instr | 🟡 |
| s390_sthyi | 🟡 |
| sched_get_priority_max | 🟡 |
| sched_get_priority_min | 🟡 |
| sched_getaffinity | 🟡 |
| sched_getattr | 🟡 |
| sched_getparam | 🟡 |
| sched_getscheduler | 🟡 |
| sched_rr_get_interval | 🟡 |
| sched_setaffinity | 🟡 |
| sched_setattr | 🟡 |
| sched_setparam | 🟡 |
| sched_setscheduler | 🟡 |
| sched_yield | 🟡 |
| seccomp | 🟢 |
| select | 🟢 |
| semctl | 🟢 |
| semget | 🟢 |
| semop | 🟢 |
| semtimedop | 🟡 |
| sendfile | 🟢 |
| sendmmsg | 🟢 |
| sendmsg | 🟢 |
| sendto | 🟢 |
| set_mempolicy | 🟡 |
| set_mempolicy_home_node | 🟡 |
| set_robust_list | 🟡 |
| set_thread_area | 🟡 |
| set_tid_address | 🟡 |
| setdomainname | 🟡 |
| setfsgid | 🟡 |
| setfsuid | 🟡 |
| setgid | 🟢 |
| setgroups | 🟡 |
| sethostname | 🟡 |
| setitimer | 🟡 |
| setns | 🟢 |
| setpgid | 🟢 |
| setpriority | 🟡 |
| setregid | 🟡 |
| setresgid | 🟢 |
| setresuid | 🟢 |
| setreuid | 🟡 |
| setrlimit | 🟢 |
| setsid | 🟢 |
| setsockopt | 🟢 |
| settimeofday | 🟡 |
| setuid | 🟢 |
| setxattr | 🟡 |
| shmat | 🟡 |
| shmctl | 🟡 |
| shmdt | 🟡 |
| shmget | 🟡 |
| shutdown | 🟢 |
| sigaction | 🟡 |
| sigaltstack | 🟡 |
| signal | 🟡 |
| signalfd | 🟢 |
| signalfd4 | 🟢 |
| sigpending | 🟡 |
| sigprocmask | 🟡 |
| sigreturn | 🟡 |
| sigsuspend | 🟡 |
| socket | 🟢 |
| socketcall | 🟡 |
| socketpair | 🟢 |
| splice | 🟢 |
| stat | 🟢 |
| statfs | 🟡 |
| statfs64 | 🟡 |
| statx | 🟡 |
| swapoff | 🟡 |
| swapon | 🟡 |
| symlink | 🟢 |
| symlinkat | 🟢 |
| sync | 🟡 |
| sync_file_range | 🟡 |
| syncfs | 🟡 |
| sysfs | 🟡 |
| sysinfo | 🟡 |
| syslog | 🟡 |
| tee | 🟡 |
| tgkill | 🟢 |
| time | 🟡 |
| timer_create | 🟡 |
| timer_delete | 🟡 |
| timer_getoverrun | 🟡 |
| timer_gettime | 🟡 |
| timer_settime | 🟡 |
| timerfd | 🟡 |
| timerfd_create | 🟢 |
| timerfd_gettime | 🟡 |
| timerfd_settime | 🟡 |
| times | 🟡 |
| tkill | 🟢 |
| truncate | 🟡 |
| umask | 🟡 |
| umount | 🟢 |
| umount2 | 🟢 |
| uname | 🟡 |
| unlink | 🟢 |
| unlinkat | 🟢 |
| unshare | 🟢 |
| uselib | 🟡 |
| userfaultfd | 🟢 |
| ustat | 🟡 |
| utime | 🟡 |
| utimensat | 🟡 |
| utimes | 🟡 |
| vfork | 🟢 |
| vhangup | 🟡 |
| vmsplice | 🟡 |
| wait4 | 🟡 |
| waitid | 🟡 |
| write | 🟢 |
| writev | 🟢 |
| 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 @@
5.0.0
8.0.4

View File

@ -1,30 +1,46 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
#
# Copyright (C) 2022 The Falco Authors.
# 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"))
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)
set(kmod_min_kver_map_aarch64 3.16)
set(kmod_min_kver_map_s390x 2.6)
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}")
set(kmod_min_kver_map_riscv64 5.0)
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}"
)
endif()
endif()
@ -32,14 +48,18 @@ 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()
if(NOT DEFINED DRIVER_COMPONENT_NAME)
set(DRIVER_COMPONENT_NAME "scap-driver")
endif()
if(NOT DEFINED DRIVER_KMOD_COMPONENT_NAME)
set(DRIVER_KMOD_COMPONENT_NAME ${DRIVER_COMPONENT_NAME})
endif()
if(NOT DEFINED DRIVER_PACKAGE_NAME)
set(DRIVER_PACKAGE_NAME "scap")
@ -53,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)
@ -90,6 +104,33 @@ configure_file(dkms.conf.in src/dkms.conf)
configure_file(Makefile.in src/Makefile)
configure_file(driver_config.h.in src/driver_config.h)
#
# Copy all the "configure" modules
#
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/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}
)
endif()
endif()
endforeach()
set(DRIVER_SOURCES
dynamic_params_table.c
event_table.c
@ -107,9 +148,7 @@ set(DRIVER_SOURCES
ppm_fillers.h
ppm_flag_helpers.h
ppm_ringbuffer.h
ppm_syscall.h
syscall_table.c
syscall_table32.c
syscall_table64.c
ppm_cputime.c
ppm_version.h
@ -119,51 +158,63 @@ set(DRIVER_SOURCES
ppm_consumer.h
capture_macro.h
socketcall_to_syscall.h
socketcall_to_syscall.c
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
)
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_COMPONENT_NAME})
COMPONENT ${DRIVER_KMOD_COMPONENT_NAME}
)
endif()
add_subdirectory(bpf)

View File

@ -1,4 +1,4 @@
Copyright (C) 2021 The Falco Authors.
Copyright (C) 2023 The Falco Authors.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,17 +1,23 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
#
# Copyright (C) 2022 The Falco Authors.
# 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.
#
@DRIVER_NAME@-y += main.o dynamic_params_table.o fillers_table.o flags_table.o ppm_events.o ppm_fillers.o event_table.o syscall_table32.o syscall_table64.o ppm_cputime.o ppm_tp.o socketcall_to_syscall.o
@DRIVER_NAME@-y += main.o dynamic_params_table.o fillers_table.o flags_table.o ppm_events.o ppm_fillers.o event_table.o syscall_table64.o ppm_cputime.o ppm_tp.o syscall_ia32_64_map.o
obj-m += @DRIVER_NAME@.o
ccflags-y := @KBUILD_FLAGS@
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
ifeq ($(strip $(MAKEFILE_LIST)),Makefile)
#
# If MAKEFILE_LIST is just "Makefile", it means `make` was invoked pointing to
# this Makefile. Targets don't make any sense if the Makefile was included.
#
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
TOP := $(shell pwd)
TOP := $(shell pwd)
all:
$(MAKE) -C $(KERNELDIR) M=$(TOP) modules
@ -20,3 +26,21 @@ clean:
install: all
$(MAKE) -C $(KERNELDIR) M=$(TOP) modules_install
else
KERNELDIR ?= $(realpath $(objtree))
#
# Get the path of the module sources
#
FIRST_MAKEFILE := $(firstword $(MAKEFILE_LIST))
FIRST_MAKEFILE_FILENAME := $(notdir $(FIRST_MAKEFILE))
FIRST_MAKEFILE_DIRNAME := $(shell basename $(dir $(FIRST_MAKEFILE)))
ifeq ($(FIRST_MAKEFILE_DIRNAME)/$(FIRST_MAKEFILE_FILENAME), scripts/Makefile.build)
# Build phase
MODULE_MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
MAKEFILE_INC_FILES := $(shell find $(MODULE_MAKEFILE_DIR)/configure -type f -name Makefile.inc)
$(info [configure-kmod] Including $(MAKEFILE_INC_FILES))
include $(MAKEFILE_INC_FILES)
endif
endif # $(strip $(MAKEFILE_LIST)),Makefile

View File

@ -0,0 +1,48 @@
# Kernel module "configure" mechanism
## Rationale
The kernel module has several `#if` directives based on the linux kernel version,
to deal with breaking changes.
This unfortunately doesn't work when breaking changes are being backported by kernel providers.
Red Hat is known to do this, but they provide `RHEL_RELEASE_CODE` we can test against.
Eventually we hit some backported changes within the same RHEL release that gave us some headaches.
The last drop was EulerOS, which backports breaking changes without providing `RHEL_RELEASE_CODE` nor any other macro.
## Solution
We introduce a *configure-ish* mechanism mimicking autoconf `AC_TRY_COMPILE`.
The kernel module Makefile will include all the *sub-kmod* inside `configure` folder and compile them with the host kernel headers.
Based on the result of the compilation we'll define macros to be used in the `#if` directives.
### First use-case: `access_ok()`
Kernel change https://github.com/torvalds/linux/commit/96d4f267e introduced in 5.0 removed an argument from `access_ok()` function.
In the past we already covered RHEL backporting it with:
```c
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) || (PPM_RHEL_RELEASE_CODE > 0 && PPM_RHEL_RELEASE_CODE >= PPM_RHEL_RELEASE_VERSION(8, 1))
#define ppm_access_ok(type, addr, size) access_ok(addr, size)
#else
#define ppm_access_ok(type, addr, size) access_ok(type, addr, size)
#endif
```
What about EulerOS and alike?
Now we have `ACCESS_OK_2` *sub-kmod* which is a basic kernel module calling:
```c
access_ok(0, 0);
```
If it builds, we'll add `-DHAS_ACCESS_OK_2` to `ccflags-y`.
The kernel module code of course has been changed to:
```c
#ifdef HAS_ACCESS_OK_2
#define ppm_access_ok(type, addr, size) access_ok(addr, size)
#else
#define ppm_access_ok(type, addr, size) access_ok(type, addr, size)
#endif
```
## How to add a new "configure" check
1. Create a new folder under `configure/` with a meaningful name. That has to be all UPPERCASE with underscores, because it will be used as a macro name, prefixed by HAS_ (e.g. `ACCESS_OK_2` generates `HAS_ACCESS_OK_2`).
2. Name the *sub-kmod* source `test.c`. CMake and the predefined Makefile relies on the name being `test.c`.
3. Update the kernel module code to use the new macro.
4. Bob's your uncle.

View File

@ -1 +1 @@
2.10.0
3.69.0

View File

@ -1,8 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
#
# Copyright (C) 2022 The Falco Authors.
# 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)
@ -14,18 +15,24 @@ if(BUILD_BPF)
set(bpf_min_kver_map_x86_64 4.14)
set(bpf_min_kver_map_aarch64 4.17)
set(bpf_min_kver_map_s390x 5.5)
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}")
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}"
)
endif()
add_custom_target(bpf ALL
add_custom_target(
bpf ALL
COMMAND make
COMMAND "${CMAKE_COMMAND}" -E copy_if_different probe.o "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
VERBATIM)
WORKING_DIRECTORY src
VERBATIM
)
endif()
install(FILES
set(BPF_SOURCES
bpf_helpers.h
builtins.h
filler_helpers.h
@ -38,5 +45,52 @@ install(FILES
ring_helpers.h
missing_definitions.h
types.h
)
if(NOT DEFINED DRIVER_BPF_COMPONENT_NAME)
set(DRIVER_BPF_COMPONENT_NAME ${DRIVER_COMPONENT_NAME})
endif()
# Append driver headers too since they are used by bpf headers
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
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}
DESTINATION "src/${DRIVER_PACKAGE_NAME}-${DRIVER_VERSION}/bpf"
COMPONENT ${DRIVER_COMPONENT_NAME})
COMPONENT ${DRIVER_BPF_COMPONENT_NAME}
)
#
# Copy all the "configure" modules
#
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/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}
)
endif()
endforeach()

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
#
# Copyright (C) 2021 The Falco Authors.
# 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.
@ -12,14 +13,40 @@ always = $(always-y)
LLC ?= llc
CLANG ?= clang
# DEBUG = -DBPF_DEBUG
ifeq ($(strip $(MAKEFILE_LIST)),Makefile)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
# DEBUG = -DBPF_DEBUG
all:
$(MAKE) -C $(KERNELDIR) M=$$PWD
clean:
$(MAKE) -C $(KERNELDIR) M=$$PWD clean
@rm -f *~
else
KERNELDIR ?= $(realpath $(objtree))
#
# Get the path of the module sources
#
FIRST_MAKEFILE := $(firstword $(MAKEFILE_LIST))
FIRST_MAKEFILE_FILENAME := $(notdir $(FIRST_MAKEFILE))
FIRST_MAKEFILE_DIRNAME := $(shell basename $(dir $(FIRST_MAKEFILE)))
ifeq ($(FIRST_MAKEFILE_DIRNAME)/$(FIRST_MAKEFILE_FILENAME), scripts/Makefile.build)
# Build phase
MODULE_MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
MAKEFILE_INC_FILES := $(shell find $(MODULE_MAKEFILE_DIR)/configure -type f -name Makefile.inc)
$(info [configure-bpf] Including $(MAKEFILE_INC_FILES))
include $(MAKEFILE_INC_FILES)
endif
#
# https://chromium.googlesource.com/chromiumos/third_party/kernel/+/096925a44076ba5c52faa84d255a847130ff341e%5E%21/#F2
# This commit diverged the ChromiumOS kernel from stock in the area of audit information, which this probe accesses.
#
#
# This enables the workaround for this divergence.
#
NEEDS_COS_73_WORKAROUND = $(shell expr `grep -sc "^\s*struct\s\+audit_task_info\s\+\*audit;\s*$$" $(KERNELDIR)/include/linux/sched.h` = 1)
@ -34,13 +61,6 @@ ifeq ($(IS_CLANG_OLDER_THAN_10), 1)
KBUILD_CPPFLAGS := $(filter-out -fmacro-prefix-map=%,$(KBUILD_CPPFLAGS))
endif
all:
$(MAKE) -C $(KERNELDIR) M=$$PWD
clean:
$(MAKE) -C $(KERNELDIR) M=$$PWD clean
@rm -f *~
$(obj)/probe.o: $(src)/probe.c \
$(src)/bpf_helpers.h \
$(src)/filler_helpers.h \
@ -65,3 +85,5 @@ $(obj)/probe.o: $(src)/probe.c \
-Wno-unknown-attributes \
-O2 -g -emit-llvm -c $< -o $(patsubst %.o,%.ll,$@)
$(LLC) -march=bpf -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)
endif # $(strip $(MAKEFILE_LIST)),Makefile

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (C) 2021 The Falco Authors.
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.
@ -9,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, u64 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, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_user;
static int (*bpf_probe_read_kernel)(void *dst, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_kernel;
static int (*bpf_probe_read_user_str)(void *dst, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_user_str;
static int (*bpf_probe_read_kernel_str)(void *dst, u32 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, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_kernel)(void *dst, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read;
static int (*bpf_probe_read_user_str)(void *dst, u32 size, const void *unsafe_ptr) =
(void *)BPF_FUNC_probe_read_str;
static int (*bpf_probe_read_kernel_str)(void *dst, u32 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 u64 (*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

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (c) 2021 The Falco Authors
@ -27,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

@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-2.0-only OR MIT
#
# 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.
#
always-y += test.o
# kept for compatibility with kernels < 5.11
always = $(always-y)
LLC ?= llc
CLANG ?= clang
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
# -fmacro-prefix-map is not supported on version of clang older than 10
# so remove it if necessary.
IS_CLANG_OLDER_THAN_10 := $(shell expr `$(CLANG) -dumpversion | cut -f1 -d.` \<= 10)
ifeq ($(IS_CLANG_OLDER_THAN_10), 1)
KBUILD_CPPFLAGS := $(filter-out -fmacro-prefix-map=%,$(KBUILD_CPPFLAGS))
endif
all:
$(MAKE) -C $(KERNELDIR) M=$$PWD
clean:
$(MAKE) -C $(KERNELDIR) M=$$PWD clean
@rm -f *~
$(obj)/test.o: $(src)/test.c
$(CLANG) $(LINUXINCLUDE) \
$(KBUILD_CPPFLAGS) \
$(KBUILD_EXTRA_CPPFLAGS) \
-D__KERNEL__ \
-D__BPF_TRACING__ \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member \
-fno-jump-tables \
-fno-stack-protector \
-Wno-tautological-compare \
-Wno-unknown-attributes \
-O2 -g -emit-llvm -c $< -o $(patsubst %.o,%.ll,$@)
$(LLC) -march=bpf -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

View File

@ -0,0 +1,23 @@
MODULE_MAKEFILE_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
# Run the module build.sh (wrapper for make) script with an empty environment, but PATH
HAS_@CONFIGURE_MODULE@ := $(shell env -i CLANG="$(CLANG)" LLC="$(LLC)" PATH="$(PATH)" KERNELDIR="$(KERNELDIR)" sh $(MODULE_MAKEFILE_DIR)/build.sh ; echo $$?)
ifeq ($(HAS_@CONFIGURE_MODULE@),0)
$(info [configure-bpf] Setting HAS_@CONFIGURE_MODULE@ flag)
KBUILD_CPPFLAGS += -DHAS_@CONFIGURE_MODULE@
else
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

@ -0,0 +1,31 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
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 mm_struct's field `rss_stat` is an array.
* See 6.2 kernel commit:
* https://github.com/torvalds/linux/commit/f1a7941243c102a44e8847e3b94ff4ff3ec56f25
*/
#include "../../quirks.h"
#include "../../ppm_events_public.h"
#include "../../types.h"
// struct mm_struct declaration
#include <linux/mm_types.h>
BPF_PROBE("signal/", signal_deliver, signal_deliver_args) {
long val;
struct mm_struct *mm;
val = mm->rss_stat[0].count;
return 0;
}
char __license[] __bpf_section("license") = "Dual MIT/GPL";

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";

13
driver/bpf/configure/build.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
#
# 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.
#
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname ${SCRIPT})
make -C ${SCRIPT_DIR} > ${SCRIPT_DIR}/build.log 2>&1

File diff suppressed because it is too large Load Diff

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