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(sinsp): guard against uninitialized use #2261

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

aroberts87
Copy link

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:
Use of a static analysis tool has found a couple of variables that could potentially be used uninitialized. This change ensures those scenarios are no longer possible.

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 Jan 28, 2025

Welcome @aroberts87! It looks like this is your first PR to falcosecurity/libs 🎉

@poiana poiana added the size/XS label Jan 28, 2025
@poiana poiana requested review from gnosek and hbrueckner January 28, 2025 18:21
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.

Thank you!
/approve

@poiana
Copy link
Contributor

poiana commented Jan 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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
Copy link
Contributor

poiana commented Jan 28, 2025

LGTM label has been added.

Git tree hash: 0a6b2da34eacb77e6286c11fa4830a879aff136f

@Andreagit97 Andreagit97 added this to the 0.21.0 milestone Jan 28, 2025
Copy link

Perf diff from master - unit tests

     9.57%     +0.84%  [.] sinsp_parser::reset
     2.43%     -0.79%  [.] next
     8.82%     -0.79%  [.] sinsp_evt::get_type
     1.07%     -0.72%  [.] sinsp_evt::is_filtered_out
     3.93%     +0.51%  [.] gzfile_read
     5.73%     +0.49%  [.] next_event_from_file
    11.28%     +0.33%  [.] sinsp::next
     0.90%     +0.32%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     2.58%     +0.32%  [.] sinsp_thread_manager::get_thread_ref
     1.04%     -0.31%  [.] libsinsp::events::is_unknown_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.0075         +0.0076           145           146           145           146
BM_sinsp_split_median                                          +0.0104         +0.0104           145           146           145           146
BM_sinsp_split_stddev                                          -0.8617         -0.8617             2             0             2             0
BM_sinsp_split_cv                                              -0.8628         -0.8627             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0252         -0.0252            62            61            62            61
BM_sinsp_concatenate_paths_relative_path_median                -0.0245         -0.0245            62            61            62            61
BM_sinsp_concatenate_paths_relative_path_stddev                +0.4884         +0.4869             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.5269         +0.5254             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0381         +0.0381            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0333         +0.0333            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +4.1509         +4.1468             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +3.9621         +3.9581             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0157         +0.0157            61            62            61            62
BM_sinsp_concatenate_paths_absolute_path_median                +0.0222         +0.0222            61            63            61            63
BM_sinsp_concatenate_paths_absolute_path_stddev                +9.5753         +9.5726             0             2             0             2
BM_sinsp_concatenate_paths_absolute_path_cv                    +9.4118         +9.4092             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0057         +0.0057           393           395           393           395
BM_sinsp_split_container_image_median                          +0.0084         +0.0085           393           396           392           396
BM_sinsp_split_container_image_stddev                          -0.2615         -0.2617             2             2             2             2
BM_sinsp_split_container_image_cv                              -0.2657         -0.2659             0             0             0             0

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.34%. Comparing base (6c46ed3) to head (8e2e6ae).
Report is 53 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/sinsp.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2261      +/-   ##
==========================================
+ Coverage   75.16%   75.34%   +0.17%     
==========================================
  Files         278      279       +1     
  Lines       34478    34368     -110     
  Branches     5922     5873      -49     
==========================================
- Hits        25916    25893      -23     
+ Misses       8562     8475      -87     
Flag Coverage Δ
libsinsp 75.34% <0.00%> (+0.17%) ⬆️

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.

@poiana poiana merged commit 3476089 into falcosecurity:master Jan 29, 2025
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants