Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(libsinsp_e2e): add unix_udp_client_server_read test #2231

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

therealbobo
Copy link
Contributor

@therealbobo therealbobo commented Jan 13, 2025

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

chore(libsinsp_e2e): add unix_udp_client_server_read test
fix(driver): properly add back fallback to user data when peer socket data is missing
fix(driver/modern_bpf): lower sendmmsg and recvmmsg loop support to 8 to avoid limit size failures

Copy link

github-actions bot commented Jan 13, 2025

Perf diff from master - unit tests

     9.84%     +0.70%  [.] sinsp::next
     3.20%     +0.47%  [.] sinsp_evt::load_params
     1.06%     +0.44%  [.] sinsp_evt::get_syscall_return_value
     2.99%     -0.37%  [.] sinsp_parser::process_event
    10.35%     +0.32%  [.] sinsp_parser::reset
     1.17%     -0.30%  [.] sinsp_parser::event_cleanup
     1.16%     -0.28%  [.] std::_Hashtable<long, std::pair<long const, std::shared_ptr<sinsp_threadinfo> >, std::allocator<std::pair<long const, std::shared_ptr<sinsp_threadinfo> > >, std::__detail::_Select1st, std::equal_to<long>, std::hash<long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::find
     2.17%     -0.24%  [.] next
     5.54%     +0.19%  [.] next_event_from_file
     0.73%     -0.19%  [.] 0x00000000000fd5b0

Heap diff from master - unit tests

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                         Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                            +0.0330         +0.0330           147           152           147           152
BM_sinsp_split_median                                          +0.0324         +0.0324           147           152           147           152
BM_sinsp_split_stddev                                          -0.3417         -0.3415             2             1             2             1
BM_sinsp_split_cv                                              -0.3628         -0.3626             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.1057         -0.1057            61            54            61            54
BM_sinsp_concatenate_paths_relative_path_median                -0.1057         -0.1057            61            54            61            54
BM_sinsp_concatenate_paths_relative_path_stddev                +0.2474         +0.2481             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.3948         +0.3955             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0011         -0.0011            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0019         -0.0018            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.1959         +0.1961             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.1973         +0.1975             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1406         -0.1406            65            55            65            55
BM_sinsp_concatenate_paths_absolute_path_median                -0.1410         -0.1410            64            55            64            55
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.4069         -0.4070             1             1             1             1
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.3099         -0.3100             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0025         -0.0024           395           394           395           394
BM_sinsp_split_container_image_median                          -0.0034         -0.0034           396           394           396           394
BM_sinsp_split_container_image_stddev                          +0.4490         +0.4482             2             3             2             3
BM_sinsp_split_container_image_cv                              +0.4526         +0.4517             0             0             0             0

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.09%. Comparing base (8362ae9) to head (600fefb).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2231   +/-   ##
=======================================
  Coverage   75.09%   75.09%           
=======================================
  Files         276      276           
  Lines       34391    34391           
  Branches     5927     5927           
=======================================
  Hits        25826    25826           
  Misses       8565     8565           
Flag Coverage Δ
libsinsp 75.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

Thanks @therealbobo ! Since this PR highlights a test failure we should try to fix it up before the 0.20.0 release.
/milestone 0.20.0

@poiana poiana added this to the 0.20.0 milestone Jan 14, 2025
@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

In the meantime, i rebased the PR on latest master.

@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

/hold

// The first byte to 0 can be confused with an `abstract socket address` for this reason
// we put also the second byte to 0 to comunicate to the caller that the address is not
// valid.
sunaddr->sun_path[1] = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same fix applied in #2215 for kmod.

@@ -776,7 +776,7 @@ static __always_inline void auxmap__store_socktuple_param(struct auxiliary_map *

case AF_UNIX: {
struct unix_sock *socket_local = (struct unix_sock *)sk;
struct unix_sock *socket_remote = (struct unix_sock *)BPF_CORE_READ(socket_local, peer);
struct unix_sock *socket_peer = (struct unix_sock *)BPF_CORE_READ(socket_local, peer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rename.

unsigned long start_reading_point;
char first_path_byte = *(char *)path;
if(first_path_byte == '\0') {
if(path[0] == '\0') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid convoluted logic with multiple variables involved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have the suspect it was used to avoid some verifier madness, but let's see 🤞

@@ -861,6 +861,11 @@ static struct socket *ppm_sockfd_lookup_light(int fd, int *err, int *fput_needed
*/

static void unix_socket_path(char *dest, const char *path, size_t size) {
if(path == NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid de-referencing a possibly null ptr.

… paths handling in drivers.

Signed-off-by: Federico Di Pierro <[email protected]>
@FedeDP FedeDP force-pushed the therealbobo-misc branch 2 times, most recently from 50bc294 to e1baab6 Compare January 14, 2025 10:59
driver/modern_bpf/helpers/store/auxmap_store_params.h Outdated Show resolved Hide resolved
driver/modern_bpf/helpers/store/auxmap_store_params.h Outdated Show resolved Hide resolved
unsigned long start_reading_point;
char first_path_byte = *(char *)path;
if(first_path_byte == '\0') {
if(path[0] == '\0') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have the suspect it was used to avoid some verifier madness, but let's see 🤞

… data is missing.

Signed-off-by: Federico Di Pierro <[email protected]>

Co-authored-by: Andrea Terzolo <[email protected]>
@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

X64 matrix; same failures we see on master (related to #2027) :/

KERNEL CMAKE-CONFIGURE KMOD BUILD KMOD SCAP-OPEN BPF-PROBE BUILD BPF-PROBE SCAP-OPEN MODERN-BPF SCAP-OPEN
amazonlinux2-4.19 🟢 🟢 🟢 🟢 🟢 🟡
amazonlinux2-5.10 🟢 🟢 🟢 🟢 🟢
amazonlinux2-5.15 🟢 🟢 🟢 🟢 🟢
amazonlinux2-5.4 🟢 🟢 🟢 🟢 🟢 🟡
amazonlinux2022-5.15 🟢 🟢 🟢 🟢 🟢
amazonlinux2023-6.1 🟢 🟢 🟢 🟢 🟢
archlinux-6.0 🟢 🟢 🟢 🟢 🟢
archlinux-6.7 🟢 🟢 🟢 🟢 🟢 🟢
centos-3.10 🟢 🟢 🟢 🟡 🟡 🟡
centos-4.18 🟢 🟢 🟢 🟢 🟢
centos-5.14 🟢 🟢 🟢 🟢 🟢 🟢
fedora-5.17 🟢 🟢 🟢 🟢 🟢
fedora-5.8 🟢 🟢 🟢 🟢 🟢 🟢
fedora-6.2 🟢 🟢 🟢 🟢 🟢
oraclelinux-3.10 🟢 🟢 🟢 🟡 🟡 🟡
oraclelinux-4.14 🟢 🟢 🟢 🟢 🟢 🟡
oraclelinux-5.15 🟢 🟢 🟢 🟢 🟢
oraclelinux-5.4 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-4.15 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-5.8 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-6.5 🟢 🟢 🟢 🟢 🟢 🟢

Will try to fix them in this same PR.

Andreagit97 and others added 2 commits January 14, 2025 14:52
@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

Latest kernel matrix is finally back green 🚀

KERNEL CMAKE-CONFIGURE KMOD BUILD KMOD SCAP-OPEN BPF-PROBE BUILD BPF-PROBE SCAP-OPEN MODERN-BPF SCAP-OPEN
amazonlinux2-4.19 🟢 🟢 🟢 🟢 🟢 🟡
amazonlinux2-5.10 🟢 🟢 🟢 🟢 🟢 🟢
amazonlinux2-5.15 🟢 🟢 🟢 🟢 🟢 🟢
amazonlinux2-5.4 🟢 🟢 🟢 🟢 🟢 🟡
amazonlinux2022-5.15 🟢 🟢 🟢 🟢 🟢 🟢
amazonlinux2023-6.1 🟢 🟢 🟢 🟢 🟢 🟢
archlinux-6.0 🟢 🟢 🟢 🟢 🟢 🟢
archlinux-6.7 🟢 🟢 🟢 🟢 🟢 🟢
centos-3.10 🟢 🟢 🟢 🟡 🟡 🟡
centos-4.18 🟢 🟢 🟢 🟢 🟢 🟢
centos-5.14 🟢 🟢 🟢 🟢 🟢 🟢
fedora-5.17 🟢 🟢 🟢 🟢 🟢 🟢
fedora-5.8 🟢 🟢 🟢 🟢 🟢 🟢
fedora-6.2 🟢 🟢 🟢 🟢 🟢 🟢
oraclelinux-3.10 🟢 🟢 🟢 🟡 🟡 🟡
oraclelinux-4.14 🟢 🟢 🟢 🟢 🟢 🟡
oraclelinux-5.15 🟢 🟢 🟢 🟢 🟢 🟢
oraclelinux-5.4 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-4.15 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-5.8 🟢 🟢 🟢 🟢 🟢 🟡
ubuntu-6.5 🟢 🟢 🟢 🟢 🟢 🟢

@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

/unhold

@poiana
Copy link
Contributor

poiana commented Jan 14, 2025

LGTM label has been added.

Git tree hash: fed2fa492496b13098a891d9d9fe081a27d43f43

@FedeDP
Copy link
Contributor

FedeDP commented Jan 14, 2025

/approve

@poiana
Copy link
Contributor

poiana commented Jan 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, therealbobo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit d327a3b into falcosecurity:master Jan 14, 2025
55 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants