Compare commits

...

479 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
708 changed files with 46235 additions and 37126 deletions

View File

@ -3,6 +3,8 @@ 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

View File

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

View File

@ -24,7 +24,7 @@ runs:
- 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 libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-tools-common linux-tools-generic linux-tools-`uname -r` heaptrack coreutils util-linux
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

View File

@ -8,41 +8,29 @@ runs:
shell: bash
id: store
env:
ZIG_VERSION: '0.14.0-dev.2591+5333d2443'
ZIG_VERSION: '0.14.1'
run: |
echo "zig_version=${ZIG_VERSION}" >> "$GITHUB_OUTPUT"
# TODO: this is only needed because we are using a development version of zig,
# since we need https://github.com/ziglang/zig/pull/21253 to be included.
# Development versions of zig are not kept alive forever, but get overridden.
# We cache it to keep it alive.
- name: Download zig (cached)
id: cache-zig
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: zig
key: zig-${{ runner.os }}-${{ runner.arch }}-${{ steps.store.outputs.zig_version }}
- name: Download zig
if: steps.cache-zig.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L -o zig.tar.xz https://ziglang.org/builds/zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}.tar.xz
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-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-cc <<EOF
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-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-cc
chmod +x zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-cc
cat > zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-c++ <<EOF
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-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-c++
chmod +x zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/zig-c++
mv zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/ zig
mv zig-$(uname -m)-linux-${{ steps.store.outputs.zig_version }}/ zig
- name: Setup zig
shell: bash
@ -52,4 +40,4 @@ runs:
echo "CC=zig-cc" >> $GITHUB_ENV
echo "CXX=zig-c++" >> $GITHUB_ENV
echo "AR=zig ar" >> $GITHUB_ENV
echo "RANLIB=zig ranlib" >> $GITHUB_ENV
echo "RANLIB=zig ranlib" >> $GITHUB_ENV

View File

@ -16,19 +16,17 @@ concurrency:
jobs:
build-libs-linux:
name: build-libs-linux-${{ matrix.arch }} 😁 (${{ matrix.name }})
runs-on: ${{ (matrix.arch == 'arm64' && 'github-arm64-2c-8gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
name: [system_deps, bundled_deps, system_deps_minimal, sanitizers, zig]
name: [system_deps, bundled_deps, sanitizers, zig]
include:
- name: system_deps
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DBUILD_BPF=On -DUSE_BUNDLED_DEPS=True
- name: system_deps_minimal
cmake_opts: -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=False -DMINIMAL_BUILD=True
- name: sanitizers
cmake_opts: -DUSE_ASAN=On -DUSE_UBSAN=On -DUSE_BUNDLED_DEPS=False
- name: zig
@ -38,7 +36,9 @@ jobs:
steps:
- name: Install deps ⛓️
run: |
apt update && apt install -y --no-install-recommends curl ca-certificates build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-headers-${{ matrix.arch }}
# Use 20250630T203427Z debian apt snapshot as it still contains support for buster.
printf "deb http://snapshot.debian.org/archive/debian/20250630T203427Z buster main\ndeb http://snapshot.debian.org/archive/debian-security/20250630T203427Z buster/updates main\ndeb http://snapshot.debian.org/archive/debian/20250630T203427Z buster-updates main" > /etc/apt/sources.list
apt update && apt install -y --no-install-recommends curl ca-certificates build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-${{ matrix.arch }}
- name: Install a recent version of CMake ⛓️
run: |
@ -74,6 +74,13 @@ jobs:
KERNELDIR=/lib/modules/$(ls /lib/modules)/build make -j4
make run-unit-tests
- name: Test sinsp-example and .scap files
run: |
cd build && make sinsp-example
libsinsp/examples/sinsp-example -s ../test/libsinsp_e2e/resources/captures/curl_google.scap | grep --extended-regexp --invert-match '^(Time spent|Events/ms): ' > /tmp/curl_google.txt
libsinsp/examples/sinsp-example -s ../test/libsinsp_e2e/resources/captures/curl_google_comments.scap | grep --extended-regexp --invert-match '^(Time spent|Events/ms): ' > /tmp/curl_google_comments.txt
diff -u /tmp/curl_google.txt /tmp/curl_google_comments.txt
# On zig, build also sinsp-example and check the glibc linked versions
# to make sure we are actually using the correct glibc version.
- name: Test zig build glibc version
@ -128,13 +135,13 @@ jobs:
- name: Install deps ⛓️
run: |
sudo apt update
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libre2-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-headers-$(uname -r)
sudo apt install -y --no-install-recommends ca-certificates cmake build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libre2-dev libtbb-dev libjq-dev libjsoncpp-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-$(uname -r)
sudo .github/install-deps.sh
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DBUILD_SHARED_LIBS=True -DUSE_BUNDLED_DEPS=False -DMINIMAL_BUILD=True -DCMAKE_INSTALL_PREFIX=/tmp/libs-test -DENABLE_THREAD_POOL=ON ../
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
@ -147,7 +154,7 @@ jobs:
run: |
cd userspace/libsinsp/examples
export PKG_CONFIG_PATH=/tmp/libs-test/lib/pkgconfig
g++ -o sinsp-example test.cpp util.cpp $(pkg-config --cflags --libs libsinsp)
g++ -o sinsp-example *.cpp $(pkg-config --cflags --libs libsinsp)
- name: Test sinsp-example runtime linker
run: |
@ -174,7 +181,7 @@ jobs:
- name: Build and test 🏗️🧪
run: |
mkdir -p build
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.crt }} -DCREATE_TEST_TARGETS=ON -DMINIMAL_BUILD=ON -DENABLE_THREAD_POOL=ON ..
cd build && cmake -DUSE_BUNDLED_DEPS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.crt }} -DCREATE_TEST_TARGETS=ON -DENABLE_THREAD_POOL=ON ..
cmake --build . --config Release --parallel 4 && make run-unit-tests || libsinsp\test\Release\unit-test-libsinsp.exe
build-shared-libs-macos-amd64:
@ -193,7 +200,7 @@ jobs:
- 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 -DMINIMAL_BUILD=ON -DCMAKE_INSTALL_PREFIX=/tmp/libs-test ..
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
@ -251,92 +258,11 @@ jobs:
diff -u expected_ldd_out.txt ldd_out.txt
run-e2e-tests-amd64:
name: run-e2e-tests-amd64
strategy:
fail-fast: false
matrix:
name: [system_deps, bundled_deps, asan]
include:
- name: system_deps
cmake_opts: -DUSE_BUNDLED_DEPS=False
- name: bundled_deps
cmake_opts: -DUSE_BUNDLED_DEPS=True
- name: asan
cmake_opts: -DUSE_BUNDLED_DEPS=True -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address
runs-on: ubuntu-22.04
steps:
- name: Install deps ⛓️
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
clang-14 llvm-14 \
git \
clang \
llvm \
pkg-config \
autoconf \
automake \
libtool \
libelf-dev \
wget \
libc-ares-dev \
libbpf-dev \
libcap-dev \
libcurl4-openssl-dev \
libssl-dev \
libtbb-dev \
libjq-dev \
libjsoncpp-dev \
libgrpc++-dev \
protobuf-compiler-grpc \
libgtest-dev \
libprotobuf-dev \
"linux-headers-$(uname -r)"
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90
sudo update-alternatives --install /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 90
sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-14 90
uses: ./.github/workflows/reusable_e2e_tests.yaml
with:
libsversion: ${{ github.sha }}
secrets: inherit
- name: Checkout Libs ⤵️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Install deps ⛓️
run: |
sudo .github/install-deps.sh
- name: Build and test 🏗️🧪
env:
# This avoids random failures on CI.
# (https://github.com/google/sanitizers/issues/1322#issuecomment-699946942)
ASAN_OPTIONS: intercept_tls_get_addr=0
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 -E make e2e-install-deps
sudo -E ../test/e2e/scripts/run_tests.sh
- name: Archive test reports
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: ${{ matrix.name }}_report
path: |
/tmp/report/
build-libs-emscripten:
name: build-libs-emscripten 🧐

View File

@ -55,7 +55,7 @@ jobs:
kernelrelease: 6.4.1-1.el9.elrepo.aarch64
target: centos
kernelurls: https://download.falco.org/fixtures/libs/kernel-ml-devel-6.4.1-1.el9.elrepo.aarch64.rpm
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
container:
image: falcosecurity/driverkit:latest
steps:

View File

@ -39,7 +39,7 @@ jobs:
# This job run all engine tests and scap-open
test-scap:
name: test-scap-${{ matrix.arch }} 😆 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'github-arm64-2c-8gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
needs: paths-filter
strategy:
matrix:
@ -73,7 +73,7 @@ jobs:
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 ../
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 🏎️
@ -102,9 +102,16 @@ jobs:
cd build
sudo ./test/libscap/libscap_test
- name: Validate scap-open with modern bpf
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
uses: Andreagit97/bpfvalidator@v0.3.0
with:
args: |
--config=$GITHUB_WORKSPACE/driver/modern_bpf/bpfvalidator_config.yaml --cmd="$GITHUB_WORKSPACE/build/libscap/examples/01-open/scap-open --modern_bpf --num_events 10"
test-drivers:
name: test-drivers-${{ matrix.arch }} 😇 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'github-arm64-2c-8gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
needs: paths-filter
strategy:
matrix:
@ -170,7 +177,7 @@ jobs:
- 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@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
uses: appleboy/ssh-action@2ead5e36573f08b82fbfce1504f1a4b05a647c6f # v1.2.2
with:
host: ${{ secrets.PPC64LE_HOST }}
username: ${{ secrets.PPC64LE_USERNAME }}
@ -180,10 +187,12 @@ jobs:
command_timeout: 60m
script: |
sudo dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf automake libbpf-devel
# Remove, if present, any libs clone created by a previous job run.
rm -rf libs
git clone -b $GIT_BRANCH $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git libs
cd libs
mkdir -p build
cd build && cmake -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 ../
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=$?
@ -204,7 +213,7 @@ jobs:
with:
fetch-depth: 0
- uses: uraimo/run-on-arch-action@5397f9e30a9b62422f302092631c99ae1effcd9e # v2.8.1
- uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1
name: Run s390x build 🏗️
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
with:
@ -213,15 +222,16 @@ jobs:
githubToken: ${{ github.token }}
install: |
apt update && apt install -y --no-install-recommends ca-certificates cmake build-essential clang llvm git pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libcap-dev libgtest-dev libprotobuf-dev linux-headers-generic
apt update && apt install -y --no-install-recommends ca-certificates cmake build-essential clang llvm git pkg-config autoconf automake libtool libelf-dev wget libtbb-dev libjq-dev libjsoncpp-dev libcap-dev protobuf-compiler libgtest-dev libprotobuf-dev linux-headers-generic
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
cd bpftool
git submodule update --init
cd src && make install
cd ../../
git clone https://github.com/libbpf/libbpf.git --branch v1.3.0 --single-branch
cd libbpf/src && BUILD_STATIC_ONLY=y DESTDIR=/ make install
cd libbpf/src && BUILD_STATIC_ONLY=y DESTDIR=/ make install install_uapi_headers
ln -s /usr/lib64/libbpf.a /usr/lib/s390x-linux-gnu/
ln -s /usr/include/bpf /usr/include/s390x-linux-gnu/
# Please note: we cannot inject the BPF probe inside QEMU, so right now, we only build it
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
@ -235,7 +245,7 @@ jobs:
# 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:latest
container: fedora:41
steps:
# Always install deps before invoking checkout action, to properly perform a full clone.
- name: Install build dependencies
@ -252,7 +262,7 @@ jobs:
make ProbeSkeleton -j6
- name: Upload skeleton
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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
@ -277,7 +287,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download skeleton
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bpf_probe_x86_64.skel.h
path: /tmp
@ -319,13 +329,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download X64 matrix
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
path: matrix_X64
- name: Download ARM64 matrix
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
path: matrix_ARM64
@ -345,7 +355,7 @@ jobs:
echo ""
- name: Upload PR info as artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pr-kernel-testing
path: pr/

View File

@ -15,7 +15,7 @@ concurrency:
jobs:
build-test-e2e:
name: build-test-e2e-${{ matrix.arch }} 😇 (bundled_deps)
runs-on: ${{ (matrix.arch == 'arm64' && 'github-arm64-2c-8gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
matrix:
arch: [amd64, arm64]
@ -35,7 +35,6 @@ jobs:
clang \
llvm \
git \
clang \
ccache \
llvm \
pkg-config \
@ -44,18 +43,14 @@ jobs:
libtool \
libelf-dev \
wget \
libc-ares-dev \
libbpf-dev \
libcap-dev \
libcurl4-openssl-dev \
libssl-dev \
libtbb-dev \
libjq-dev \
libjsoncpp-dev \
libgrpc++-dev \
protobuf-compiler-grpc \
libgtest-dev \
libprotobuf-dev \
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
@ -69,7 +64,7 @@ jobs:
sudo apt install -y --no-install-recommends gcc-multilib g++-multilib
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@054db53350805f83040bf3e6e9b8cf5a139aa7c9 # v0.0.7
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
- name: Build e2e tests 🏗️
env:
@ -95,7 +90,7 @@ jobs:
cd ..
- name: Cache build
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: always()
id: cache
with:
@ -105,7 +100,7 @@ jobs:
test-e2e:
name: test-e2e-${{ matrix.arch }}-${{ matrix.driver.name }} 😇 (bundled_deps)
needs: [build-test-e2e]
runs-on: ${{ (matrix.arch == 'arm64' && 'github-arm64-2c-8gb') || 'ubuntu-22.04' }}
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-22.04-arm') || 'ubuntu-22.04' }}
strategy:
matrix:
arch: [amd64, arm64]
@ -119,7 +114,7 @@ jobs:
- name: Restore build
id: cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: build-e2e-${{ matrix.arch }}-${{ github.run_id }}
@ -171,4 +166,4 @@ jobs:
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
sudo -E ./libsinsp_e2e_tests ${{ matrix.driver.option }} --gtest_filter=-sys_call_test.quotactl_ok

View File

@ -32,7 +32,7 @@ jobs:
- name: Upload the git diff artifact 📦
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: format_diff.patch
path: ./format_diff.patch

View File

@ -44,7 +44,7 @@ jobs:
echo "latest_vers=$(grep kernelrelease dk.yaml | awk -F": " '{print $2}')" >> $GITHUB_OUTPUT
- name: Upload driverkit config
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: driverkit_config.yaml
path: linux/dk.yaml
@ -56,16 +56,19 @@ jobs:
runs-on: 'ubuntu-latest'
steps:
- name: Download driverkit config
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: driverkit_config.yaml
- name: Download latest driverkit artifact
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
with:
name: driverkit-amd64
workflow: release.yml
repo: falcosecurity/driverkit
fileName: driverkit_*_linux_amd64.tar.gz
latest: true
repository: falcosecurity/driverkit
tarBall: false
zipBall: false
extract: true
- name: Test drivers build
id: build
@ -78,19 +81,22 @@ jobs:
needs: 'compute-latest-version'
outputs:
build: ${{ steps.build.outcome }}
runs-on: 'github-arm64-2c-8gb'
runs-on: 'ubuntu-22.04-arm'
steps:
- name: Download driverkit config
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: driverkit_config.yaml
- name: Download latest driverkit artifact
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
with:
name: driverkit-arm64
workflow: release.yml
repo: falcosecurity/driverkit
fileName: driverkit_*_linux_arm64.tar.gz
latest: true
repository: falcosecurity/driverkit
tarBall: false
zipBall: false
extract: true
- name: Test drivers build
id: build

View File

@ -28,7 +28,7 @@ jobs:
uses: ./.github/actions/composite-perf
- name: Archive master perf report
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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
@ -72,7 +72,7 @@ jobs:
rm -rf stacks.txt
- name: Upload svg files
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: perf_svg
path: '*.svg'
@ -88,7 +88,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download matrix X64
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
@ -96,7 +96,7 @@ jobs:
run: mv matrix.md docs/matrix_X64.md
- name: Download matrix ARM64
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
@ -109,7 +109,7 @@ jobs:
sed -i '1s/^/---\nhide:\n- toc\n---\n\n/' docs/matrix_ARM64.md
- name: Download perf svg files
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: perf_svg
@ -128,7 +128,7 @@ jobs:
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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.x

View File

@ -27,7 +27,7 @@ jobs:
uses: ./.github/actions/composite-perf
- name: Download latest master report
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
with:
branch: master
event: push
@ -56,7 +56,7 @@ jobs:
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: perf_diff
path: '*_diff.txt'
@ -96,7 +96,7 @@ jobs:
echo ""
- name: Upload PR info as artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: pr-perf
path: pr/

View File

@ -98,7 +98,7 @@ jobs:
echo "#### Release Manager @${{ github.event.release.author.login }}" >> release-body.md
- name: Release
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
tag_name: ${{ github.event.release.tag_name }}
@ -135,8 +135,29 @@ jobs:
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_X64
@ -144,7 +165,7 @@ jobs:
run: mv matrix.md matrix_X64.md
- name: Download matrix ARM64
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: matrix_ARM64
@ -182,7 +203,7 @@ jobs:
echo "#### Release Manager @${{ github.event.release.author.login }}" >> release-body.md
- name: Release
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
body_path: ./release-body.md
tag_name: ${{ github.event.release.tag_name }}

View File

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

View File

@ -47,12 +47,12 @@ jobs:
libsrepo: ${{ inputs.libsrepo }}
build_matrix: 'true'
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ansible_output_${{matrix.architecture}}
path: ${{ steps.kernel_tests.outputs.ansible_output }}
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: matrix_${{matrix.architecture}}
path: ${{ steps.kernel_tests.outputs.matrix_output }}

View File

@ -22,7 +22,7 @@ jobs:
- 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 libc-ares-dev libcurl4-openssl-dev libssl-dev libre2-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev linux-headers-$(uname -r) gpg gpg-agent gcovr
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 🏗️🧪
@ -37,7 +37,7 @@ jobs:
gcovr --xml -o ./libsinsp.coverage.xml
- name: Upload to codecov
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
with:
fail_ci_if_error: true
files: ./libsinsp.coverage.xml

View File

@ -24,7 +24,7 @@ jobs:
repo-root: ${{ github.workspace }}/libs
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
path: libs
signoff: true

1
.gitignore vendored
View File

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

View File

@ -53,18 +53,15 @@ endif()
project(falcosecurity-libs)
option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)
option(MINIMAL_BUILD
"Produce a minimal build with only the essential features (no container metadata)" OFF
)
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
option(USE_BUNDLED_DRIVER
"Use the driver/ subdirectory in the build process (only available in Linux)" ON
)
option(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)
@ -129,7 +126,9 @@ if(CREATE_TEST_TARGETS)
# ctest's add_test because it will build the code and output to stdout.
add_custom_target(run-unit-tests COMMAND ${CMAKE_MAKE_PROGRAM} run-unit-test-libsinsp)
add_subdirectory(test/e2e)
if(ENABLE_E2E_TESTS)
add_subdirectory(test/e2e)
endif()
if(ENABLE_DRIVERS_TESTS)
add_subdirectory(test/drivers)
@ -145,10 +144,6 @@ if(CREATE_TEST_TARGETS)
add_subdirectory(test/libsinsp_e2e/resources)
endif()
if(ENABLE_VM_TESTS)
add_subdirectory(test/vm)
endif()
endif()
option(ENABLE_BENCHMARKS "Enable Benchmarks" OFF)

View File

@ -33,13 +33,13 @@
{
"name": "sinsp-minimal",
"inherits": "base",
"displayName": "Build sinsp in minimal build",
"description": "Build sinsp in minimal build with its tests",
"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",
"MINIMAL_BUILD": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
}

3
OWNERS
View File

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

View File

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

View File

@ -53,19 +53,3 @@ static void BM_sinsp_concatenate_paths_absolute_path(benchmark::State& state) {
}
}
BENCHMARK(BM_sinsp_concatenate_paths_absolute_path);
static void BM_sinsp_split_container_image(benchmark::State& state) {
for(auto _ : state) {
std::string container_image =
"localhost:12345/library/"
"busybox:1.27.2@sha256:da39a3ee5e6b4b0d3255bfef95601890afd80709";
std::string hostname, port, name, tag, digest;
sinsp_utils::split_container_image(container_image, hostname, port, name, tag, digest);
benchmark::DoNotOptimize(hostname);
benchmark::DoNotOptimize(port);
benchmark::DoNotOptimize(name);
benchmark::DoNotOptimize(tag);
benchmark::DoNotOptimize(digest);
}
}
BENCHMARK(BM_sinsp_split_container_image);

View File

@ -3,6 +3,7 @@
# 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()
@ -14,14 +15,26 @@ function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
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})
# ignore dependencies in the list ${ignored}
if(${dep} IN_LIST "${ignored}")
# 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()
@ -34,7 +47,7 @@ function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
TARGET ${dep}
PROPERTY TYPE
)
if(${dep_target_type} STREQUAL "STATIC_LIBRARY")
if(NOT ${dep_target_type} STREQUAL "SHARED_LIBRARY")
continue()
endif()
else()
@ -52,6 +65,27 @@ function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
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()

View File

@ -33,11 +33,6 @@ if(NOT MSVC)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "-Wall -ggdb")
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "-Og -D_DEBUG")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "-O3 -fno-strict-aliasing -DNDEBUG")
if(MINIMAL_BUILD)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -DMINIMAL_BUILD")
endif()
if(MUSL_OPTIMIZED_BUILD)
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -static -Os")
endif()
@ -121,10 +116,8 @@ if(NOT MSVC)
add_definitions(-D__STDC_FORMAT_MACROS)
else() # MSVC
set(MINIMAL_BUILD ON)
set(FALCOSECURITY_LIBS_COMMON_FLAGS
"-D_CRT_SECURE_NO_WARNINGS -DWIN32 -DMINIMAL_BUILD /EHsc /W3 /Zi /std:c++17"
"-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")

View File

@ -1,76 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_CARES "Enable building of the bundled c-ares" ${USE_BUNDLED_DEPS})
if(CARES_INCLUDE)
# we already have c-ares
elseif(NOT USE_BUNDLED_CARES)
find_path(CARES_INCLUDE NAMES cares/ares.h ares.h)
find_library(CARES_LIB NAMES cares)
if(CARES_INCLUDE AND CARES_LIB)
message(STATUS "Found c-ares: include: ${CARES_INCLUDE}, lib: ${CARES_LIB}")
else()
message(FATAL_ERROR "Couldn't find system c-ares")
endif()
else()
if(BUILD_SHARED_LIBS)
set(CARES_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(CARES_STATIC_OPTION "Off")
else()
set(CARES_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(CARES_STATIC_OPTION "On")
endif()
set(CARES_SRC "${PROJECT_BINARY_DIR}/c-ares-prefix/src/c-ares")
set(CARES_INCLUDE "${CARES_SRC}/include/")
set(CARES_LIB "${CARES_SRC}/lib/libcares${CARES_LIB_SUFFIX}")
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://github.com/c-ares/c-ares/releases/download/v1.33.1/c-ares-1.33.1.tar.gz"
URL_HASH "SHA256=06869824094745872fa26efd4c48e622b9bd82a89ef0ce693dc682a23604f415"
BUILD_IN_SOURCE 1
CMAKE_ARGS -DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCARES_SHARED=${BUILD_SHARED_LIBS}
-DCARES_STATIC=${CARES_STATIC_OPTION}
-DCARES_STATIC_PIC=${ENABLE_PIC}
-DCARES_BUILD_TOOLS=Off
-DCARES_INSTALL=Off
BUILD_BYPRODUCTS ${CARES_INCLUDE} ${CARES_LIB}
INSTALL_COMMAND ""
)
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

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

View File

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

View File

@ -1,274 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 The Falco Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
option(USE_BUNDLED_GRPC "Enable building of the bundled grpc" ${USE_BUNDLED_DEPS})
if(GRPC_INCLUDE)
# we already have grpc
elseif(NOT USE_BUNDLED_GRPC)
# gRPC
find_package(gRPC CONFIG)
if(gRPC_FOUND)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(GPR_LIB gRPC::gpr)
set(GRPC_LIB gRPC::grpc)
set(GRPCPP_LIB gRPC::grpc++)
# gRPC C++ plugin
get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()
# gRPC include dir + properly handle grpc{++,pp}
get_target_property(GRPC_INCLUDE gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES)
find_path(
GRPCXX_INCLUDE
NAMES grpc++/grpc++.h
PATHS ${GRPC_INCLUDE}
)
if(NOT GRPCXX_INCLUDE)
find_path(
GRPCPP_INCLUDE
NAMES grpcpp/grpcpp.h
PATHS ${GRPC_INCLUDE}
)
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
else()
# Fallback to manually find libraries; Some distro, namely Ubuntu focal, do not install gRPC
# config cmake module
find_library(GPR_LIB NAMES gpr)
if(GPR_LIB)
message(STATUS "Found gpr lib: ${GPR_LIB}")
else()
message(FATAL_ERROR "Couldn't find system gpr")
endif()
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h)
if(GRPCXX_INCLUDE)
set(GRPC_INCLUDE ${GRPCXX_INCLUDE})
else()
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h)
set(GRPC_INCLUDE ${GRPCPP_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
find_library(GRPC_LIB NAMES grpc)
find_library(GRPCPP_LIB NAMES grpc++)
if(GRPC_INCLUDE
AND GRPC_LIB
AND GRPCPP_LIB
)
message(
STATUS
"Found grpc: include: ${GRPC_INCLUDE}, C lib: ${GRPC_LIB}, C++ lib: ${GRPCPP_LIB}"
)
else()
message(FATAL_ERROR "Couldn't find system grpc")
endif()
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()
endif()
else()
include(cares)
include(protobuf)
include(zlib)
include(openssl)
if(BUILD_SHARED_LIBS)
set(GRPC_OPENSSL_STATIC_LIBS_OPTION FALSE)
else()
set(GRPC_OPENSSL_STATIC_LIBS_OPTION TRUE)
endif()
include(re2)
set(GRPC_SRC "${PROJECT_BINARY_DIR}/grpc-prefix/src/grpc")
set(GRPC_INSTALL_DIR "${GRPC_SRC}/target")
set(GRPC_INCLUDE "${GRPC_INSTALL_DIR}/include" "${GRPC_SRC}/third_party/abseil-cpp")
set(GPR_LIB "${GRPC_SRC}/libgpr.a")
set(GRPC_LIB "${GRPC_SRC}/libgrpc.a")
set(GRPCPP_LIB "${GRPC_SRC}/libgrpc++.a")
set(GRPC_CPP_PLUGIN "${GRPC_SRC}/grpc_cpp_plugin")
set(GRPC_MAIN_LIBS "")
list(
APPEND
GRPC_MAIN_LIBS
"${GPR_LIB}"
"${GRPC_LIB}"
"${GRPCPP_LIB}"
"${GRPC_SRC}/libgrpc++_alts.a"
"${GRPC_SRC}/libgrpc++_error_details.a"
"${GRPC_SRC}/libgrpc++_reflection.a"
"${GRPC_SRC}/libgrpc++_unsecure.a"
"${GRPC_SRC}/libgrpc_plugin_support.a"
"${GRPC_SRC}/libgrpc_unsecure.a"
"${GRPC_SRC}/libgrpcpp_channelz.a"
)
get_filename_component(PROTOC_DIR ${PROTOC} PATH)
if(NOT TARGET grpc)
message(STATUS "Using bundled grpc in '${GRPC_SRC}'")
# fixme(leogr): this workaround is required to inject the missing deps (built by gRCP
# cmakefiles) into target_link_libraries later note: the list below is manually generated
# starting from the output of pkg-config --libs grpc++
set(GRPC_LIBRARIES "")
list(
APPEND
GRPC_LIBRARIES
"${GRPC_SRC}/libaddress_sorting.a"
"${GRPC_SRC}/libupb.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_hash.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_city.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/hash/libabsl_low_level_hash.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/container/libabsl_raw_hash_set.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/container/libabsl_hashtablez_sampler.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/status/libabsl_statusor.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/status/libabsl_status.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cord.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_functions.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/profiling/libabsl_exponential_biased.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/types/libabsl_bad_variant_access.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_str_format_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/synchronization/libabsl_synchronization.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/synchronization/libabsl_graphcycles_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_stacktrace.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_symbolize.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_debugging_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/debugging/libabsl_demangle_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_malloc_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_time.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_civil_time.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_strings.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_strings_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_base.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_spinlock_wait.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/numeric/libabsl_int128.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/base/libabsl_log_severity.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/time/libabsl_time_zone.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cord_internal.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_info.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/strings/libabsl_cordz_handle.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_pool_urbg.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_hwaes.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_hwaes_impl.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_randen_slow.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_seed_material.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_internal_platform.a"
"${GRPC_SRC}/third_party/abseil-cpp/absl/random/libabsl_random_seed_gen_exception.a"
)
# Make abseil-cpp build compatible with gcc-13 See
# https://patchwork.yoctoproject.org/project/oe/patch/20230518093301.2938164-1-Martin.Jansa@gmail.com/
# TO BE DROPPED once we finally upgrade grpc...
set(GRPC_PATCH_CMD
sh
-c
"sed -i '20s/^/#include <cstdint>/' ${GRPC_SRC}/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h"
)
# Zig workaround: Add a PATCH_COMMAND to grpc cmake to fixup emitted -march by abseil-cpp
# cmake module, making it use a name understood by zig for arm64. See
# https://github.com/abseil/abseil-cpp/blob/master/absl/copts/GENERATED_AbseilCopts.cmake#L226.
if(CMAKE_C_COMPILER MATCHES "zig")
message(STATUS "Enabling zig workaround for abseil-cpp")
set(GRPC_PATCH_CMD
${GRPC_PATCH_CMD}
&&
sh
-c
"sed -i 's/armv8-a/cortex_a57/g' ${GRPC_SRC}/third_party/abseil-cpp/absl/copts/GENERATED_AbseilCopts.cmake"
)
endif()
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=${CMAKE_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${ENABLE_PIC}
-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 ""
PATCH_COMMAND ${GRPC_PATCH_CMD}
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

@ -23,7 +23,7 @@ elseif(NOT USE_BUNDLED_LIBBPF)
find_path(LIBBPF_INCLUDE bpf/libbpf.h)
find_library(LIBBPF_LIB NAMES bpf)
if(LIBBPF_INCLUDE AND LIBBPF_LIB)
add_library(lbpf STATIC IMPORTED)
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})
@ -64,7 +64,7 @@ else()
BUILD_BYPRODUCTS ${LIBBPF_LIB}
)
add_library(lbpf STATIC IMPORTED)
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}>)

View File

@ -54,9 +54,9 @@ elseif(NOT USE_BUNDLED_LIBELF)
endif()
if(BUILD_SHARED_LIBS OR USE_SHARED_LIBELF)
add_library(elf SHARED IMPORTED)
add_library(elf SHARED IMPORTED GLOBAL)
else()
add_library(elf STATIC IMPORTED)
add_library(elf STATIC IMPORTED GLOBAL)
endif()
set_target_properties(elf PROPERTIES IMPORTED_LOCATION ${LIBELF_LIB})

View File

@ -91,16 +91,6 @@ if(NOT HAVE_LIBSCAP)
endif()
endforeach()
set(libscap_link_flags)
set(libscap_link_libdirs "")
add_pkgconfig_dependency(libscap_link_libdirs libscap_link_flags scap "")
string(REPLACE ";" " " LIBSCAP_LINK_LIBRARIES_FLAGS "${libscap_link_flags}")
string(REPLACE ";" " " LIBSCAP_LINK_LIBDIRS_FLAGS "${libscap_link_libdirs}")
configure_file(
${LIBS_DIR}/userspace/libscap/libscap.pc.in ${PROJECT_BINARY_DIR}/libscap/libscap.pc @ONLY
)
install(
TARGETS ${LIBSCAP_INSTALL_LIBS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
@ -132,6 +122,13 @@ if(NOT HAVE_LIBSCAP)
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
)

View File

@ -32,14 +32,6 @@ if(NOT HAVE_LIBSINSP)
if(NOT EMSCRIPTEN)
include(tbb)
endif()
if(NOT WIN32
AND NOT APPLE
AND NOT MINIMAL_BUILD
AND NOT EMSCRIPTEN
)
include(cares)
include(curl)
endif()
include(jsoncpp)
include(valijson)
include(re2)
@ -58,15 +50,6 @@ if(NOT HAVE_LIBSINSP)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JSONCPP_INCLUDE})
endif()
if(NOT USE_BUNDLED_CURL
AND NOT WIN32
AND NOT APPLE
AND NOT MINIMAL_BUILD
AND NOT EMSCRIPTEN
)
list(APPEND LIBSINSP_INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
endif()
function(set_sinsp_target_properties target)
set_target_properties(
${target} PROPERTIES VERSION ${FALCOSECURITY_SHARED_LIBS_VERSION}

View File

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

View File

@ -58,8 +58,9 @@ else()
else()
set(PROTOBUF_PIC_OPTION "--with-pic=yes")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(PROTOBUF_CXXFLAGS "-O2 -std=c++11 -DNDEBUG")
# 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()
@ -72,8 +73,8 @@ else()
URL_HASH "SHA256=e51cc8fc496f893e2a48beb417730ab6cbcb251142ad8b2cd1951faa5c76fe3d"
# TODO what if using system zlib?
CONFIGURE_COMMAND
CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure
CXXFLAGS=${PROTOBUF_CXXFLAGS} --with-zlib ${PROTOBUF_CONFIGURE_FLAGS}
./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

View File

@ -55,6 +55,7 @@ else()
-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
@ -74,6 +75,7 @@ else()
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
endif()
else()
@ -95,6 +97,7 @@ else()
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
else()
ExternalProject_Add(
@ -111,6 +114,7 @@ else()
-DRE2_BUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCMAKE_INSTALL_PREFIX=${RE2_SRC}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
endif()
endif()

View File

@ -58,9 +58,9 @@ else()
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/v2022.0.0.tar.gz")
set(TBB_SRC_URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2022.1.0.tar.gz")
set(TBB_SRC_URL_HASH
"SHA256=e8e89c9c345415b17b30a2db3095ba9d47647611662073f7fbf54ad48b7f3c2a"
"SHA256=ed067603ece0dc832d2881ba5c516625ac2522c665d95f767ef6304e34f961b5"
)
set(TBB_FLAGS "")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ -89,6 +89,8 @@ else()
-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 ""
)
@ -110,6 +112,8 @@ else()
-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 ""
)
@ -129,6 +133,8 @@ else()
-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 ""
)

View File

@ -45,9 +45,14 @@ else()
"${ZLIB_INCLUDE}/zutil.h"
)
if(NOT TARGET zlib)
set(ZLIB_CFLAGS)
# 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 -fPIC)
set(ZLIB_CFLAGS "${ZLIB_CFLAGS} -fPIC")
endif()
message(STATUS "Using bundled zlib in '${ZLIB_SRC}'")

View File

@ -213,6 +213,7 @@
| 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 |

View File

@ -1 +1 @@
8.0.3
8.0.4

View File

@ -158,6 +158,11 @@ set(DRIVER_SOURCES
ppm_consumer.h
capture_macro.h
socketcall_to_syscall.h
syscall_compat_loongarch64.h
syscall_compat_ppc64le.h
syscall_compat_riscv64.h
syscall_compat_s390x.h
syscall_compat_x86_64.h
syscall_ia32_64_map.c
)

View File

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

View File

@ -1 +1 @@
3.5.0
3.69.0

View File

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

View File

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

View File

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

View File

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

View File

@ -1407,3 +1407,15 @@ static __always_inline pid_t bpf_push_pgid(struct filler_data *data, struct task
}
#endif
/* Legacy-probe-specific replacement for `socket_family_to_scap` helper. As encoding the socket
* family using the `socket_family_to_scap` helper breaks the verifier on old kernel versions, just
* send `PPM_AF_UNSPEC` if the user-provided socket family is negative, and leave it as is
* otherwise. This solution relies on the fact that `AF_*` and corresponding `PPM_AF_*` macros map
* to the same values. */
static __always_inline uint8_t bpf_socket_family_to_scap(int8_t family) {
if(family < 0) {
family = PPM_AF_UNSPEC;
}
return (uint8_t)family;
}

File diff suppressed because it is too large Load Diff

View File

@ -143,6 +143,16 @@ struct sys_stash_args {
#ifdef CAPTURE_SCHED_PROC_EXEC
#ifndef BPF_SUPPORTS_RAW_TRACEPOINTS
struct sched_process_exec_args {
unsigned short common_type;
unsigned char common_flags;
unsigned char common_preempt_count;
int common_pid;
__u32 filename; // This is actually defined as "__data_loc char[] filename;".
pid_t pid;
pid_t old_pid;
};
#else
/* TP_PROTO(struct task_struct *p, pid_t old_pid, struct linux_binprm *bprm)
* Taken from `/include/trace/events/sched.h`
*/
@ -151,16 +161,6 @@ struct sched_process_exec_args {
pid_t old_pid;
struct linux_binprm *bprm;
};
#else
struct sched_process_exec_args {
unsigned short common_type;
unsigned char common_flags;
unsigned char common_preempt_count;
int common_pid;
int filename;
pid_t pid;
pid_t old_pid;
};
#endif /* BPF_SUPPORTS_RAW_TRACEPOINTS */
#endif /* CAPTURE_SCHED_PROC_EXEC */

View File

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

View File

@ -0,0 +1,33 @@
/*
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 fs function wants mnt_idmap
* See linux 6.3 changes:
* - https://github.com/torvalds/linux/commit/abf08576afe3
* - https://github.com/torvalds/linux/commit/01beba7957a2
*/
#include <linux/module.h>
#include <linux/fs.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("the Falco authors");
static int fs_mnt_idmap_init(void) {
struct mnt_idmap *idmap = NULL;
const struct inode *inode = NULL;
inode_owner_or_capable(idmap, inode);
return 0;
}
static void fs_mnt_idmap_exit(void) {}
module_init(fs_mnt_idmap_init);
module_exit(fs_mnt_idmap_exit);

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -45,13 +45,13 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SOCKET_SEND_E] = {FILLER_REF(sys_send_e)},
[PPME_SOCKET_SEND_X] = {FILLER_REF(sys_send_x)},
[PPME_SOCKET_SENDTO_E] = {FILLER_REF(sys_sendto_e)},
[PPME_SOCKET_SENDTO_X] = {FILLER_REF(sys_send_x)},
[PPME_SOCKET_SENDTO_X] = {FILLER_REF(sys_sendto_x)},
[PPME_SOCKET_RECV_E] = {FILLER_REF(sys_autofill), 2, APT_SOCK, {{0}, {2}}},
[PPME_SOCKET_RECV_X] = {FILLER_REF(sys_recv_x)},
[PPME_SOCKET_RECVFROM_E] = {FILLER_REF(sys_recvfrom_e)},
[PPME_SOCKET_RECVFROM_X] = {FILLER_REF(sys_recvfrom_x)},
[PPME_SOCKET_SHUTDOWN_E] = {FILLER_REF(sys_shutdown_e)},
[PPME_SOCKET_SHUTDOWN_X] = {FILLER_REF(sys_single_x)},
[PPME_SOCKET_SHUTDOWN_X] = {FILLER_REF(sys_shutdown_x)},
[PPME_SOCKET_GETSOCKNAME_E] = {FILLER_REF(sys_empty)},
[PPME_SOCKET_GETSOCKNAME_X] = {FILLER_REF(sys_empty)},
[PPME_SOCKET_GETPEERNAME_E] = {FILLER_REF(sys_empty)},
@ -75,15 +75,15 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_PIPE_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_PIPE_X] = {FILLER_REF(sys_pipe_x)},
[PPME_SYSCALL_EVENTFD_E] = {FILLER_REF(sys_eventfd_e)},
[PPME_SYSCALL_EVENTFD_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_EVENTFD_X] = {FILLER_REF(sys_eventfd_x)},
[PPME_SYSCALL_FUTEX_E] = {FILLER_REF(sys_futex_e)},
[PPME_SYSCALL_FUTEX_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_FUTEX_X] = {FILLER_REF(sys_futex_x)},
[PPME_SYSCALL_STAT_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_STAT_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_LSTAT_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_LSTAT_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_FSTAT_E] = {FILLER_REF(sys_fstat_e)},
[PPME_SYSCALL_FSTAT_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_FSTAT_X] = {FILLER_REF(sys_fstat_x)},
[PPME_SYSCALL_STAT64_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_STAT64_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_LSTAT64_E] = {FILLER_REF(sys_empty)},
@ -91,7 +91,7 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_FSTAT64_E] = {FILLER_REF(sys_single)},
[PPME_SYSCALL_FSTAT64_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_EPOLLWAIT_E] = {FILLER_REF(sys_autofill), 1, APT_REG, {{2}}},
[PPME_SYSCALL_EPOLLWAIT_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_EPOLLWAIT_X] = {FILLER_REF(sys_epoll_wait_x)},
[PPME_SYSCALL_POLL_E] = {FILLER_REF(sys_poll_e)},
[PPME_SYSCALL_POLL_X] = {FILLER_REF(sys_poll_x)},
[PPME_SYSCALL_SELECT_E] = {FILLER_REF(sys_empty)},
@ -99,7 +99,7 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_NEWSELECT_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_NEWSELECT_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_LSEEK_E] = {FILLER_REF(sys_lseek_e)},
[PPME_SYSCALL_LSEEK_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_LSEEK_X] = {FILLER_REF(sys_lseek_x)},
[PPME_SYSCALL_LLSEEK_E] = {FILLER_REF(sys_llseek_e)},
[PPME_SYSCALL_LLSEEK_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_GETCWD_E] = {FILLER_REF(sys_empty)},
@ -115,15 +115,15 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_PREAD_E] = {FILLER_REF(sys_pread64_e)},
[PPME_SYSCALL_PREAD_X] = {FILLER_REF(sys_pread64_x)},
[PPME_SYSCALL_PWRITE_E] = {FILLER_REF(sys_pwrite64_e)},
[PPME_SYSCALL_PWRITE_X] = {FILLER_REF(sys_write_x)},
[PPME_SYSCALL_PWRITE_X] = {FILLER_REF(sys_pwrite64_x)},
[PPME_SYSCALL_READV_E] = {FILLER_REF(sys_readv_e)},
[PPME_SYSCALL_READV_X] = {FILLER_REF(sys_readv_preadv_x)},
[PPME_SYSCALL_READV_X] = {FILLER_REF(sys_readv_x)},
[PPME_SYSCALL_WRITEV_E] = {FILLER_REF(sys_writev_e)},
[PPME_SYSCALL_WRITEV_X] = {FILLER_REF(sys_writev_pwritev_x)},
[PPME_SYSCALL_WRITEV_X] = {FILLER_REF(sys_writev_x)},
[PPME_SYSCALL_PREADV_E] = {FILLER_REF(sys_preadv_e)},
[PPME_SYSCALL_PREADV_X] = {FILLER_REF(sys_readv_preadv_x)},
[PPME_SYSCALL_PREADV_X] = {FILLER_REF(sys_preadv_x)},
[PPME_SYSCALL_PWRITEV_E] = {FILLER_REF(sys_pwritev_e)},
[PPME_SYSCALL_PWRITEV_X] = {FILLER_REF(sys_writev_pwritev_x)},
[PPME_SYSCALL_PWRITEV_X] = {FILLER_REF(sys_pwritev_x)},
[PPME_SYSCALL_DUP_1_E] = {FILLER_REF(sys_dup_e)},
[PPME_SYSCALL_DUP_1_X] = {FILLER_REF(sys_dup_x)},
[PPME_SYSCALL_DUP2_E] = {FILLER_REF(sys_dup2_e)},
@ -131,22 +131,22 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_DUP3_E] = {FILLER_REF(sys_dup3_e)},
[PPME_SYSCALL_DUP3_X] = {FILLER_REF(sys_dup3_x)},
[PPME_SYSCALL_SIGNALFD_E] = {FILLER_REF(sys_signalfd_e)},
[PPME_SYSCALL_SIGNALFD_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_SIGNALFD_X] = {FILLER_REF(sys_signalfd_x)},
[PPME_SYSCALL_KILL_E] = {FILLER_REF(sys_autofill), 2, APT_REG, {{0}, {1}}},
[PPME_SYSCALL_KILL_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_KILL_X] = {FILLER_REF(sys_kill_x)},
[PPME_SYSCALL_TKILL_E] = {FILLER_REF(sys_autofill), 2, APT_REG, {{0}, {1}}},
[PPME_SYSCALL_TKILL_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_TKILL_X] = {FILLER_REF(sys_tkill_x)},
[PPME_SYSCALL_TGKILL_E] = {FILLER_REF(sys_autofill), 3, APT_REG, {{0}, {1}, {2}}},
[PPME_SYSCALL_TGKILL_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_TGKILL_X] = {FILLER_REF(sys_tgkill_x)},
[PPME_SYSCALL_NANOSLEEP_E] = {FILLER_REF(sys_nanosleep_e)},
[PPME_SYSCALL_NANOSLEEP_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_NANOSLEEP_X] = {FILLER_REF(sys_nanosleep_x)},
[PPME_SYSCALL_TIMERFD_CREATE_E] = {FILLER_REF(sys_autofill),
2,
APT_REG,
{{AF_ID_USEDEFAULT, 0}, {AF_ID_USEDEFAULT, 0}}},
[PPME_SYSCALL_TIMERFD_CREATE_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_TIMERFD_CREATE_X] = {FILLER_REF(sys_timerfd_create_x)},
[PPME_SYSCALL_INOTIFY_INIT_E] = {FILLER_REF(sys_inotify_init_e)},
[PPME_SYSCALL_INOTIFY_INIT_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_INOTIFY_INIT_X] = {FILLER_REF(sys_inotify_init_x)},
[PPME_SYSCALL_GETRLIMIT_E] = {FILLER_REF(sys_getrlimit_setrlimit_e)},
[PPME_SYSCALL_GETRLIMIT_X] = {FILLER_REF(sys_getrlimit_x)},
[PPME_SYSCALL_SETRLIMIT_E] = {FILLER_REF(sys_getrlimit_setrlimit_e)},
@ -161,19 +161,19 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SCHEDSWITCH_6_E] = {FILLER_REF(sched_switch_e)},
#endif
[PPME_SYSCALL_BRK_4_E] = {FILLER_REF(sys_autofill), 1, APT_REG, {{0}}},
[PPME_SYSCALL_BRK_4_X] = {FILLER_REF(sys_brk_munmap_mmap_x)},
[PPME_SYSCALL_BRK_4_X] = {FILLER_REF(sys_brk_x)},
[PPME_SYSCALL_MMAP_E] = {FILLER_REF(sys_mmap_e)},
[PPME_SYSCALL_MMAP_X] = {FILLER_REF(sys_brk_munmap_mmap_x)},
[PPME_SYSCALL_MMAP_X] = {FILLER_REF(sys_mmap_x)},
[PPME_SYSCALL_MMAP2_E] = {FILLER_REF(sys_mmap_e)},
[PPME_SYSCALL_MMAP2_X] = {FILLER_REF(sys_brk_munmap_mmap_x)},
[PPME_SYSCALL_MMAP2_X] = {FILLER_REF(sys_mmap2_x)},
[PPME_SYSCALL_MUNMAP_E] = {FILLER_REF(sys_autofill), 2, APT_REG, {{0}, {1}}},
[PPME_SYSCALL_MUNMAP_X] = {FILLER_REF(sys_brk_munmap_mmap_x)},
[PPME_SYSCALL_MUNMAP_X] = {FILLER_REF(sys_munmap_x)},
[PPME_SYSCALL_SPLICE_E] = {FILLER_REF(sys_splice_e)},
[PPME_SYSCALL_SPLICE_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SPLICE_X] = {FILLER_REF(sys_splice_x)},
[PPME_SYSCALL_PTRACE_E] = {FILLER_REF(sys_ptrace_e)},
[PPME_SYSCALL_PTRACE_X] = {FILLER_REF(sys_ptrace_x)},
[PPME_SYSCALL_IOCTL_3_E] = {FILLER_REF(sys_ioctl_e)},
[PPME_SYSCALL_IOCTL_3_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_IOCTL_3_X] = {FILLER_REF(sys_ioctl_x)},
[PPME_SYSCALL_RENAME_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_RENAME_X] = {FILLER_REF(sys_autofill),
3,
@ -193,14 +193,14 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_QUOTACTL_E] = {FILLER_REF(sys_quotactl_e)},
[PPME_SYSCALL_QUOTACTL_X] = {FILLER_REF(sys_quotactl_x)},
[PPME_SYSCALL_SETRESUID_E] = {FILLER_REF(sys_autofill), 3, APT_REG, {{0}, {1}, {2}}},
[PPME_SYSCALL_SETRESUID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETRESUID_X] = {FILLER_REF(sys_setresuid_x)},
[PPME_SYSCALL_SETRESGID_E] = {FILLER_REF(sys_autofill), 3, APT_REG, {{0}, {1}, {2}}},
[PPME_SYSCALL_SETRESGID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETRESGID_X] = {FILLER_REF(sys_setresgid_x)},
[PPME_SCAPEVENT_E] = {FILLER_REF(sys_scapevent_e)},
[PPME_SYSCALL_SETUID_E] = {FILLER_REF(sys_autofill), 1, APT_REG, {{0}}},
[PPME_SYSCALL_SETUID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETUID_X] = {FILLER_REF(sys_setuid_x)},
[PPME_SYSCALL_SETGID_E] = {FILLER_REF(sys_autofill), 1, APT_REG, {{0}}},
[PPME_SYSCALL_SETGID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETGID_X] = {FILLER_REF(sys_setgid_x)},
[PPME_SYSCALL_GETUID_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_GETUID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_GETEUID_E] = {FILLER_REF(sys_empty)},
@ -223,43 +223,43 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SIGNALDELIVER_E] = {FILLER_REF(sys_signaldeliver_e)},
#endif
[PPME_SYSCALL_GETDENTS_E] = {FILLER_REF(sys_getdents_e)},
[PPME_SYSCALL_GETDENTS_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_GETDENTS_X] = {FILLER_REF(sys_getdents_x)},
[PPME_SYSCALL_GETDENTS64_E] = {FILLER_REF(sys_getdents64_e)},
[PPME_SYSCALL_GETDENTS64_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_GETDENTS64_X] = {FILLER_REF(sys_getdents64_x)},
[PPME_SYSCALL_SETNS_E] = {FILLER_REF(sys_setns_e)},
[PPME_SYSCALL_SETNS_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETNS_X] = {FILLER_REF(sys_setns_x)},
[PPME_SYSCALL_FLOCK_E] = {FILLER_REF(sys_flock_e)},
[PPME_SYSCALL_FLOCK_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_FLOCK_X] = {FILLER_REF(sys_flock_x)},
[PPME_CPU_HOTPLUG_E] = {FILLER_REF(cpu_hotplug_e)},
[PPME_SOCKET_ACCEPT_5_E] = {FILLER_REF(sys_empty)},
[PPME_SOCKET_ACCEPT_5_X] = {FILLER_REF(sys_accept_x)},
[PPME_SYSCALL_SEMOP_E] = {FILLER_REF(sys_single)},
[PPME_SYSCALL_SEMOP_X] = {FILLER_REF(sys_semop_x)},
[PPME_SYSCALL_SEMCTL_E] = {FILLER_REF(sys_semctl_e)},
[PPME_SYSCALL_SEMCTL_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_SEMCTL_X] = {FILLER_REF(sys_semctl_x)},
[PPME_SYSCALL_PPOLL_E] = {FILLER_REF(sys_ppoll_e)},
[PPME_SYSCALL_PPOLL_X] = {FILLER_REF(sys_poll_x)}, /* exit same for poll() and ppoll() */
[PPME_SYSCALL_PPOLL_X] = {FILLER_REF(sys_ppoll_x)},
[PPME_SYSCALL_MOUNT_E] = {FILLER_REF(sys_mount_e)},
[PPME_SYSCALL_MOUNT_X] = {FILLER_REF(sys_autofill),
[PPME_SYSCALL_MOUNT_X] = {FILLER_REF(sys_mount_x),
4,
APT_REG,
{{AF_ID_RETVAL}, {0}, {1}, {2}}},
[PPME_SYSCALL_SEMGET_E] = {FILLER_REF(sys_semget_e)},
[PPME_SYSCALL_SEMGET_X] = {FILLER_REF(sys_single_x)},
[PPME_SYSCALL_SEMGET_X] = {FILLER_REF(sys_semget_x)},
[PPME_SYSCALL_ACCESS_E] = {FILLER_REF(sys_access_e)},
[PPME_SYSCALL_ACCESS_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_ACCESS_X] = {FILLER_REF(sys_access_x)},
[PPME_SYSCALL_CHROOT_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_CHROOT_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_SETSID_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_SETSID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETPGID_E] = {FILLER_REF(sys_setpgid_e)},
[PPME_SYSCALL_SETPGID_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SETPGID_X] = {FILLER_REF(sys_setpgid_x)},
[PPME_SYSCALL_MKDIR_2_E] = {FILLER_REF(sys_mkdir_e)},
[PPME_SYSCALL_MKDIR_2_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_MKDIR_2_X] = {FILLER_REF(sys_mkdir_x)},
[PPME_SYSCALL_RMDIR_2_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_RMDIR_2_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_UNSHARE_E] = {FILLER_REF(sys_unshare_e)},
[PPME_SYSCALL_UNSHARE_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_UNSHARE_X] = {FILLER_REF(sys_unshare_x)},
[PPME_SYSCALL_EXECVE_19_E] = {FILLER_REF(sys_execve_e)},
[PPME_SYSCALL_EXECVE_19_X] = {FILLER_REF(proc_startupdate)},
#ifdef CAPTURE_PAGE_FAULTS
@ -268,7 +268,7 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_BPF_2_E] = {FILLER_REF(sys_bpf_e)},
[PPME_SYSCALL_BPF_2_X] = {FILLER_REF(sys_bpf_x)},
[PPME_SYSCALL_SECCOMP_E] = {FILLER_REF(sys_autofill), 2, APT_REG, {{0}, {1}}},
[PPME_SYSCALL_SECCOMP_X] = {FILLER_REF(sys_autofill), 1, APT_REG, {{AF_ID_RETVAL}}},
[PPME_SYSCALL_SECCOMP_X] = {FILLER_REF(sys_seccomp_x)},
[PPME_SYSCALL_UNLINK_2_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_UNLINK_2_X] = {FILLER_REF(sys_autofill), 2, APT_REG, {{AF_ID_RETVAL}, {0}}},
[PPME_SYSCALL_UNLINKAT_2_E] = {FILLER_REF(sys_empty)},
@ -344,7 +344,7 @@ const struct ppm_event_entry g_ppm_events[PPM_EVENT_MAX] = {
[PPME_SYSCALL_UMOUNT_1_E] = {FILLER_REF(sys_empty)},
[PPME_SYSCALL_UMOUNT_1_X] = {FILLER_REF(sys_umount_x)},
[PPME_SOCKET_ACCEPT4_6_E] = {FILLER_REF(sys_accept4_e)},
[PPME_SOCKET_ACCEPT4_6_X] = {FILLER_REF(sys_accept_x)},
[PPME_SOCKET_ACCEPT4_6_X] = {FILLER_REF(sys_accept4_x)},
[PPME_SYSCALL_UMOUNT2_E] = {FILLER_REF(sys_umount2_e)},
[PPME_SYSCALL_UMOUNT2_X] = {FILLER_REF(sys_umount2_x)},
[PPME_SYSCALL_PIPE2_E] = {FILLER_REF(sys_empty)},

View File

@ -277,10 +277,6 @@ static bool verbose = 0;
static unsigned int max_consumers = 5;
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
static enum cpuhp_state hp_state = 0;
#endif
#define vpr_info(fmt, ...) \
do { \
if(verbose) \
@ -446,6 +442,7 @@ static int ppm_open(struct inode *inode, struct file *filp) {
consumer->consumer_id = consumer_id;
consumer->buffer_bytes_dim = g_buffer_bytes_dim;
consumer->tracepoints_attached = 0; /* Start with no tracepoints */
consumer->hotplug_cpu = -1;
/*
* Initialize the ring buffers array
@ -476,14 +473,6 @@ static int ppm_open(struct inode *inode, struct file *filp) {
ring->info = NULL;
}
/*
* If a cpu is offline when the consumer is first created, we
* will never get events for that cpu even if it later comes
* online via hotplug. We could allocate these rings on-demand
* later in this function if needed for hotplug, but that
* requires the consumer to know to call open again, and that is
* not supported.
*/
for_each_online_cpu(cpu) {
ring = per_cpu_ptr(consumer->ring_buffers, cpu);
@ -1820,6 +1809,27 @@ static int record_event_consumer(struct ppm_consumer_t *consumer,
ASSERT(ring);
ring_info = ring->info;
if(!ring_info) {
// If we haven't got the ring info, it means
// the event was generated by a CPU that was not
// online when the ring buffers were initialized.
// Store info about hotplugged CPU here to later
// send hotplug events on cpu0.
consumer->hotplug_cpu = cpu;
put_cpu();
return res;
}
// Manage hotplug on cpu 0
if(consumer->hotplug_cpu != -1 && cpu == 0) {
event_type = PPME_CPU_HOTPLUG_E;
drop_flags = UF_NEVER_DROP;
tp_type = INTERNAL_EVENTS;
event_datap->category = PPMC_CONTEXT_SWITCH;
event_datap->event_info.context_data.sched_prev = (void *)(long)consumer->hotplug_cpu;
event_datap->event_info.context_data.sched_next = (void *)(long)0;
}
if(event_datap->category == PPMC_CONTEXT_SWITCH &&
event_datap->event_info.context_data.sched_prev != NULL) {
if(event_type != PPME_SCAPEVENT_E && event_type != PPME_CPU_HOTPLUG_E) {
@ -2771,96 +2781,12 @@ static char *ppm_devnode(struct device *dev, mode_t *mode)
}
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20) */
static int do_cpu_callback(unsigned long cpu, long sd_action) {
struct ppm_ring_buffer_context *ring;
struct ppm_consumer_t *consumer;
struct event_data_t event_data;
if(sd_action != 0) {
rcu_read_lock();
list_for_each_entry_rcu(consumer, &g_consumer_list, node) {
ring = per_cpu_ptr(consumer->ring_buffers, cpu);
if(sd_action == 1) {
/*
* If the cpu was offline when the consumer was created,
* this won't do anything because we never created a ring
* buffer. We can't safely create one here because we're
* in atomic context, and the consumer needs to call open
* on this device anyways, so do it in ppm_open.
*/
ring->cpu_online = true;
} else if(sd_action == 2) {
ring->cpu_online = false;
}
}
rcu_read_unlock();
event_data.category = PPMC_CONTEXT_SWITCH;
event_data.event_info.context_data.sched_prev = (void *)cpu;
event_data.event_info.context_data.sched_next = (void *)sd_action;
record_event_all_consumers(PPME_CPU_HOTPLUG_E, UF_NEVER_DROP, &event_data, INTERNAL_EVENTS);
}
return 0;
}
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
static int scap_cpu_online(unsigned int cpu) {
vpr_info("scap_cpu_online on cpu %d\n", cpu);
return do_cpu_callback(cpu, 1);
}
static int scap_cpu_offline(unsigned int cpu) {
vpr_info("scap_cpu_offline on cpu %d\n", cpu);
return do_cpu_callback(cpu, 2);
}
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) */
/*
* This gets called every time a CPU is added or removed
*/
static int cpu_callback(struct notifier_block *self, unsigned long action, void *hcpu) {
unsigned long cpu = (unsigned long)hcpu;
long sd_action = 0;
switch(action) {
case CPU_UP_PREPARE:
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20)
case CPU_UP_PREPARE_FROZEN:
#endif
sd_action = 1;
break;
case CPU_DOWN_PREPARE:
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20)
case CPU_DOWN_PREPARE_FROZEN:
#endif
sd_action = 2;
break;
default:
break;
}
if(do_cpu_callback(cpu, sd_action) < 0)
return NOTIFY_BAD;
else
return NOTIFY_OK;
}
static struct notifier_block cpu_notifier = {
.notifier_call = &cpu_callback,
.next = NULL,
};
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) */
static int scap_init(void) {
dev_t dev;
unsigned int cpu;
unsigned int num_cpus;
int ret;
int acrret = 0;
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
int hp_ret;
#endif
int j;
int n_created_devices = 0;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20)
@ -2964,25 +2890,6 @@ static int scap_init(void) {
goto init_module_err;
}
/*
* Set up our callback in case we get a hotplug even while we are
* initializing the cpu structures
*/
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
hp_ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
DRIVER_NAME "/driver:online",
scap_cpu_online,
scap_cpu_offline);
if(hp_ret <= 0) {
pr_err("error registering cpu hotplug callback\n");
ret = hp_ret;
goto init_module_err;
}
hp_state = hp_ret;
#else
register_cpu_notifier(&cpu_notifier);
#endif
// Initialize globals
g_tracepoints_attached = 0;
for(j = 0; j < KMOD_PROG_ATTACHED_MAX; j++) {
@ -3041,13 +2948,6 @@ static void scap_exit(void) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 20)
tracepoint_synchronize_unregister();
#endif
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
if(hp_state > 0)
cpuhp_remove_state_nocalls(hp_state);
#else
unregister_cpu_notifier(&cpu_notifier);
#endif
}
module_init(scap_init);

View File

@ -256,6 +256,32 @@ file(GLOB_RECURSE BPF_H_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
# Search all bpf.c files
file(GLOB_RECURSE BPF_C_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.bpf.c)
# ##################################################################################################
# Generate the events dimensions file generator executable.
# ##################################################################################################
add_executable(
events_dimensions_generator ${CMAKE_CURRENT_SOURCE_DIR}/definitions/generator/generator.cpp
)
target_link_libraries(events_dimensions_generator PRIVATE scap_event_schema)
add_dependencies(events_dimensions_generator scap_event_schema)
# ##################################################################################################
# Generate the events dimensions file.
# ##################################################################################################
set(BPF_EVENTS_DIMENSIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/definitions/events_dimensions.h)
add_custom_command(
OUTPUT ${BPF_EVENTS_DIMENSIONS_FILE}
COMMAND events_dimensions_generator ${BPF_EVENTS_DIMENSIONS_FILE}
VERBATIM
DEPENDS events_dimensions_generator ${CMAKE_CURRENT_SOURCE_DIR}/../event_table.c
COMMENT
"${MODERN_BPF_LOG_PREFIX} Building events dimensions file: ${BPF_EVENTS_DIMENSIONS_FILE}"
)
add_custom_target(EventsDimensions ALL DEPENDS ${BPF_EVENTS_DIMENSIONS_FILE})
# ##################################################################################################
# Generate an `bpf.o` file for every `bpf.c`
# ##################################################################################################
@ -278,7 +304,7 @@ foreach(BPF_C_FILE ${BPF_C_FILES})
${BPF_O_FILE}
VERBATIM
DEPENDS lbpf
DEPENDS ${BPF_C_FILE} ${BPF_H_FILES}
DEPENDS ${BPF_C_FILE} ${BPF_H_FILES} EventsDimensions
COMMENT "${MODERN_BPF_LOG_PREFIX} Building BPF object: ${BPF_O_FILE}"
)

View File

@ -0,0 +1,8 @@
parallel: 2
kernel_versions:
- v5.10.237
- v5.15.184
- v6.1.140
- v6.6.92
- v6.12.30
- v6.15

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
* Copyright (C) 2023 The Falco Authors.
* 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.
@ -21,243 +21,239 @@
/// want to touch scap tables.
/* Syscall events */
#define GENERIC_E_SIZE HEADER_LEN + sizeof(uint16_t) * 2 + PARAM_LEN * 2
#define GENERIC_X_SIZE HEADER_LEN + sizeof(uint16_t) + PARAM_LEN
#define GETCWD_E_SIZE HEADER_LEN
#define GETDENTS_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETDENTS_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETDENTS64_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETDENTS64_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EPOLL_WAIT_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EPOLL_WAIT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETPEERNAME_E_SIZE HEADER_LEN
#define GETPEERNAME_X_SIZE HEADER_LEN
#define GETSOCKNAME_E_SIZE HEADER_LEN
#define GETSOCKNAME_X_SIZE HEADER_LEN
#define MKDIR_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define MMAP_E_SIZE \
HEADER_LEN + sizeof(uint64_t) * 3 + sizeof(int64_t) + sizeof(uint32_t) * 2 + PARAM_LEN * 6
#define MMAP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define MUNMAP_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + PARAM_LEN * 2
#define MUNMAP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define OPEN_BY_HANDLE_AT_E_SIZE HEADER_LEN
#define SYSCALL_E_SIZE HEADER_LEN + sizeof(uint16_t) * 2 + PARAM_LEN * 2
#define SYSCALL_X_SIZE HEADER_LEN + sizeof(uint16_t) + PARAM_LEN
#define CLOSE_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define CLOSE_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define COPY_FILE_RANGE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define COPY_FILE_RANGE_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) + PARAM_LEN * 3
#define DUP_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define DUP2_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP2_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + PARAM_LEN * 3
#define DUP3_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP3_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + PARAM_LEN * 4
#define CHDIR_E_SIZE HEADER_LEN
#define CHMOD_E_SIZE HEADER_LEN
#define CHOWN_E_SIZE HEADER_LEN
#define LCHOWN_E_SIZE HEADER_LEN
#define CHROOT_E_SIZE HEADER_LEN
#define FCHDIR_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FCHDIR_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FCHMOD_E_SIZE HEADER_LEN
#define FCHMOD_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define FCHMODAT_E_SIZE HEADER_LEN
#define FCHOWN_E_SIZE HEADER_LEN
#define FCHOWN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 2 + PARAM_LEN * 4
#define FCHOWNAT_E_SIZE HEADER_LEN
#define MKDIRAT_E_SIZE HEADER_LEN
#define RMDIR_E_SIZE HEADER_LEN
#define EVENTFD_E_SIZE HEADER_LEN + sizeof(uint64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define EVENTFD_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define INOTIFY_INIT_E_SIZE HEADER_LEN + sizeof(uint8_t) + PARAM_LEN
#define INOTIFY_INIT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define TIMERFD_CREATE_E_SIZE HEADER_LEN + sizeof(uint8_t) * 2 + PARAM_LEN * 2
#define TIMERFD_CREATE_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define USERFAULTFD_E_SIZE HEADER_LEN
#define USERFAULTFD_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SIGNALFD_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint8_t) + PARAM_LEN * 3
#define SIGNALFD_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define KILL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define KILL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define TGKILL_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define TGKILL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define TKILL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define TKILL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SECCOMP_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + PARAM_LEN * 2
#define SECCOMP_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define PTRACE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + PARAM_LEN * 2
#define CAPSET_E_SIZE HEADER_LEN
#define CAPSET_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 3 + PARAM_LEN * 4
#define CLOSE_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define READ_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define WRITE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SOCKET_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SOCKET_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define SOCKETPAIR_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SOCKETPAIR_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 5
#define ACCEPT_E_SIZE HEADER_LEN
#define ACCEPT4_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define BIND_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define LISTEN_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(int32_t) + PARAM_LEN * 2
#define LISTEN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(int32_t) + PARAM_LEN * 3
#define CLONE_E_SIZE HEADER_LEN
#define CLONE3_E_SIZE HEADER_LEN
#define FORK_E_SIZE HEADER_LEN
#define VFORK_E_SIZE HEADER_LEN
#define RENAME_E_SIZE HEADER_LEN
#define RENAMEAT_E_SIZE HEADER_LEN
#define RENAMEAT2_E_SIZE HEADER_LEN
#define LISTEN_E_SIZE HEADER_LEN + sizeof(int32_t) + sizeof(int64_t) + PARAM_LEN * 2
#define LISTEN_X_SIZE HEADER_LEN + sizeof(int32_t) + sizeof(int64_t) * 2 + PARAM_LEN * 3
#define SEND_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define RECV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define RECVFROM_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SHUTDOWN_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define SHUTDOWN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define GETSOCKNAME_E_SIZE HEADER_LEN
#define GETSOCKNAME_X_SIZE HEADER_LEN
#define GETPEERNAME_E_SIZE HEADER_LEN
#define GETPEERNAME_X_SIZE HEADER_LEN
#define SOCKETPAIR_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SOCKETPAIR_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 8
#define SETSOCKOPT_E_SIZE HEADER_LEN
#define GETSOCKOPT_E_SIZE HEADER_LEN
#define SENDMMSG_E_SIZE HEADER_LEN
#define RECVMSG_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define RECVMMSG_E_SIZE HEADER_LEN
#define PIPE_E_SIZE HEADER_LEN
#define PIPE_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint64_t) + PARAM_LEN * 4
#define BPF_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define BPF_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(int32_t) + PARAM_LEN * 2
#define FLOCK_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define FLOCK_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define IOCTL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define IOCTL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define QUOTACTL_E_SIZE \
HEADER_LEN + sizeof(uint16_t) + sizeof(uint8_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 4
#define UNSHARE_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define UNSHARE_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define MOUNT_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define UMOUNT2_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define UMOUNT_E_SIZE HEADER_LEN
#define LINK_E_SIZE HEADER_LEN
#define LINKAT_E_SIZE HEADER_LEN
#define SYMLINK_E_SIZE HEADER_LEN
#define SYMLINKAT_E_SIZE HEADER_LEN
#define UNLINK_E_SIZE HEADER_LEN
#define UNLINKAT_E_SIZE HEADER_LEN
#define SETGID_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define SETGID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETUID_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define SETUID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETNS_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SETNS_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETPGID_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define SETPGID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETRESGID_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SETRESGID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETRESUID_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SETRESUID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SETSID_E_SIZE HEADER_LEN
#define SETSID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EVENTFD_E_SIZE HEADER_LEN + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define EVENTFD_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define FUTEX_E_SIZE HEADER_LEN + sizeof(uint16_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define FUTEX_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define STAT_E_SIZE HEADER_LEN
#define LSTAT_E_SIZE HEADER_LEN
#define FSTAT_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FSTAT_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define STAT64_E_SIZE HEADER_LEN
#define LSTAT64_E_SIZE HEADER_LEN
#define FSTAT64_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FSTAT64_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EPOLL_WAIT_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EPOLL_WAIT_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define SELECT_E_SIZE HEADER_LEN
#define SELECT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define LSEEK_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + sizeof(uint8_t) + PARAM_LEN * 3
#define LSEEK_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) + sizeof(uint8_t) + PARAM_LEN * 4
#define LLSEEK_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + sizeof(uint8_t) + PARAM_LEN * 3
#define LLSEEK_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) + sizeof(uint8_t) + PARAM_LEN * 4
#define GETCWD_E_SIZE HEADER_LEN
#define CHDIR_E_SIZE HEADER_LEN
#define FCHDIR_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FCHDIR_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define PREAD_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define PWRITE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define READV_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define WRITEV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define PREADV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define PWRITEV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define SIGNALFD_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint8_t) + PARAM_LEN * 3
#define SIGNALFD_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + sizeof(uint8_t) + PARAM_LEN * 4
#define KILL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define KILL_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define TKILL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define TKILL_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define TGKILL_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define TGKILL_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint8_t) + PARAM_LEN * 4
#define NANOSLEEP_E_SIZE HEADER_LEN + sizeof(uint64_t) + PARAM_LEN
#define NANOSLEEP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define TIMERFD_CREATE_E_SIZE HEADER_LEN + sizeof(uint8_t) * 2 + PARAM_LEN * 2
#define TIMERFD_CREATE_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) * 2 + PARAM_LEN * 3
#define INOTIFY_INIT_E_SIZE HEADER_LEN + sizeof(uint8_t) + PARAM_LEN
#define INOTIFY_INIT_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define GETRLIMIT_E_SIZE HEADER_LEN + sizeof(uint8_t) + PARAM_LEN
#define GETRLIMIT_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint8_t) + PARAM_LEN * 4
#define SETRLIMIT_E_SIZE HEADER_LEN + sizeof(uint8_t) + PARAM_LEN
#define SETRLIMIT_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint8_t) + PARAM_LEN * 4
#define PRLIMIT64_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define PRLIMIT64_X_SIZE HEADER_LEN + sizeof(int64_t) * 6 + sizeof(uint8_t) + PARAM_LEN * 7
#define GETSOCKOPT_E_SIZE HEADER_LEN
#define SETSOCKOPT_E_SIZE HEADER_LEN
#define RECVMSG_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define READV_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define PREADV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define PREAD64_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define RECVFROM_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define PRLIMIT_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define PRLIMIT_X_SIZE HEADER_LEN + sizeof(int64_t) * 6 + sizeof(uint8_t) + PARAM_LEN * 7
#define DROP_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define DROP_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define FCNTL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define FCNTL_X_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 3
#define SHUTDOWN_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint8_t) + PARAM_LEN * 2
#define SHUTDOWN_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FSCONFIG_E_SIZE HEADER_LEN
#define EPOLL_CREATE_E_SIZE HEADER_LEN + sizeof(int32_t) + PARAM_LEN
#define EPOLL_CREATE_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define EPOLL_CREATE1_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define EPOLL_CREATE1_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define ACCESS_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define MPROTECT_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define MPROTECT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FCNTL_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define SWITCH_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 6
#define BRK_E_SIZE HEADER_LEN + sizeof(uint64_t) + PARAM_LEN
#define BRK_X_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 5
#define MMAP_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 2 + sizeof(uint64_t) * 3 + PARAM_LEN * 6
#define MMAP_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint64_t) * 3 + PARAM_LEN * 10
#define MMAP2_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 2 + sizeof(uint64_t) * 3 + PARAM_LEN * 6
#define MMAP2_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint64_t) * 3 + PARAM_LEN * 10
#define MUNMAP_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + PARAM_LEN * 2
#define MUNMAP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 6
#define SPLICE_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 4
#define SPLICE_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 5
#define PTRACE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + PARAM_LEN * 2
#define IOCTL_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define IOCTL_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define RENAME_E_SIZE HEADER_LEN
#define RENAMEAT_E_SIZE HEADER_LEN
#define SYMLINK_E_SIZE HEADER_LEN
#define SYMLINKAT_E_SIZE HEADER_LEN
#define PROCEXIT_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint8_t) * 2 + PARAM_LEN * 5
#define SENDFILE_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define SENDFILE_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint64_t) * 2 + PARAM_LEN * 5
#define QUOTACTL_E_SIZE HEADER_LEN + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint8_t) * 2 + PARAM_LEN * 4
#define SETRESUID_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SETRESUID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define SETRESGID_E_SIZE HEADER_LEN + sizeof(uint32_t) * 3 + PARAM_LEN * 3
#define SETRESGID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define SCAPEVENT_E_SIZE HEADER_LEN + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define SCAPEVENT_X_SIZE HEADER_LEN
#define SETUID_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define SETUID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SETGID_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define SETGID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define GETUID_E_SIZE HEADER_LEN
#define GETUID_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define GETGID_E_SIZE HEADER_LEN
#define GETGID_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define GETEUID_E_SIZE HEADER_LEN
#define GETEUID_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define GETGID_E_SIZE HEADER_LEN
#define GETGID_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define GETEGID_E_SIZE HEADER_LEN
#define GETEGID_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define GETRESUID_E_SIZE HEADER_LEN
#define GETRESUID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define GETRESGID_E_SIZE HEADER_LEN
#define GETRESGID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define CLONE_E_SIZE HEADER_LEN
#define FORK_E_SIZE HEADER_LEN
#define VFORK_E_SIZE HEADER_LEN
#define SIGNALDELIVER_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
#define PROCINFO_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + PARAM_LEN * 2
#define GETDENTS_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETDENTS_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define GETDENTS64_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define GETDENTS64_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define SETNS_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SETNS_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define FLOCK_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define FLOCK_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define CPU_HOTPLUG_E_SIZE HEADER_LEN + sizeof(uint32_t) * 2 + PARAM_LEN * 2
#define ACCEPT_E_SIZE HEADER_LEN
#define SEMOP_E_SIZE HEADER_LEN + sizeof(int32_t) + PARAM_LEN
#define SEMOP_X_SIZE HEADER_LEN + sizeof(int16_t) * 2 + sizeof(int32_t) + sizeof(int64_t) + sizeof(uint16_t) * 4 + sizeof(uint32_t) + PARAM_LEN * 9
#define SEMCTL_E_SIZE HEADER_LEN + sizeof(int32_t) * 3 + sizeof(uint16_t) + PARAM_LEN * 4
#define SEMCTL_X_SIZE HEADER_LEN + sizeof(int32_t) * 3 + sizeof(int64_t) + sizeof(uint16_t) + PARAM_LEN * 5
#define MOUNT_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define SEMGET_E_SIZE HEADER_LEN + sizeof(int32_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define SEMGET_X_SIZE HEADER_LEN + sizeof(int32_t) * 2 + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 4
#define ACCESS_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define CHROOT_E_SIZE HEADER_LEN
#define SETSID_E_SIZE HEADER_LEN
#define SETSID_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define MKDIR_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define RMDIR_E_SIZE HEADER_LEN
#define UNSHARE_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define UNSHARE_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define PAGE_FAULT_SIZE HEADER_LEN + sizeof(uint32_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define SETPGID_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define SETPGID_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + PARAM_LEN * 3
#define SECCOMP_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + PARAM_LEN * 2
#define SECCOMP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define UNLINK_E_SIZE HEADER_LEN
#define UNLINKAT_E_SIZE HEADER_LEN
#define MKDIRAT_E_SIZE HEADER_LEN
#define LINK_E_SIZE HEADER_LEN
#define LINKAT_E_SIZE HEADER_LEN
#define FCHMODAT_E_SIZE HEADER_LEN
#define CHMOD_E_SIZE HEADER_LEN
#define FCHMOD_E_SIZE HEADER_LEN
#define FCHMOD_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define RENAMEAT2_E_SIZE HEADER_LEN
#define USERFAULTFD_E_SIZE HEADER_LEN
#define USERFAULTFD_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define MPROTECT_E_SIZE HEADER_LEN + sizeof(uint32_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define MPROTECT_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define COPY_FILE_RANGE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define COPY_FILE_RANGE_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint64_t) * 3 + PARAM_LEN * 6
#define CLONE3_E_SIZE HEADER_LEN
#define OPEN_BY_HANDLE_AT_E_SIZE HEADER_LEN
#define IO_URING_SETUP_E_SIZE HEADER_LEN
#define IO_URING_SETUP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 7 + PARAM_LEN * 8
#define IO_URING_ENTER_E_SIZE HEADER_LEN
#define IO_URING_ENTER_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 4 + PARAM_LEN * 6
#define IO_URING_REGISTER_E_SIZE HEADER_LEN
#define IO_URING_REGISTER_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 5
#define MLOCK_E_SIZE HEADER_LEN
#define MLOCK_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define MLOCK2_E_SIZE HEADER_LEN
#define MLOCK2_X_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define MUNLOCK_E_SIZE HEADER_LEN
#define MUNLOCK_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 3
#define MLOCKALL_E_SIZE HEADER_LEN
#define MLOCKALL_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define MUNLOCKALL_E_SIZE HEADER_LEN
#define MUNLOCKALL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define READ_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define IO_URING_ENTER_E_SIZE HEADER_LEN
#define IO_URING_ENTER_X_SIZE \
HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 4 + PARAM_LEN * 6
#define IO_URING_REGISTER_E_SIZE HEADER_LEN
#define IO_URING_REGISTER_X_SIZE \
HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint16_t) + sizeof(uint64_t) + sizeof(uint32_t) + \
PARAM_LEN * 5
#define IO_URING_SETUP_E_SIZE HEADER_LEN
#define IO_URING_SETUP_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 7 + PARAM_LEN * 8
#define MMAP2_E_SIZE \
HEADER_LEN + sizeof(uint64_t) * 3 + sizeof(int64_t) + sizeof(uint32_t) * 2 + PARAM_LEN * 6
#define MMAP2_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define SEMGET_E_SIZE HEADER_LEN + sizeof(int32_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define SEMGET_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SEMCTL_E_SIZE HEADER_LEN + sizeof(int32_t) * 3 + sizeof(uint16_t) + PARAM_LEN * 4
#define SEMCTL_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SELECT_E_SIZE HEADER_LEN
#define SELECT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define SPLICE_E_SIZE \
HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) + sizeof(uint32_t) + PARAM_LEN * 4
#define SPLICE_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define RECVMMSG_E_SIZE HEADER_LEN
#define SENDMMSG_E_SIZE HEADER_LEN
#define SEMOP_E_SIZE HEADER_LEN + sizeof(int32_t) + PARAM_LEN
#define SEMOP_X_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint16_t) * 4 + sizeof(int16_t) * 2 + \
PARAM_LEN * 8
#define GETRESUID_E_SIZE HEADER_LEN
#define GETRESUID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define SENDFILE_E_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define SENDFILE_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + PARAM_LEN * 2
#define FUTEX_E_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + sizeof(uint16_t) + PARAM_LEN * 3
#define FUTEX_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define STAT_E_SIZE HEADER_LEN
#define LSTAT_E_SIZE HEADER_LEN
#define FSTAT_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define FSTAT_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define LSEEK_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + sizeof(uint8_t) + 3 * PARAM_LEN
#define LSEEK_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define LLSEEK_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) + sizeof(uint8_t) + 3 * PARAM_LEN
#define LLSEEK_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define WRITE_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define WRITEV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define PWRITEV_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define PWRITE64_E_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define GETRESGID_E_SIZE HEADER_LEN
#define GETRESGID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define BRK_E_SIZE HEADER_LEN + sizeof(uint64_t) + PARAM_LEN
#define BRK_X_SIZE HEADER_LEN + sizeof(uint64_t) + sizeof(uint32_t) * 3 + PARAM_LEN * 4
#define GETRLIMIT_E_SIZE HEADER_LEN + sizeof(uint8_t) + PARAM_LEN
#define GETRLIMIT_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + PARAM_LEN * 3
#define SEND_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define RECV_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define NANOSLEEP_E_SIZE HEADER_LEN + sizeof(uint64_t) + PARAM_LEN
#define NANOSLEEP_X_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define CAPSET_E_SIZE HEADER_LEN
#define CAPSET_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 3 + PARAM_LEN * 4
#define DUP2_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP2_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + PARAM_LEN * 3
#define DUP3_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP3_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + PARAM_LEN * 4
#define DUP_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define DUP_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + PARAM_LEN * 2
#define BPF_E_SIZE HEADER_LEN + sizeof(int64_t) + PARAM_LEN
#define BPF_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define MLOCK2_E_SIZE HEADER_LEN
#define MLOCK2_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + sizeof(uint64_t) * 2 + PARAM_LEN * 4
#define FSCONFIG_E_SIZE HEADER_LEN
#define EPOLL_CREATE_E_SIZE HEADER_LEN + sizeof(int32_t) + PARAM_LEN
#define EPOLL_CREATE_X_SIZE HEADER_LEN + sizeof(int32_t) + sizeof(int64_t) + PARAM_LEN * 2
#define EPOLL_CREATE1_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define EPOLL_CREATE1_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define CHOWN_E_SIZE HEADER_LEN
#define LCHOWN_E_SIZE HEADER_LEN
#define FCHOWN_E_SIZE HEADER_LEN
#define FCHOWN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) * 2 + PARAM_LEN * 4
#define FCHOWNAT_E_SIZE HEADER_LEN
#define UMOUNT_E_SIZE HEADER_LEN
#define ACCEPT4_E_SIZE HEADER_LEN + sizeof(int32_t) + PARAM_LEN
#define UMOUNT2_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define PIPE2_E_SIZE HEADER_LEN
#define PIPE2_X_SIZE \
HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint64_t) + sizeof(uint32_t) + PARAM_LEN * 5
#define PIPE2_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + sizeof(uint64_t) + PARAM_LEN * 5
#define INOTIFY_INIT1_E_SIZE HEADER_LEN
#define INOTIFY_INIT1_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + 2 * PARAM_LEN
#define INOTIFY_INIT1_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + PARAM_LEN * 2
#define EVENTFD2_E_SIZE HEADER_LEN + sizeof(uint64_t) + PARAM_LEN
#define EVENTFD2_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + 2 * PARAM_LEN
#define SIGNALFD4_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + 2 * PARAM_LEN
#define SIGNALFD4_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + 2 * PARAM_LEN
#define EVENTFD2_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint16_t) + sizeof(uint64_t) + PARAM_LEN * 3
#define SIGNALFD4_E_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) + PARAM_LEN * 2
#define SIGNALFD4_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint16_t) + sizeof(uint32_t) + PARAM_LEN * 4
#define PRCTL_E_SIZE HEADER_LEN
#define MEMFD_CREATE_E_SIZE HEADER_LEN
#define PIDFD_GETFD_E_SIZE HEADER_LEN
#define PIDFD_GETFD_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + 4 * PARAM_LEN
#define PIDFD_GETFD_X_SIZE HEADER_LEN + sizeof(int64_t) * 3 + sizeof(uint32_t) + PARAM_LEN * 4
#define PIDFD_OPEN_E_SIZE HEADER_LEN
#define PIDFD_OPEN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + 3 * PARAM_LEN
#define PIDFD_OPEN_X_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define INIT_MODULE_E_SIZE HEADER_LEN
#define FINIT_MODULE_E_SIZE HEADER_LEN
#define MKNOD_E_SIZE HEADER_LEN
@ -267,19 +263,8 @@
#define PROCESS_VM_WRITEV_E_SIZE HEADER_LEN
#define DELETE_MODULE_E_SIZE HEADER_LEN
#define SETREUID_E_SIZE HEADER_LEN
#define SETREUID_X_SIZE HEADER_LEN + sizeof(uint32_t) * 2 + sizeof(int64_t) + 3 * PARAM_LEN
#define SETREUID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 2 + PARAM_LEN * 3
#define SETREGID_E_SIZE HEADER_LEN
#define SETREGID_X_SIZE HEADER_LEN + sizeof(uint32_t) * 2 + sizeof(int64_t) + 3 * PARAM_LEN
/* Generic tracepoints events. */
#define SCHED_SWITCH_SIZE \
HEADER_LEN + sizeof(int64_t) + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 3 + PARAM_LEN * 6
#define PAGE_FAULT_SIZE HEADER_LEN + sizeof(uint64_t) * 2 + sizeof(uint32_t) + PARAM_LEN * 3
#define SIGNAL_DELIVER_SIZE HEADER_LEN + sizeof(int64_t) * 2 + sizeof(uint8_t) + PARAM_LEN * 3
/* Special internal events */
#define DROP_E_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define DROP_X_SIZE HEADER_LEN + sizeof(uint32_t) + PARAM_LEN
#define HOTPLUG_E_SIZE HEADER_LEN + sizeof(uint32_t) * 2 + PARAM_LEN * 2
#define SETREGID_X_SIZE HEADER_LEN + sizeof(int64_t) + sizeof(uint32_t) * 2 + PARAM_LEN * 3
#endif /* __EVENT_DIMENSIONS_H__ */

View File

@ -0,0 +1,234 @@
#include <functional>
#include <iostream>
#include <map>
#include <sstream>
#include <fstream>
#include <algorithm>
#include "driver/ppm_events_public.h"
extern const struct ppm_event_info g_event_info[];
auto PREFACE = R"(// 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.
*/
#ifndef __EVENT_DIMENSIONS_H__
#define __EVENT_DIMENSIONS_H__
#include "vmlinux.h"
/* Here we have all the dimensions for fixed-size events.
*/
#define PARAM_LEN 2
#define HEADER_LEN sizeof(struct ppm_evt_hdr)
/// TODO: We have to move these in the event_table.c. Right now we don't
/// want to touch scap tables.
/* Syscall events */
)";
auto POSTFACE = R"(
#endif /* __EVENT_DIMENSIONS_H__ */
)";
// Use the following macro to get the stringified version of the C expression retrieving the type
// size (e.g.: SIZE_OF_EXPR(uint8_t) is resolved in "sizeof(uint8_t)").
#define SIZE_OF_EXPR(type) SIZE_OF_EXPR_##type
// Generate the "sizeof" stringified expression for the listed types. New handled types must be
// appended to the list.
#define SIZE_OF_EXPR_DECL_LIST_GEN(FN) \
FN(int8_t) \
FN(int16_t) \
FN(int32_t) \
FN(int64_t) \
FN(uint8_t) \
FN(uint16_t) \
FN(uint32_t) \
FN(uint64_t)
#define SIZE_OF_EXPR_DECL(type) char SIZE_OF_EXPR(type)[] = "sizeof(" #type ")";
SIZE_OF_EXPR_DECL_LIST_GEN(SIZE_OF_EXPR_DECL)
#undef SIZE_OF_EXPR_DECL
#undef SIZE_OF_EXPR_DECL_LIST_GEN
// Special expressions denoting variable size or unused parameter types.
char SIZE_OF_EXPR_VARIABLE_SIZE[] = "<variable_size>", SIZE_OF_EXPR_UNUSED[] = "<unused>";
// Table containing the mapping between parameter types and the corresponding stringified "sizeof"
// expression.
std::map<long long, char *> type_to_size_expr{
{PT_NONE, SIZE_OF_EXPR_UNUSED},
{PT_INT8, SIZE_OF_EXPR(int8_t)},
{PT_INT16, SIZE_OF_EXPR(int16_t)},
{PT_INT32, SIZE_OF_EXPR(int32_t)},
{PT_INT64, SIZE_OF_EXPR(int64_t)},
{PT_UINT8, SIZE_OF_EXPR(uint8_t)},
{PT_UINT16, SIZE_OF_EXPR(uint16_t)},
{PT_UINT32, SIZE_OF_EXPR(uint32_t)},
{PT_UINT64, SIZE_OF_EXPR(uint64_t)},
{PT_CHARBUF, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_BYTEBUF, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_ERRNO, SIZE_OF_EXPR(int64_t)},
{PT_SOCKADDR, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_SOCKTUPLE, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_FD, SIZE_OF_EXPR(int64_t)},
{PT_PID, SIZE_OF_EXPR(int64_t)},
{PT_FDLIST, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_FSPATH, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_SYSCALLID, SIZE_OF_EXPR(uint16_t)},
{PT_SIGTYPE, SIZE_OF_EXPR(uint8_t)},
{PT_RELTIME, SIZE_OF_EXPR(uint64_t)},
{PT_ABSTIME, SIZE_OF_EXPR(uint64_t)},
{PT_PORT, SIZE_OF_EXPR_UNUSED},
{PT_L4PROTO, SIZE_OF_EXPR_UNUSED},
{PT_SOCKFAMILY, SIZE_OF_EXPR_UNUSED},
{PT_BOOL, SIZE_OF_EXPR_UNUSED},
{PT_IPV4ADDR, SIZE_OF_EXPR_UNUSED},
{PT_DYN, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_FLAGS8, SIZE_OF_EXPR(uint8_t)},
{PT_FLAGS16, SIZE_OF_EXPR(uint16_t)},
{PT_FLAGS32, SIZE_OF_EXPR(uint32_t)},
{PT_UID, SIZE_OF_EXPR(uint32_t)},
{PT_GID, SIZE_OF_EXPR(uint32_t)},
{PT_DOUBLE, SIZE_OF_EXPR_UNUSED},
{PT_SIGSET, SIZE_OF_EXPR(uint32_t)},
{PT_CHARBUFARRAY, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_CHARBUF_PAIR_ARRAY, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_IPV4NET, SIZE_OF_EXPR_UNUSED},
{PT_IPV6ADDR, SIZE_OF_EXPR_UNUSED},
{PT_IPV6NET, SIZE_OF_EXPR_UNUSED},
{PT_IPADDR, SIZE_OF_EXPR_UNUSED},
{PT_IPNET, SIZE_OF_EXPR_UNUSED},
{PT_MODE, SIZE_OF_EXPR(uint32_t)},
{PT_FSRELPATH, SIZE_OF_EXPR_VARIABLE_SIZE},
{PT_ENUMFLAGS8, SIZE_OF_EXPR(uint8_t)},
{PT_ENUMFLAGS16, SIZE_OF_EXPR(uint16_t)},
{PT_ENUMFLAGS32, SIZE_OF_EXPR(uint32_t)},
};
// is_fixed_size_event determines if the provided event has a fixed size or not.
bool is_fixed_size_event(struct ppm_event_info const *const evt) {
for(uint32_t i = 0; i < evt->nparams; i++) {
auto &param = evt->params[i];
auto const param_type = param.type;
auto it = type_to_size_expr.find(param_type);
if(it == type_to_size_expr.end()) {
throw std::runtime_error("Unknown event parameter type: " + std::to_string(param_type));
}
auto const size_expr = it->second;
// Just compare pointers is enough.
if(size_expr == SIZE_OF_EXPR_UNUSED) {
throw std::runtime_error("Unexpected unused event parameter type: " +
std::to_string(param_type));
}
if(size_expr == SIZE_OF_EXPR_VARIABLE_SIZE) {
return false;
}
}
return true;
}
// get_vent_size_expr_counts returns, given the provided event and the resulting size expression of
// its parameters, a map containing, for each size expression, the number of occurrences.
std::map<std::string, size_t> get_event_size_expr_counts(struct ppm_event_info const *const evt) {
std::map<std::string, size_t> size_expr_counts;
for(uint32_t i = 0; i < evt->nparams; i++) {
auto const &param = evt->params[i];
auto const param_type = param.type;
auto const it = type_to_size_expr.find(param_type);
if(it == type_to_size_expr.end()) {
throw std::runtime_error("Unknown event parameter type: " + std::to_string(param_type));
}
auto const size_expr = it->second;
size_expr_counts[size_expr]++;
}
return size_expr_counts;
}
// output_event_size outputs the event size macro for the provided event into the provided output
// stream.
void output_event_size(std::ostream &os,
struct ppm_event_info const *const evt,
bool const is_enter_evt) {
// Exclude old versions.
if(evt->flags & EF_OLD_VERSION) {
return;
}
std::string name{evt->name};
// Ignore events without name.
if(name == "NA") {
return;
}
// Exclude events not having a fixed size.
if(!is_fixed_size_event(evt)) {
return;
}
// Generate the complete event size macro name.
std::transform(name.cbegin(), name.cend(), name.begin(), toupper);
if((evt->category & EC_TRACEPOINT) == 0) {
name += is_enter_evt ? "_E" : "_X";
}
name += "_SIZE";
// The event contains at least the header.
os << "#define " << name << " HEADER_LEN";
auto const params_num = evt->nparams;
// Count the number of occurrences for each size expression.
auto size_expr_counts = get_event_size_expr_counts(evt);
// Output "size expression" * "number of occurrences of size expression", for each size
// expression.
for(auto const &[size_expr, count] : size_expr_counts) {
os << " + " << size_expr;
if(count != 1) {
os << " * " << count;
}
}
// Add "number of parameters" * PARAM_LEN, to account the size of each parameter length.
if(params_num != 0) {
os << " + PARAM_LEN";
if(params_num != 1) {
os << " * " << params_num;
}
}
os << '\n';
}
int main(int argc, char *argv[]) {
if(argc != 2) {
std::cerr << "Usage: " << argv[0] << " <filepath>\n";
std::exit(EXIT_FAILURE);
}
std::string filepath{argv[1]};
// Build file content.
std::ostringstream oss;
oss << PREFACE;
for(int i = 0; i < PPM_EVENT_MAX; i++) {
output_event_size(oss, &g_event_info[i], i % 2 == 0);
}
oss << POSTFACE;
// Write content to file.
std::ofstream f{filepath, std::fstream::out | std::fstream::trunc};
f << oss.str();
f.close();
return 0;
}

View File

@ -59,6 +59,10 @@ struct inode___v6_11 {
uint32_t i_ctime_nsec;
};
struct kernfs_node___v6_15 {
struct kernfs_node *__parent;
};
#ifndef BPF_NO_PRESERVE_ACCESS_INDEX
#pragma clang attribute pop
#endif

View File

@ -17,44 +17,99 @@
/*=============================== SETTINGS ===========================*/
static __always_inline struct capture_settings *maps__get_capture_settings() {
uint32_t key = 0;
return bpf_map_lookup_elem(&capture_settings, &key);
}
static __always_inline uint64_t maps__get_boot_time() {
return g_settings.boot_time;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->boot_time;
}
static __always_inline uint32_t maps__get_snaplen() {
return g_settings.snaplen;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->snaplen;
}
static __always_inline bool maps__get_dropping_mode() {
return g_settings.dropping_mode;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->dropping_mode;
}
static __always_inline uint32_t maps__get_sampling_ratio() {
return g_settings.sampling_ratio;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->sampling_ratio;
}
static __always_inline bool maps__get_drop_failed() {
return g_settings.drop_failed;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->drop_failed;
}
static __always_inline bool maps__get_do_dynamic_snaplen() {
return g_settings.do_dynamic_snaplen;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->do_dynamic_snaplen;
}
static __always_inline uint16_t maps__get_fullcapture_port_range_start() {
return g_settings.fullcapture_port_range_start;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->fullcapture_port_range_start;
}
static __always_inline uint16_t maps__get_fullcapture_port_range_end() {
return g_settings.fullcapture_port_range_end;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->fullcapture_port_range_end;
}
static __always_inline uint16_t maps__get_statsd_port() {
return g_settings.statsd_port;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->statsd_port;
}
static __always_inline int32_t maps__get_scap_tid() {
return g_settings.scap_tid;
struct capture_settings *settings = maps__get_capture_settings();
if(settings == NULL) {
return 0;
}
return settings->scap_tid;
}
/*=============================== SETTINGS ===========================*/
@ -89,8 +144,12 @@ static __always_inline uint8_t maps__64bit_sampling_syscall_table(uint32_t sysca
/*=============================== SYSCALL-64 INTERESTING TABLE ===========================*/
static __always_inline bool maps__64bit_interesting_syscall(uint32_t syscall_id) {
return g_64bit_interesting_syscalls_table[syscall_id & (SYSCALL_TABLE_SIZE - 1)];
static __always_inline bool maps__interesting_syscall_64bit(uint32_t syscall_id) {
bool *ret = bpf_map_lookup_elem(&interesting_syscalls_table_64bit, &syscall_id);
if(ret == NULL) {
return false;
}
return *ret;
}
/*=============================== SYSCALL-64 INTERESTING TABLE ===========================*/

View File

@ -26,8 +26,8 @@
/* Maximum number of `iovec` structures that we can analyze. */
#define MAX_IOVCNT 32
/* Maximum number of supported sendmmsg/recvmmsg messages */
#define MAX_SENDMMSG_RECVMMSG_SIZE 8
/* Maximum number of supported sendmmsg/recvmmsg loops with bpf_loop helper */
#define MAX_SENDMMSG_RECVMMSG_SIZE 16
/* Maximum number of `pollfd` structures that we can analyze. */
#define MAX_POLLFD 16

View File

@ -10,6 +10,7 @@
#include <helpers/base/maps_getters.h>
#include <helpers/base/read_from_task.h>
#include <helpers/base/shared_size.h>
#include <driver/ppm_flag_helpers.h>
#if __has_include(<sys/syscall.h>)
@ -1031,3 +1032,47 @@ static __always_inline struct socket *get_sock_from_file(struct file *file) {
}
return (struct socket *)BPF_CORE_READ(file, private_data);
}
///////////////////////////
// EXTRACT FROM MSGHDR
///////////////////////////
/**
* @brief Read the msghdr pointed by `msghdr_pointer` and store it in `msghdr` location.
* @param msghdr pointer to the user_msghdr struct used to store the read msghdr.
* @param msghdr_pointer pointer to the msghdr to be read.
* @return 0 on success, or a negative error in case of failure.
*/
static __always_inline long extract__msghdr(struct user_msghdr *msghdr,
unsigned long msghdr_pointer) {
return bpf_probe_read_user((void *)msghdr,
bpf_core_type_size(struct user_msghdr),
(void *)msghdr_pointer);
}
/**
* @brief Extract the size of a message extracted from an `iovec` struct array.
* @param scratch_space pointer the scratch space on which iovecs are read.
* @param scratch_space_size scratch space total size.
* @param iov_pointer pointer to `iovec` struct array.
* @param iov_cnt number of `iovec` structs.
* @return the size of the message on success, or 0 in case of failure.
*/
static __always_inline uint32_t extract__iovec_size(void *scratch_space,
uint32_t scratch_space_size,
unsigned long iov_pointer,
unsigned long iov_cnt) {
if(bpf_probe_read_user(scratch_space, scratch_space_size, (void *)iov_pointer)) {
return 0;
}
uint32_t total_size_to_read = 0;
const struct iovec *iovec = (const struct iovec *)scratch_space;
for(int i = 0; i < MAX_IOVCNT; i++) {
if(i == iov_cnt) {
break;
}
total_size_to_read += iovec[i].iov_len;
}
return total_size_to_read;
}

View File

@ -14,7 +14,7 @@
#include <helpers/extract/extract_from_kernel.h>
static __always_inline bool syscalls_dispatcher__64bit_interesting_syscall(uint32_t syscall_id) {
return maps__64bit_interesting_syscall(syscall_id);
return maps__interesting_syscall_64bit(syscall_id);
}
static __always_inline long convert_network_syscalls(struct pt_regs *regs) {

View File

@ -1121,9 +1121,7 @@ static __always_inline void auxmap__store_msghdr_size_param(struct auxiliary_map
* we return 0.
*/
struct user_msghdr msghdr = {0};
if(bpf_probe_read_user((void *)&msghdr,
bpf_core_type_size(struct user_msghdr),
(void *)msghdr_pointer)) {
if(extract__msghdr(&msghdr, msghdr_pointer)) {
auxmap__store_u32_param(auxmap, 0);
return;
}
@ -1148,9 +1146,7 @@ static __always_inline struct user_msghdr auxmap__store_msghdr_data_param(
* we return an empty param.
*/
struct user_msghdr msghdr = {0};
if(bpf_probe_read_user((void *)&msghdr,
bpf_core_type_size(struct user_msghdr),
(void *)msghdr_pointer)) {
if(extract__msghdr(&msghdr, msghdr_pointer)) {
/* in case of NULL msghdr we return an empty param */
push__param_len(auxmap->data, &auxmap->lengths_pos, 0);
return msghdr;
@ -1296,7 +1292,12 @@ static __always_inline uint16_t store_cgroup_subsys(struct auxiliary_map *auxmap
}
path_components++;
BPF_CORE_READ_INTO(&cgroup_path_pointers[k], kn, name);
BPF_CORE_READ_INTO(&kn, kn, parent);
if(bpf_core_field_exists(kn->parent)) {
BPF_CORE_READ_INTO(&kn, kn, parent);
} else {
struct kernfs_node___v6_15 *kn_v6_15 = (void *)kn;
BPF_CORE_READ_INTO(&kn, kn_v6_15, __parent);
}
}
/* Reconstruct the path in reverse, using previously collected pointers.
@ -1506,7 +1507,9 @@ static __always_inline void auxmap__store_fdlist_param(struct auxiliary_map *aux
typedef struct {
bool only_port_range;
ppm_event_code evt_type;
long mmsg_index;
long mmsg_index; // Only used by sendmmsg/recvmmsg to pass the current message index
unsigned long *mm_args; // Only used by sendmmsg/recvmmsg to reduce stack size to avoid
// verifier issues
} dynamic_snaplen_args;
static __always_inline void apply_dynamic_snaplen(struct pt_regs *regs,
@ -1556,6 +1559,12 @@ static __always_inline void apply_dynamic_snaplen(struct pt_regs *regs,
*/
unsigned long args[5] = {0};
struct sockaddr *sockaddr = NULL;
union {
struct compat_msghdr compat_mh;
struct user_msghdr mh;
struct compat_mmsghdr compat_mmh;
struct mmsghdr mmh;
} msg_mh = {};
switch(input_args->evt_type) {
case PPME_SOCKET_SENDTO_X:
@ -1568,43 +1577,41 @@ static __always_inline void apply_dynamic_snaplen(struct pt_regs *regs,
case PPME_SOCKET_SENDMSG_X: {
extract__network_args(args, 3, regs);
if(bpf_in_ia32_syscall()) {
struct compat_msghdr compat_mh = {};
if(likely(bpf_probe_read_user(&compat_mh,
if(likely(bpf_probe_read_user(&msg_mh.compat_mh,
bpf_core_type_size(struct compat_msghdr),
(void *)args[1]) == 0)) {
sockaddr = (struct sockaddr *)(unsigned long)(compat_mh.msg_name);
sockaddr = (struct sockaddr *)(unsigned long)(msg_mh.compat_mh.msg_name);
}
// in any case we break the switch.
break;
}
struct user_msghdr mh = {};
if(bpf_probe_read_user(&mh, bpf_core_type_size(struct user_msghdr), (void *)args[1]) == 0) {
sockaddr = (struct sockaddr *)mh.msg_name;
if(extract__msghdr(&msg_mh.mh, args[1]) == 0) {
sockaddr = (struct sockaddr *)msg_mh.mh.msg_name;
}
} break;
case PPME_SOCKET_RECVMMSG_X:
case PPME_SOCKET_SENDMMSG_X: {
extract__network_args(args, 3, regs);
// To avoid verifier stack size issues, sendmmsg and recvmmsg directly pass args
// in dynamic_snaplen_args.
// This also gives a small perf boost while using `bpf_loop` because we don't need
// to re-fetch first 3 syscall args at every iteration.
__builtin_memcpy(args, input_args->mm_args, 3 * sizeof(unsigned long));
if(bpf_in_ia32_syscall()) {
struct compat_mmsghdr compat_mmh = {};
struct compat_mmsghdr *mmh_ptr = (struct compat_mmsghdr *)args[1];
if(likely(bpf_probe_read_user(&compat_mmh,
if(likely(bpf_probe_read_user(&msg_mh.compat_mmh,
bpf_core_type_size(struct compat_mmsghdr),
(void *)(mmh_ptr + input_args->mmsg_index)) == 0)) {
sockaddr = (struct sockaddr *)(unsigned long)(compat_mmh.msg_hdr.msg_name);
sockaddr = (struct sockaddr *)(unsigned long)(msg_mh.compat_mmh.msg_hdr.msg_name);
}
// in any case we break the switch.
break;
}
struct mmsghdr mmh = {};
struct mmsghdr *mmh_ptr = (struct mmsghdr *)args[1];
if(bpf_probe_read_user(&mmh,
if(bpf_probe_read_user(&msg_mh.mmh,
bpf_core_type_size(struct mmsghdr),
(void *)(mmh_ptr + input_args->mmsg_index)) == 0) {
sockaddr = (struct sockaddr *)mmh.msg_hdr.msg_name;
sockaddr = (struct sockaddr *)msg_mh.mmh.msg_hdr.msg_name;
}
} break;
@ -1642,16 +1649,20 @@ static __always_inline void apply_dynamic_snaplen(struct pt_regs *regs,
port_remote = ntohs(port_remote);
if(port_remote == 0 && sockaddr != NULL) {
union {
struct sockaddr_in sockaddr_in;
struct sockaddr_in6 sockaddr_in6;
} saddr_in = {};
if(socket_family == AF_INET) {
struct sockaddr_in sockaddr_in = {};
bpf_probe_read_user(&sockaddr_in, bpf_core_type_size(struct sockaddr_in), sockaddr);
port_remote = ntohs(sockaddr_in.sin_port);
bpf_probe_read_user(&saddr_in.sockaddr_in,
bpf_core_type_size(struct sockaddr_in),
sockaddr);
port_remote = ntohs(saddr_in.sockaddr_in.sin_port);
} else {
struct sockaddr_in6 sockaddr_in6 = {};
bpf_probe_read_user(&sockaddr_in6,
bpf_probe_read_user(&saddr_in.sockaddr_in6,
bpf_core_type_size(struct sockaddr_in6),
sockaddr);
port_remote = ntohs(sockaddr_in6.sin6_port);
port_remote = ntohs(saddr_in.sockaddr_in6.sin6_port);
}
}
}

View File

@ -47,35 +47,23 @@ __weak const volatile uint64_t probe_api_ver = PPM_API_CURRENT_VERSION;
*/
__weak const volatile uint64_t probe_schema_var = PPM_SCHEMA_CURRENT_VERSION;
/*=============================== BPF READ-ONLY GLOBAL VARIABLES ===============================*/
/*=============================== BPF GLOBAL VARIABLES ===============================*/
/**
* @brief Given the syscall id on 64-bit-architectures returns if
* the syscall must be filtered out according to the simple consumer logic.
*/
__weak bool g_64bit_interesting_syscalls_table[SYSCALL_TABLE_SIZE];
/**
* @brief Given the syscall id on 64-bit-architectures returns:
* - `UF_NEVER_DROP` if the syscall must not be dropped in the sampling logic.
* - `UF_ALWAYS_DROP` if the syscall must always be dropped in the sampling logic.
* - `UF_NONE` if we drop the syscall depends on the sampling ratio.
*/
__weak uint8_t g_64bit_sampling_syscall_table[SYSCALL_TABLE_SIZE];
__weak const volatile uint8_t g_64bit_sampling_syscall_table[SYSCALL_TABLE_SIZE];
/**
* @brief Given the syscall id on 32-bit x86 arch returns
* its x64 value. Used to support ia32 syscall emulation.
*/
__weak uint32_t g_ia32_to_64_table[SYSCALL_TABLE_SIZE];
__weak const volatile uint32_t g_ia32_to_64_table[SYSCALL_TABLE_SIZE];
/**
* @brief Global capture settings shared between userspace and
* bpf programs.
*/
__weak struct capture_settings g_settings;
/*=============================== BPF READ-ONLY GLOBAL VARIABLES ===============================*/
/*=============================== BPF GLOBAL VARIABLES ===============================*/
/**
* @brief Variable used only kernel side to understand when we need to send
@ -133,6 +121,28 @@ struct {
/*=============================== BPF_MAP_TYPE_ARRAY ===============================*/
/**
* @brief This table is used to keep track of which syscalls must be filtered out
* according to the simple consumer logic.
*/
struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, SYSCALL_TABLE_SIZE);
__type(key, uint32_t);
__type(value, bool);
} interesting_syscalls_table_64bit __weak SEC(".maps");
/**
* @brief Global capture settings shared between userspace and
* bpf programs.
*/
struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, 1);
__type(key, uint32_t);
__type(value, struct capture_settings);
} capture_settings __weak SEC(".maps");
/* These maps have one entry for each CPU.
*
* PLEASE NOTE:

View File

@ -36,9 +36,9 @@ int BPF_PROG(t_hotplug) {
* the event collection.
*/
struct ringbuf_struct ringbuf;
ringbuf.reserved_event_size = HOTPLUG_E_SIZE;
ringbuf.reserved_event_size = CPU_HOTPLUG_E_SIZE;
ringbuf.event_type = PPME_CPU_HOTPLUG_E;
ringbuf.data = bpf_ringbuf_reserve(rb, HOTPLUG_E_SIZE, 0);
ringbuf.data = bpf_ringbuf_reserve(rb, CPU_HOTPLUG_E_SIZE, 0);
if(!ringbuf.data) {
counter->n_drops_buffer++;
return 0;

View File

@ -179,9 +179,9 @@ int BPF_PROG(t1_sched_p_exec, struct task_struct *p, pid_t old_pid, struct linux
uint32_t tty = exctract__tty(task);
auxmap__store_u32_param(auxmap, (uint32_t)tty);
/* Parameter 18: pgid (type: PT_PID) */
pid_t pgid = extract__task_xid_vnr(task, PIDTYPE_PGID);
auxmap__store_s64_param(auxmap, (int64_t)pgid);
/* Parameter 18: vpgid (type: PT_PID) */
pid_t vpgid = extract__task_xid_vnr(task, PIDTYPE_PGID);
auxmap__store_s64_param(auxmap, (int64_t)vpgid);
/* Parameter 19: loginuid (type: PT_UID) */
uint32_t loginuid;

View File

@ -22,7 +22,7 @@ int BPF_PROG(sched_switch, bool preempt, struct task_struct *prev, struct task_s
/// TODO: we could avoid switches from kernel threads to kernel threads (?).
struct ringbuf_struct ringbuf;
if(!ringbuf__reserve_space(&ringbuf, SCHED_SWITCH_SIZE, PPME_SCHEDSWITCH_6_E)) {
if(!ringbuf__reserve_space(&ringbuf, SWITCH_SIZE, PPME_SCHEDSWITCH_6_E)) {
return 0;
}

View File

@ -19,7 +19,7 @@ int BPF_PROG(signal_deliver, int sig, struct kernel_siginfo *info, struct k_siga
}
struct ringbuf_struct ringbuf;
if(!ringbuf__reserve_space(&ringbuf, SIGNAL_DELIVER_SIZE, PPME_SIGNALDELIVER_E)) {
if(!ringbuf__reserve_space(&ringbuf, SIGNALDELIVER_SIZE, PPME_SIGNALDELIVER_E)) {
return 0;
}

View File

@ -105,6 +105,12 @@ int BPF_PROG(accept4_x, struct pt_regs *regs, long ret) {
/* Parameter 5: queuemax (type: PT_UINT32) */
auxmap__store_u32_param(auxmap, queuemax);
/* Parameter 6: flags (type: PT_FLAGS32) */
/// TODO: we don't support flags yet and so we just return zero.
/// If implemented, special handling for SYS_ACCEPT socketcall is needed.
uint32_t flags = 0;
auxmap__store_u32_param(auxmap, flags);
/*=============================== COLLECT PARAMETERS ===========================*/
auxmap__finalize_event_header(auxmap);

View File

@ -51,10 +51,14 @@ int BPF_PROG(access_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
auxmap__store_s64_param(auxmap, ret);
/* Parameter 2: pathname (type: PT_FSPATH) */
/* Parameter 2: name (type: PT_FSPATH) */
unsigned long path_pointer = extract__syscall_argument(regs, 0);
auxmap__store_charbuf_param(auxmap, path_pointer, MAX_PATH, USER);
/* Parameter 3: mode (type: PT_UINT32) */
int mode = (int)extract__syscall_argument(regs, 1);
auxmap__store_u32_param(auxmap, (uint32_t)access_flags_to_scap(mode));
/*=============================== COLLECT PARAMETERS ===========================*/
auxmap__finalize_event_header(auxmap);

View File

@ -22,7 +22,7 @@ int BPF_PROG(brk_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: addr (type: PT_UINT64) */
unsigned long addr = extract__syscall_argument(regs, 0);
uint64_t addr = extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, addr);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -68,6 +68,10 @@ int BPF_PROG(brk_x, struct pt_regs *regs, long ret) {
/* Parameter 4: vm_swap (type: PT_UINT32) */
ringbuf__store_u32(&ringbuf, swap_size);
/* Parameter 5: addr (type: PT_UINT64) */
uint64_t addr = extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, addr);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -50,9 +50,9 @@ int BPF_PROG(close_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fd (type: PT_FD)*/
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/* Parameter 1: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -80,9 +80,13 @@ int BPF_PROG(close_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -24,14 +24,14 @@ int BPF_PROG(connect_e, struct pt_regs *regs, long id) {
unsigned long args[3] = {0};
extract__network_args(args, 3, regs);
/* Parameter 1: fd (type: PT_FD)*/
int32_t socket_fd = (int32_t)args[0];
auxmap__store_s64_param(auxmap, (int64_t)socket_fd);
/* Parameter 1: fd (type: PT_FD) */
int64_t socket_fd = (int64_t)(int32_t)args[0];
auxmap__store_s64_param(auxmap, socket_fd);
/* Parameter 2: addr (type: PT_SOCKADDR)*/
unsigned long sockaddr_ptr = args[1];
uint16_t addrlen = (uint16_t)args[2];
auxmap__store_sockaddr_param(auxmap, sockaddr_ptr, addrlen);
/* Parameter 2: addr (type: PT_SOCKADDR) */
unsigned long usrsockaddr = args[1];
uint16_t usrsockaddr_len = (uint16_t)args[2];
auxmap__store_sockaddr_param(auxmap, usrsockaddr, usrsockaddr_len);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -57,25 +57,30 @@ int BPF_PROG(connect_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
unsigned long socket_fd = 0;
extract__network_args(&socket_fd, 1, regs);
unsigned long args[3] = {0};
extract__network_args(args, 3, regs);
int64_t socket_fd = (int64_t)(int32_t)args[0];
/* Parameter 1: res (type: PT_ERRNO) */
auxmap__store_s64_param(auxmap, ret);
struct sockaddr *usrsockaddr = (struct sockaddr *)args[1];
/* Parameter 2: tuple (type: PT_SOCKTUPLE) */
/* We need a valid sockfd to extract source data.*/
if(ret == 0 || ret == -EINPROGRESS) {
auxmap__store_socktuple_param(auxmap, (int32_t)socket_fd, OUTBOUND, NULL);
/* Notice: the following will push an empty parameter if
* something goes wrong (e.g.: fd not valid). */
auxmap__store_socktuple_param(auxmap, (int32_t)socket_fd, OUTBOUND, usrsockaddr);
} else {
auxmap__store_empty_param(auxmap);
}
/* Parameter 3: fd (type: PT_FD)*/
/* We need the double cast to extract the first 4 bytes and then
* convert them to a signed integer on 64-bit
*/
auxmap__store_s64_param(auxmap, (int64_t)(int32_t)socket_fd);
/* Parameter 3: fd (type: PT_FD) */
auxmap__store_s64_param(auxmap, socket_fd);
/* Parameter 4: addr (type: PT_SOCKADDR) */
uint16_t usrsockaddr_len = (uint16_t)args[2];
auxmap__store_sockaddr_param(auxmap, (unsigned long)usrsockaddr, usrsockaddr_len);
/*=============================== COLLECT PARAMETERS ===========================*/

View File

@ -25,8 +25,8 @@ int BPF_PROG(copy_file_range_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fdin (type: PT_FD) */
int32_t fdin = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fdin);
int64_t fdin = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fdin);
/* Parameter 2: offin (type: PT_UINT64) */
uint64_t offin = extract__syscall_argument(regs, 1);
@ -58,17 +58,29 @@ int BPF_PROG(copy_file_range_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fdout (type: PT_FD) */
int32_t fdout = (int32_t)extract__syscall_argument(regs, 2);
ringbuf__store_s64(&ringbuf, (int64_t)fdout);
int64_t fdout = (int64_t)(int32_t)extract__syscall_argument(regs, 2);
ringbuf__store_s64(&ringbuf, fdout);
/* Parameter 3: offout (type: PT_UINT64) */
uint64_t offout = extract__syscall_argument(regs, 3);
ringbuf__store_u64(&ringbuf, offout);
/* Parameter 4: fdin (type: PT_FD) */
int64_t fdin = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fdin);
/* Parameter 5: offin (type: PT_UINT64) */
uint64_t offin = extract__syscall_argument(regs, 1);
ringbuf__store_u64(&ringbuf, offin);
/* Parameter 6: len (type: PT_UINT64) */
uint64_t len = extract__syscall_argument(regs, 4);
ringbuf__store_u64(&ringbuf, len);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -21,9 +21,9 @@ int BPF_PROG(dup_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
/* Parameter 1: fd (type: PT_FD) */
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -47,12 +47,12 @@ int BPF_PROG(dup_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_FD)*/
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, (int64_t)(int32_t)ret);
/* Parameter 2: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/*=============================== COLLECT PARAMETERS ===========================*/

View File

@ -21,9 +21,9 @@ int BPF_PROG(dup2_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
/* Parameter 1: fd (type: PT_FD) */
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -47,16 +47,16 @@ int BPF_PROG(dup2_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_FD)*/
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, (int64_t)(int32_t)ret);
/* Parameter 2: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/* Parameter 3: newfd (type: PT_FD) */
int32_t newfd = (int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_s64(&ringbuf, (int64_t)newfd);
int64_t newfd = (int64_t)(int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_s64(&ringbuf, newfd);
/*=============================== COLLECT PARAMETERS ===========================*/

View File

@ -21,9 +21,9 @@ int BPF_PROG(dup3_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
/* Parameter 1: fd (type: PT_FD) */
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -47,16 +47,16 @@ int BPF_PROG(dup3_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_FD)*/
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, (int64_t)(int32_t)ret);
/* Parameter 2: oldfd (type: PT_FD) */
int32_t oldfd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)oldfd);
int64_t oldfd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, oldfd);
/* Parameter 3: newfd (type: PT_FD) */
int32_t newfd = (int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_s64(&ringbuf, (int64_t)newfd);
int64_t newfd = (int64_t)(int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_s64(&ringbuf, newfd);
/* Parameter 4: flags (type: PT_FLAGS32) */
int32_t flags = extract__syscall_argument(regs, 2);

View File

@ -47,9 +47,13 @@ int BPF_PROG(epoll_create_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: size (type: PT_INT32) */
int32_t size = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s32(&ringbuf, size);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -47,9 +47,13 @@ int BPF_PROG(epoll_create1_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: flags (type: PT_FLAGS32) */
int32_t flags = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_u32(&ringbuf, epoll_create1_flags_to_scap(flags));
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -50,6 +50,10 @@ int BPF_PROG(epoll_wait_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: maxevents (type: PT_ERRNO) */
int maxevents = (int)extract__syscall_argument(regs, 2);
ringbuf__store_s64(&ringbuf, (int64_t)maxevents);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -22,8 +22,8 @@ int BPF_PROG(eventfd_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: initval (type: PT_UINT64) */
uint32_t initval = (uint32_t)extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, (uint64_t)initval);
uint64_t initval = (uint64_t)extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, initval);
/* Parameter 2: flags (type: PT_UINT32) */
/* The syscall eventfd has no flags! only `eventfd2` has the `flags` param.
@ -53,9 +53,19 @@ int BPF_PROG(eventfd_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_FD)*/
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: initval (type: PT_UINT64) */
uint64_t initval = (uint64_t)extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, initval);
/* Parameter 3: flags (type: PT_UINT32) */
/* The syscall eventfd has no flags! only `eventfd2` has the `flags` param.
* For compatibility with the event definition here we send `0` as flags.
*/
ringbuf__store_u32(&ringbuf, 0);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -47,13 +47,17 @@ int BPF_PROG(eventfd2_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_FD)*/
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: flags (type: PT_FLAGS16) */
int32_t flags = (int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_u16(&ringbuf, eventfd2_flags_to_scap(flags));
/* Parameter 3: initval (type: PT_UINT64) */
uint32_t initval = (uint32_t)extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, (uint64_t)initval);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -198,9 +198,9 @@ int BPF_PROG(t1_execve_x, struct pt_regs *regs, long ret) {
uint32_t tty = exctract__tty(task);
auxmap__store_u32_param(auxmap, (uint32_t)tty);
/* Parameter 18: pgid (type: PT_PID) */
pid_t pgid = extract__task_xid_vnr(task, PIDTYPE_PGID);
auxmap__store_s64_param(auxmap, (int64_t)pgid);
/* Parameter 18: vpgid (type: PT_PID) */
pid_t vpgid = extract__task_xid_vnr(task, PIDTYPE_PGID);
auxmap__store_s64_param(auxmap, (int64_t)vpgid);
/* Parameter 19: loginuid (type: PT_UID) */
uint32_t loginuid;

View File

@ -50,6 +50,10 @@ int BPF_PROG(fchdir_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO)*/
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -22,8 +22,8 @@ int BPF_PROG(flock_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/* Parameter 2: operation (type: PT_FLAGS32) */
unsigned long operation = extract__syscall_argument(regs, 1);
@ -51,9 +51,17 @@ int BPF_PROG(flock_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/* Parameter 3: operation (type: PT_FLAGS32) */
unsigned long operation = extract__syscall_argument(regs, 1);
ringbuf__store_u32(&ringbuf, flock_flags_to_scap((int)operation));
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -50,6 +50,10 @@ int BPF_PROG(fstat_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -58,6 +58,18 @@ int BPF_PROG(futex_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, (int64_t)ret);
/* Parameter 2: addr (type: PT_UINT64) */
uint64_t addr = extract__syscall_argument(regs, 0);
ringbuf__store_u64(&ringbuf, addr);
/* Parameter 3: op (type: PT_ENUMFLAGS16) */
int32_t op = (int32_t)extract__syscall_argument(regs, 1);
ringbuf__store_u16(&ringbuf, futex_op_to_scap((unsigned long)op));
/* Parameter 4: val (type: PT_UINT64) */
uint64_t val = extract__syscall_argument(regs, 2);
ringbuf__store_u64(&ringbuf, val);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -13,7 +13,7 @@
SEC("tp_btf/sys_enter")
int BPF_PROG(generic_e, struct pt_regs *regs, long id) {
struct ringbuf_struct ringbuf;
if(!ringbuf__reserve_space(&ringbuf, GENERIC_E_SIZE, PPME_GENERIC_E)) {
if(!ringbuf__reserve_space(&ringbuf, SYSCALL_E_SIZE, PPME_GENERIC_E)) {
return 0;
}
@ -52,7 +52,7 @@ int BPF_PROG(generic_e, struct pt_regs *regs, long id) {
SEC("tp_btf/sys_exit")
int BPF_PROG(generic_x, struct pt_regs *regs, long ret) {
struct ringbuf_struct ringbuf;
if(!ringbuf__reserve_space(&ringbuf, GENERIC_X_SIZE, PPME_GENERIC_X)) {
if(!ringbuf__reserve_space(&ringbuf, SYSCALL_X_SIZE, PPME_GENERIC_X)) {
return 0;
}

View File

@ -21,9 +21,9 @@ int BPF_PROG(getdents_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fd (type: PT_FD)*/
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/* Parameter 1: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -47,9 +47,13 @@ int BPF_PROG(getdents_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -21,9 +21,9 @@ int BPF_PROG(getdents64_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fd (type: PT_FD)*/
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/* Parameter 1: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
@ -47,9 +47,13 @@ int BPF_PROG(getdents64_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -71,6 +71,10 @@ int BPF_PROG(getrlimit_x, struct pt_regs *regs, long ret) {
ringbuf__store_s64(&ringbuf, -1);
}
/* Parameter 4: resource (type: PT_ENUMFLAGS8) */
unsigned long resource = extract__syscall_argument(regs, 0);
ringbuf__store_u8(&ringbuf, rlimit_resource_to_scap(resource));
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -53,6 +53,11 @@ int BPF_PROG(inotify_init_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_FD) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: flags (type: PT_UINT8) */
/* Send `0` to unify handling with inotify_init1. */
uint8_t flags = 0;
ringbuf__store_u8(&ringbuf, flags);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -55,9 +55,21 @@ int BPF_PROG(ioctl_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/* Parameter 3: request (type: PT_UINT64) */
uint64_t request = extract__syscall_argument(regs, 1);
ringbuf__store_u64(&ringbuf, request);
/* Parameter 4: argument (type: PT_UINT64) */
uint64_t argument = extract__syscall_argument(regs, 2);
ringbuf__store_u64(&ringbuf, argument);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -51,9 +51,17 @@ int BPF_PROG(kill_x, struct pt_regs *regs, long ret) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: res (type: PT_ERRNO)*/
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, ret);
/* Parameter 2: pid (type: PT_PID) */
pid_t pid = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)pid);
/* Parameter 3: sig (type: PT_SIGTYPE) */
uint8_t sig = (uint8_t)extract__syscall_argument(regs, 1);
ringbuf__store_u8(&ringbuf, sig);
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -58,6 +58,20 @@ int BPF_PROG(llseek_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, (int64_t)ret);
/* Parameter 2: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
/* Parameter 3: offset (type: PT_UINT64) */
unsigned long oh = extract__syscall_argument(regs, 1);
unsigned long ol = extract__syscall_argument(regs, 2);
unsigned long offset = (oh << 32) + ol;
ringbuf__store_u64(&ringbuf, offset);
/* Parameter 4: whence (type: PT_ENUMFLAGS8) */
unsigned long whence = extract__syscall_argument(regs, 3);
ringbuf__store_u8(&ringbuf, lseek_whence_to_scap(whence));
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

View File

@ -22,8 +22,8 @@ int BPF_PROG(lseek_e, struct pt_regs *regs, long id) {
/*=============================== COLLECT PARAMETERS ===========================*/
/* Parameter 1: fd (type: PT_FD) */
int32_t fd = (int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, (int64_t)fd);
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/* Parameter 2: offset (type: PT_UINT64) */
unsigned long offset = extract__syscall_argument(regs, 1);
@ -56,6 +56,18 @@ int BPF_PROG(lseek_x, struct pt_regs *regs, long ret) {
/* Parameter 1: res (type: PT_ERRNO) */
ringbuf__store_s64(&ringbuf, (int64_t)ret);
/* Parameter 2: fd (type: PT_FD) */
int64_t fd = (int64_t)(int32_t)extract__syscall_argument(regs, 0);
ringbuf__store_s64(&ringbuf, fd);
/* Parameter 3: offset (type: PT_UINT64) */
unsigned long offset = extract__syscall_argument(regs, 1);
ringbuf__store_u64(&ringbuf, offset);
/* Parameter 4: whence (type: PT_ENUMFLAGS8) */
unsigned long whence = extract__syscall_argument(regs, 2);
ringbuf__store_u8(&ringbuf, lseek_whence_to_scap(whence));
/*=============================== COLLECT PARAMETERS ===========================*/
ringbuf__submit_event(&ringbuf);

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