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

fix(userspace/libscap): scap-gvisor does need to depend upon jsoncpp. #2112

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Oct 15, 2024

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area libscap-engine-gvisor

Does this PR require a change in the driver versions?

What this PR does / why we need it:

Since gvisor sources use jsoncpp, it must depend upon it. Most probably that was an unintentional typo.
See https://github.com/falcosecurity/falco/actions/runs/11324106507/job/31488703414?pr=3380 for a failing CI, where scap_engine_gvisor gets build before jsoncpp and therefore gvisor cannot find json/json.h include.
This is something purely time-based, ie: i am pretty sure that if we compile with a different -jX it would pass the build.

I think the time issue got somewhat exacerbated by #2005 changes.

In the end:

  • scap depends upon jsoncpp
  • sinsp depends upon jsoncpp
  • scap-gvisor does not, so while building scap as dep of sinsp, jsoncpp and scap-gvisor are built in parallel leading to timing issues because scap-gvisor needs jsoncpp

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Oct 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP

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

@FedeDP
Copy link
Contributor Author

FedeDP commented Oct 15, 2024

/milestone 0.19.0

Copy link

Perf diff from master - unit tests

     6.31%     -1.58%  [.] next
     5.34%     -1.25%  [.] gzfile_read
     1.57%     -0.99%  [.] sinsp_evt::get_direction
     2.81%     -0.88%  [.] sinsp_thread_manager::find_thread
     3.77%     +0.71%  [.] sinsp_parser::process_event
     3.82%     +0.65%  [.] sinsp_evt::load_params
     0.49%     +0.63%  [.] scap_event_has_large_payload
     1.34%     -0.60%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>
     0.70%     +0.51%  [.] sinsp_filter_check::parse_field_name
     2.22%     +0.50%  [.] sinsp::fetch_next_event

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.0043         -0.0043           152           151           152           151
BM_sinsp_split_median                                          -0.0027         -0.0027           152           152           152           152
BM_sinsp_split_stddev                                          +0.1315         +0.1324             1             1             1             1
BM_sinsp_split_cv                                              +0.1364         +0.1373             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0008         +0.0008            60            60            60            60
BM_sinsp_concatenate_paths_relative_path_median                +0.0041         +0.0041            60            60            60            60
BM_sinsp_concatenate_paths_relative_path_stddev                -0.6114         -0.6116             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.6117         -0.6119             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0554         +0.0554            23            25            23            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0561         +0.0562            23            25            23            25
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.5535         -0.5533             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.5769         -0.5767             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0201         +0.0201            62            63            62            63
BM_sinsp_concatenate_paths_absolute_path_median                +0.0182         +0.0182            62            63            62            63
BM_sinsp_concatenate_paths_absolute_path_stddev                +2.4159         +2.4097             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +2.3486         +2.3424             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0614         -0.0614           414           389           414           389
BM_sinsp_split_container_image_median                          -0.0616         -0.0616           414           388           414           388
BM_sinsp_split_container_image_stddev                          -0.2651         -0.2651             2             1             2             1
BM_sinsp_split_container_image_cv                              -0.2170         -0.2170             0             0             0             0

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.69%. Comparing base (3b80aa0) to head (215a651).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2112   +/-   ##
=======================================
  Coverage   73.69%   73.69%           
=======================================
  Files         253      253           
  Lines       31914    31914           
  Branches     5627     5619    -8     
=======================================
  Hits        23519    23519           
+ Misses       8375     8374    -1     
- Partials       20       21    +1     
Flag Coverage Δ
libsinsp 73.69% <ø> (ø)

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.

Copy link

X64 kernel testing matrix

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 🟢 🟢 🟢 🟢 🟢 🟢

ARM64 kernel testing matrix

KERNEL CMAKE-CONFIGURE KMOD BUILD KMOD SCAP-OPEN BPF-PROBE BUILD BPF-PROBE SCAP-OPEN MODERN-BPF SCAP-OPEN
amazonlinux2-5.4 🟢 🟢 🟢 🟢 🟢 🟡
amazonlinux2022-5.15 🟢 🟢 🟢 🟢 🟢 🟢
fedora-6.2 🟢 🟢 🟢 🟢 🟢 🟢
oraclelinux-4.14 🟢 🟢 🟢 🟡 🟡 🟡
oraclelinux-5.15 🟢 🟢 🟢 🟢 🟢 🟢
ubuntu-6.5 🟢 🟢 🟢 🟢 🟢 🟢

@FedeDP
Copy link
Contributor Author

FedeDP commented Oct 15, 2024

cc @gnosek

@@ -56,15 +56,11 @@ add_custom_command(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

if(USE_BUNDLED_JSONCPP)
add_dependencies(scap jsoncpp)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note scap instead of scap_engine_gvisor

add_library(
scap_engine_gvisor ${scap_engine_gvisor_sources} ${scap_engine_gvisor_generated_sources}
)

add_dependencies(scap_engine_gvisor uthash)
add_dependencies(scap_engine_gvisor uthash jsoncpp)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to

if(USE_BUNDLED_JSONCPP)

since the jsoncpp cmake module always creates the jsoncpp target.

@poiana poiana merged commit c49225d into master Oct 15, 2024
49 of 50 checks passed
@poiana poiana deleted the fix/gvisor_dep_jsoncpp branch October 15, 2024 09:50
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.

4 participants