Skip to content

Conversation

@mrgian
Copy link
Contributor

@mrgian mrgian commented Oct 24, 2024

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:
This PR ensures that the plugin API exposes the file descriptor table of its main thread instead of its own.
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix(libsinsp): expose main thread fd table

@github-actions
Copy link

github-actions bot commented Oct 24, 2024

Perf diff from master - unit tests

     5.69%     -1.35%  [.] next
     3.11%     +0.63%  [.] gzfile_read
     8.07%     -0.57%  [.] sinsp::next
     0.72%     +0.57%  [.] libsinsp::state::stl_container_table_adapter<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::dynamic_fields_t>::stl_container_table_adapter
     1.29%     -0.55%  [.] sinsp_parser::parse_context_switch
     4.04%     +0.51%  [.] sinsp_evt::load_params
     0.31%     +0.48%  [.] copy_and_sanitize_path
     2.58%     -0.46%  [.] sinsp_thread_manager::get_thread_ref
     0.46%     +0.46%  [.] scap_event_encode_params_v
     0.72%     -0.44%  [.] libsinsp::state::stl_container_table_adapter<std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, libsinsp::state::pair_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, libsinsp::state::pair_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::dynamic_fields_t>::stl_container_table_adapter

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -2.02K
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.0015         +0.0015           151           151           151           151
BM_sinsp_split_median                                          -0.0106         -0.0106           153           151           153           151
BM_sinsp_split_stddev                                          -0.7564         -0.7564             5             1             5             1
BM_sinsp_split_cv                                              -0.7567         -0.7568             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0956         +0.0957            56            61            56            61
BM_sinsp_concatenate_paths_relative_path_median                +0.0884         +0.0885            56            60            56            60
BM_sinsp_concatenate_paths_relative_path_stddev                +2.2877         +2.2877             0             1             0             1
BM_sinsp_concatenate_paths_relative_path_cv                    +2.0007         +2.0004             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0122         -0.0121            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   -0.0135         -0.0134            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.0556         -0.0523             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.0439         -0.0406             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0801         +0.0801            56            61            56            61
BM_sinsp_concatenate_paths_absolute_path_median                +0.0781         +0.0781            56            61            56            61
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.1212         +0.1217             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.0381         +0.0385             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0114         +0.0114           391           396           391           395
BM_sinsp_split_container_image_median                          +0.0118         +0.0118           391           396           391           396
BM_sinsp_split_container_image_stddev                          +0.5866         +0.5874             3             5             3             5
BM_sinsp_split_container_image_cv                              +0.5688         +0.5695             0             0             0             0

@codecov
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.46%. Comparing base (b4ca436) to head (4dc461c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2133   +/-   ##
=======================================
  Coverage   74.46%   74.46%           
=======================================
  Files         254      254           
  Lines       33333    33340    +7     
  Branches     5708     5715    +7     
=======================================
+ Hits        24820    24827    +7     
+ Misses       8487     8486    -1     
- Partials       26       27    +1     
Flag Coverage Δ
libsinsp 74.46% <100.00%> (+<0.01%) ⬆️

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.

@mrgian mrgian force-pushed the mrgian-expose-main-fdtable branch from 2fec49f to 2cd6315 Compare October 24, 2024 10:58
@mrgian mrgian marked this pull request as ready for review October 24, 2024 10:59
@poiana poiana requested a review from Molter73 October 24, 2024 10:59
}
parent_thread->add_child(tinfo);

tinfo->update_main_fdtable();
Copy link
Member

Choose a reason for hiding this comment

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

putting this in create_thread_dependencies should correctly set the fdtable in all cases

  • /proc scan at initi time
  • /proc scan at runtime
  • when a new thread is added after a clone syscall

@mrgian
Copy link
Contributor Author

mrgian commented Oct 24, 2024

/cc @Andreagit97 @jasondellaluce

Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Oct 24, 2024

LGTM label has been added.

DetailsGit tree hash: bc6dcb27c550d8a5c39f8548bf0ee496a702cb78

@FedeDP
Copy link
Contributor

FedeDP commented Oct 29, 2024

Can you rebase on latest master to unlock arm64 CI? :) We switched runners from actuated to the cncf provided ones.

@mrgian mrgian force-pushed the mrgian-expose-main-fdtable branch from 2cd6315 to 4dc461c Compare October 29, 2024 16:16
@poiana poiana removed the lgtm label Oct 29, 2024
Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

/approve

@poiana poiana added the lgtm label Oct 30, 2024
@poiana
Copy link
Contributor

poiana commented Oct 30, 2024

LGTM label has been added.

DetailsGit tree hash: cd0c762c0a1f4fe7c48126c46d71b08230a0be72

@poiana
Copy link
Contributor

poiana commented Oct 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, mrgian

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

The pull request process is described here

Details 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 701e991 into falcosecurity:master Oct 30, 2024
@ekoops ekoops added this to the 0.23.0 milestone Dec 19, 2025
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