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/libsinsp): user id 0 or group id 0 default values #2177

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Dec 2, 2024

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area libsinsp
/area tests

Does this PR require a change in the driver versions?

What this PR does / why we need it:

Fixed a possible case were the root, /root default values for uid 0 users and gid 0 groups were not set (after #2165).
Moreover, properly use different static members for threadinfo::get_user() and threadinfo::get_loginuser.
Also, added tests to avoid future failures.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@poiana poiana requested review from hbrueckner and incertum December 2, 2024 09:46
@poiana poiana added the approved label Dec 2, 2024
@FedeDP FedeDP changed the title fix(userspace/libsinsp): user id 0 or group id 0 default values wip: fix(userspace/libsinsp): user id 0 or group id 0 default values Dec 2, 2024
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP FedeDP force-pushed the chore/fix_uid0_gid0_defaults branch from b2e91c6 to d178abd Compare December 2, 2024 10:04
FedeDP added a commit to falcosecurity/falco that referenced this pull request Dec 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

Perf diff from master - unit tests

     5.12%     -1.66%  [.] sinsp_parser::process_event
    11.13%     -1.11%  [.] sinsp_parser::reset
     3.62%     +0.91%  [.] sinsp_evt::load_params
     1.15%     +0.69%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>
     6.08%     -0.66%  [.] sinsp::next
     4.43%     -0.55%  [.] gzfile_read
     4.04%     +0.52%  [.] next
     0.15%     +0.46%  [.] sinsp_threadinfo::set_cgroups
     0.55%     -0.41%  [.] sinsp_container_manager::resolve_container
     0.20%     +0.41%  [.] std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_insert_unique_node

Heap diff from master - unit tests

peak heap memory consumption: -1.94K
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.0335         +0.0335           145           150           145           150
BM_sinsp_split_median                                          +0.0338         +0.0338           145           150           145           150
BM_sinsp_split_stddev                                          +1.2139         +1.2093             1             1             1             1
BM_sinsp_split_cv                                              +1.1421         +1.1377             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0003         +0.0003            61            61            61            61
BM_sinsp_concatenate_paths_relative_path_median                +0.0011         +0.0011            61            61            61            61
BM_sinsp_concatenate_paths_relative_path_stddev                -0.0921         -0.0914             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.0924         -0.0917             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0002         -0.0002            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   -0.0014         -0.0014            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.5292         +0.5300             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.5294         +0.5303             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0409         +0.0409            63            66            63            66
BM_sinsp_concatenate_paths_absolute_path_median                +0.0606         +0.0606            62            66            62            66
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.0185         -0.0185             2             2             2             2
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.0571         -0.0571             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0054         +0.0054           394           396           394           396
BM_sinsp_split_container_image_median                          +0.0063         +0.0063           394           396           394           396
BM_sinsp_split_container_image_stddev                          -0.0589         -0.0590             3             3             3             3
BM_sinsp_split_container_image_cv                              -0.0639         -0.0640             0             0             0             0

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 98.90110% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.16%. Comparing base (1c4698b) to head (451a3d9).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/sinsp.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2177      +/-   ##
==========================================
+ Coverage   75.07%   75.16%   +0.09%     
==========================================
  Files         256      257       +1     
  Lines       33659    33736      +77     
  Branches     5752     5755       +3     
==========================================
+ Hits        25268    25359      +91     
+ Misses       8391     8377      -14     
Flag Coverage Δ
libsinsp 75.16% <98.90%> (+0.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.

…up manager.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@@ -285,9 +285,8 @@ void sinsp::init() {
m_inited = true;
}

void sinsp::set_import_users(bool import_users, bool user_details) {
void sinsp::set_import_users(bool import_users) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cleaned up unused flag.

@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 2, 2024

/milestone 0.20.0

@poiana poiana added this to the 0.20.0 milestone Dec 2, 2024
…t static pointer.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP FedeDP force-pushed the chore/fix_uid0_gid0_defaults branch from 313688a to 451a3d9 Compare December 2, 2024 14:35
@FedeDP FedeDP changed the title wip: fix(userspace/libsinsp): user id 0 or group id 0 default values fix(userspace/libsinsp): user id 0 or group id 0 default values Dec 2, 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
Copy link
Contributor

poiana commented Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, 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

@poiana poiana merged commit 12c8b09 into master Dec 2, 2024
49 checks passed
@poiana poiana deleted the chore/fix_uid0_gid0_defaults branch December 2, 2024 17:06
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