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

Use absolute path for clang executable in modern_bpf driver #2032

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

Molter73
Copy link
Contributor

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area build

/area driver-modern-bpf

Does this PR require a change in the driver versions?

What this PR does / why we need it:

This is a very small change that should have no major impact on how the build works. However, when using ccache, having the clang executable resolve to the real path completely breaks compilation for the modern probe.

I know there are other ways to configure ccache that would potentially be possible to have it working, but I would rather not have a custom configuration just for this component.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer: I can't think of a particular reason to use the real versus the absolute path for clang other than getting it as part of a compilation error, but I would argue anyone building the modern probe should be skillful enough to track down what clang binary is being used without this. If there's any other reason, please do let me know.

Does this PR introduce a user-facing change?:

NONE

This is a very small change that should have no major impact on how the
build works. However, when using ccache, having the clang executable
resolve to the real path completely breaks compilation for the modern
probe.

Signed-off-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
@FedeDP
Copy link
Contributor

FedeDP commented Aug 28, 2024

/cc @Andreagit97

@FedeDP
Copy link
Contributor

FedeDP commented Aug 28, 2024

However, when using ccache, having the clang executable resolve to the real path completely breaks compilation for the modern probe.

Question: why does it break the compilation?

Copy link

Perf diff from master - unit tests

     5.36%     -0.67%  [.] next
     1.81%     -0.63%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     4.72%     -0.61%  [.] sinsp_evt::load_params
     1.24%     -0.57%  [.] libsinsp::sinsp_suppress::process_event
     4.57%     +0.52%  [.] sinsp_parser::process_event
     1.26%     -0.48%  [.] 0x00000000000e93c0
     0.64%     +0.46%  [.] scap_event_has_large_payload
    10.47%     -0.42%  [.] sinsp_parser::reset
     0.10%     +0.41%  [.] libsinsp::runc::match_container_id
     0.86%     -0.40%  [.] sinsp_fdtable::find

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.0283         +0.0283           145           149           145           149
BM_sinsp_split_median                                          +0.0325         +0.0325           144           149           144           149
BM_sinsp_split_stddev                                          +0.0373         +0.0378             1             1             1             1
BM_sinsp_split_cv                                              +0.0087         +0.0092             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0763         -0.0763            46            42            46            42
BM_sinsp_concatenate_paths_relative_path_median                -0.0762         -0.0762            46            42            46            42
BM_sinsp_concatenate_paths_relative_path_stddev                -0.2028         -0.2016             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.1370         -0.1357             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0019         +0.0019            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_median                   +0.0011         +0.0011            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.1668         +0.1661             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.1645         +0.1639             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1006         -0.1006            49            44            49            44
BM_sinsp_concatenate_paths_absolute_path_median                -0.1037         -0.1037            48            43            48            43
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.2089         +0.2088             1             1             1             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.3441         +0.3441             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0241         -0.0241           363           354           363           354
BM_sinsp_split_container_image_median                          -0.0241         -0.0241           363           354           363           354
BM_sinsp_split_container_image_stddev                          -0.4821         -0.4819             4             2             4             2
BM_sinsp_split_container_image_cv                              -0.4693         -0.4691             0             0             0             0

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.30%. Comparing base (3004d3e) to head (0aa4126).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2032      +/-   ##
==========================================
- Coverage   74.31%   74.30%   -0.01%     
==========================================
  Files         253      253              
  Lines       30966    30966              
  Branches     5413     5418       +5     
==========================================
- Hits        23011    23010       -1     
- Misses       7955     7956       +1     
Flag Coverage Δ
libsinsp 74.30% <ø> (-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.

@Molter73
Copy link
Contributor Author

Molter73 commented Aug 28, 2024

However, when using ccache, having the clang executable resolve to the real path completely breaks compilation for the modern probe.

Question: why does it break the compilation?

The default way ccache works is by adding symlinks to gcc, g++, clang and clang++, then when you call one of those to build a file the symlink resolves to ccache, it does some caching magic and delegates to the real compiler if it's needed.

When clang resolves to the real path, ccache is called directly and it gets confused about all the arguments that should be passed to clang, breaking compilation with the message: /usr/bin/ccache: invalid option -- 'g'

I should've added the explanation on the PR description, sorry!

@FedeDP
Copy link
Contributor

FedeDP commented Aug 28, 2024

Thanks Mauro, makes sense to me!

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 Aug 28, 2024

LGTM label has been added.

Git tree hash: 15efaeb351a8d01954ae531b217148ac2c078ac9

@Andreagit97 Andreagit97 added this to the 0.18.0 milestone Aug 28, 2024
Copy link
Contributor

@FedeDP FedeDP 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 merged commit e2c5174 into falcosecurity:master Aug 28, 2024
49 of 55 checks passed
@poiana
Copy link
Contributor

poiana commented Aug 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, Molter73

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

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