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(driver): use configure system to check for mnt_idmap for fs #2247

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

deepskyblue86
Copy link
Member

@deepskyblue86 deepskyblue86 commented Jan 20, 2025

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area driver-kmod

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:
Kernel 6.3 changed fs functions to struct mnt_idmap.
Use the configure system in place of the version check to support driver build on RHEL 9 (namely 5.14.0-547.el9.x86_64).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
It's possible to reproduce the issue with a CentOS Stream 9. I use vagrant with boxomatic/centos-stream-9 image.

./include/linux/fs.h:3027:22: note: expected 'struct mnt_idmap *' but argument is of type 'struct user_namespace *'
 3027 | int inode_permission(struct mnt_idmap *, struct inode *, int);
      |                      ^~~~~~~~~~~~~~~~~~
./include/linux/cred.h:378:23: error: passing argument 1 of 'inode_owner_or_capable' from incompatible pointer type [-Werror=incompatible-pointer-types]

Does this PR introduce a user-facing change?:

NONE

Copy link

Please double check driver/SCHEMA_VERSION file. See versioning.

/hold

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.

Love this, thanks!
/approve

@FedeDP
Copy link
Contributor

FedeDP commented Jan 20, 2025

/milestone next-driver

@poiana poiana added this to the next-driver milestone Jan 20, 2025
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.

Uh CI is not happy; looking into it.

@poiana poiana removed the lgtm label Jan 20, 2025
@poiana poiana requested a review from FedeDP January 20, 2025 15:56
LucaGuerra
LucaGuerra previously approved these changes Jan 20, 2025
@poiana
Copy link
Contributor

poiana commented Jan 20, 2025

LGTM label has been added.

Git tree hash: 5dfe7bb845271bdd976daa10453713fe29cfdfdf

Copy link

github-actions bot commented Jan 20, 2025

Perf diff from master - unit tests

     2.84%     -0.54%  [.] sinsp_parser::process_event
    10.71%     -0.53%  [.] sinsp_parser::reset
    11.75%     -0.42%  [.] sinsp::next
     1.13%     +0.40%  [.] sinsp::fetch_next_event
     1.03%     -0.32%  [.] sinsp_evt::get_param
     0.74%     +0.31%  [.] scap_next
     1.19%     +0.29%  [.] std::_Hashtable<unsigned long, std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> >, std::allocator<std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned 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
     5.89%     -0.25%  [.] next_event_from_file
     4.31%     -0.24%  [.] gzfile_read
     1.02%     +0.22%  [.] sinsp_parser::event_cleanup

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.0073         -0.0073           146           145           146           145
BM_sinsp_split_median                                          -0.0072         -0.0072           146           145           146           144
BM_sinsp_split_stddev                                          +0.6584         +0.6596             1             1             1             1
BM_sinsp_split_cv                                              +0.6706         +0.6718             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0043         -0.0043            56            56            56            56
BM_sinsp_concatenate_paths_relative_path_median                -0.0050         -0.0050            56            56            56            56
BM_sinsp_concatenate_paths_relative_path_stddev                -0.1170         -0.1175             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.1133         -0.1137             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0378         -0.0378            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0348         -0.0348            25            24            25            24
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.7057         -0.7055             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.6941         -0.6940             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0070         -0.0069            56            55            56            55
BM_sinsp_concatenate_paths_absolute_path_median                +0.0034         +0.0033            55            55            55            55
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.7882         -0.7883             1             0             1             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.7867         -0.7868             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0106         +0.0107           390           394           390           394
BM_sinsp_split_container_image_median                          +0.0134         +0.0134           389           394           389           394
BM_sinsp_split_container_image_stddev                          -0.3649         -0.3655             4             2             4             2
BM_sinsp_split_container_image_cv                              -0.3716         -0.3722             0             0             0             0

Kernel 6.3 changed fs functions to `struct mnt_idmap`.
Use the configure system in place of the version check to support driver
build on RHEL 9 (namely 5.14.0-547.el9.x86_64)

Signed-off-by: Angelo Puglisi <[email protected]>
@deepskyblue86
Copy link
Member Author

Uh CI is not happy; looking into it.

[configure-kmod] make: Entering directory '/home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP' make -C /usr/src/linux-headers-6.5.0-1025-azure M=/home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP modules make[1]: Entering directory '/usr/src/linux-headers-6.5.0-1025-azure' warning: the compiler differs from the one used to build the kernel   The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0   You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0   CC [M]  /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.o /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.c: In function 'fs_mnt_idmap_init': /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.c:25:9: error: implicit declaration of function 'inode_owner_or_capable' [-Werror=implicit-function-declaration]    25 |         inode_owner_or_capable(idmap, inode);       |         ^~~~~~~~~~~~~~~~~~~~~~ /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.c:25:9: warning: 'idmap' is used uninitialized [-Wuninitialized]    25 |         inode_owner_or_capable(idmap, inode);       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.c:25:9: warning: 'inode' is used uninitialized [-Wuninitialized] cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:251: /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP/test.o] Error 1 make[2]: *** [/usr/src/linux-headers-6.5.0-1025-azure/Makefile:2039: /home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-1025-azure' make: *** [Makefile:15: all] Error 2 make: Leaving directory '/home/runner/work/libs/libs/build/driver/src/configure/FS_MNT_IDMAP'

Looks like CentOS Stream 9 has fs.h already included. Added it explicitly.

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 added the lgtm label Jan 20, 2025
@poiana
Copy link
Contributor

poiana commented Jan 20, 2025

LGTM label has been added.

Git tree hash: d80fe92ecd12f425f2fe456a34e54d8bc7c9ecf0

@poiana
Copy link
Contributor

poiana commented Jan 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

@FedeDP
Copy link
Contributor

FedeDP commented Jan 20, 2025

Please double check driver/SCHEMA_VERSION file. See versioning.

False positive.
/unhold

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.12%. Comparing base (02ac6f6) to head (95a0ce9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2247   +/-   ##
=======================================
  Coverage   75.12%   75.12%           
=======================================
  Files         276      276           
  Lines       34399    34399           
  Branches     5922     5922           
=======================================
  Hits        25841    25841           
  Misses       8558     8558           
Flag Coverage Δ
libsinsp 75.12% <ø> (ø)

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 cb3e5cf into falcosecurity:master Jan 20, 2025
57 of 59 checks passed
@deepskyblue86 deepskyblue86 deleted the kmod/fs_mnt_idmap branch January 20, 2025 16:49
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