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(modern): prevent CO-RE relocations when CONFIG_QUOTACTL is not defined #2042

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

Andreagit97
Copy link
Member

@Andreagit97 Andreagit97 commented Sep 2, 2024

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area driver-modern-bpf

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

When CONFIG_QUOTACTL is not defined we need to avoid relocations on structs that are not defined like struct if_dqblk.
Running bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep if_dqblk against a kernel compiled without CONFIG_QUOTACTL will show the absence of struct if_dqblk and so we cannot relocate against it.

Which issue(s) this PR fixes:
Fixes #2033

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
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

Thank you Andre! Great fix!

@poiana
Copy link
Contributor

poiana commented Sep 2, 2024

LGTM label has been added.

Git tree hash: d3e3213dee9299f2d2fedb341806fe9b58e08f24

@poiana
Copy link
Contributor

poiana commented Sep 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

Copy link

github-actions bot commented Sep 2, 2024

Perf diff from master - unit tests

     6.26%     -1.42%  [.] sinsp_evt::get_type
     5.77%     -1.23%  [.] next
     9.65%     +0.72%  [.] sinsp_parser::reset
     1.28%     +0.70%  [.] std::_Hashtable<long, std::pair<long const, std::shared_ptr<sinsp_threadinfo> >, std::allocator<std::pair<long const, std::shared_ptr<sinsp_threadinfo> > >, std::__detail::_Select1st, std::equal_to<long>, std::hash<long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node
     2.21%     -0.63%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     4.22%     +0.57%  [.] sinsp_evt::load_params
     1.16%     -0.56%  [.] scap_next
     1.15%     +0.54%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     0.83%     +0.44%  [.] std::vector<sinsp_evt_param, std::allocator<sinsp_evt_param> >::emplace_back<sinsp_evt*, unsigned int&, char const*, unsigned long&>
     0.79%     +0.44%  [.] sinsp_filter_check::parse_field_name

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.0278         +0.0279           145           149           145           149
BM_sinsp_split_median                                          +0.0293         +0.0294           145           149           145           149
BM_sinsp_split_stddev                                          -0.1279         -0.1294             1             1             1             1
BM_sinsp_split_cv                                              -0.1515         -0.1530             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0963         +0.0964            42            46            42            46
BM_sinsp_concatenate_paths_relative_path_median                +0.0971         +0.0972            42            46            42            46
BM_sinsp_concatenate_paths_relative_path_stddev                -0.4948         -0.4948             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.5392         -0.5393             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0239         -0.0238            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_median                   -0.0311         -0.0310            17            17            17            17
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.7307         +0.7295             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.7731         +0.7716             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.1563         +0.1564            43            49            43            49
BM_sinsp_concatenate_paths_absolute_path_median                +0.1616         +0.1617            43            50            43            50
BM_sinsp_concatenate_paths_absolute_path_stddev                +2.7107         +2.7137             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +2.2091         +2.2114             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0186         -0.0185           349           342           349           342
BM_sinsp_split_container_image_median                          -0.0217         -0.0216           350           342           349           342
BM_sinsp_split_container_image_stddev                          -0.4378         -0.4381             3             2             3             2
BM_sinsp_split_container_image_cv                              -0.4271         -0.4275             0             0             0             0

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.30%. Comparing base (5ed00b2) to head (d1d6211).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2042   +/-   ##
=======================================
  Coverage   74.30%   74.30%           
=======================================
  Files         253      253           
  Lines       30966    30966           
  Branches     5414     5410    -4     
=======================================
  Hits        23010    23010           
+ Misses       7951     7949    -2     
- Partials        5        7    +2     
Flag Coverage Δ
libsinsp 74.30% <ø> (ø)

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

github-actions bot commented Sep 2, 2024

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

@hhoffstaette
Copy link
Contributor

Verified that it fixes the problem - thanks!

@poiana poiana merged commit 741104b into master Sep 3, 2024
54 of 55 checks passed
@poiana poiana deleted the fix_quotactl branch September 3, 2024 09:26
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.

Failure to start with --modern-bpf: quotactl_x fails to load when CONFIG_{XFS_QUOTA,QUOTACTL} are disabled
5 participants