-
Notifications
You must be signed in to change notification settings - Fork 580
Prevent stripping of BTF data from kernel modules #13813
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
base: 3.0-dev
Are you sure you want to change the base?
Conversation
c53a170
to
d2b26e2
Compare
d2b26e2
to
8c758ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prevents the stripping of BTF data from kernel modules during RPM builds by introducing the directive to keep the '.BTF' ELF section and bumps the release numbers across various kernel-related spec files to trigger rebuilds.
- Adds "%define _find_debuginfo_opts --keep-section '.BTF'" to the appropriate kernel spec files
- Updates release numbers for kernel, kernel-uki, kernel-headers, kernel-64k, and several signed modules to reflect the new build revision
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
SPECS/kernel/kernel.spec | Adds the BTF directive and bumps Release to 2%{?dist} |
SPECS/kernel/kernel-uki.spec | Bumps Release to 2%{?dist} |
SPECS/kernel-headers/kernel-headers.spec | Bumps Release to 2%{?dist} |
SPECS/kernel-64k/kernel-64k.spec | Adds the BTF directive and bumps Release to 2%{?dist} |
SPECS/isert/isert.spec | Bumps last-known-kernel and Release to 2%{?dist} |
SPECS/iser/iser.spec | Bumps last-known-kernel and Release to 2%{?dist} |
SPECS/fwctl/fwctl.spec | Bumps last-known-kernel and Release to 2%{?dist} |
SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/srp-signed/srp-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/kernel-uki-signed/kernel-uki-signed.spec | Bumps Release to 2%{?dist} |
SPECS-SIGNED/kernel-signed/kernel-signed.spec | Bumps Release to 2%{?dist} |
SPECS-SIGNED/kernel-64k-signed/kernel-64k-signed.spec | Bumps Release to 2%{?dist} |
SPECS-SIGNED/isert-signed/isert-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/iser-signed/iser-signed.spec | Bumps Release to 20%{?dist} |
SPECS-SIGNED/fwctl-signed/fwctl-signed.spec | Bumps Release to 20%{?dist} |
SPECS-EXTENDED/kernel-ipe/kernel-ipe.spec | Adds the BTF directive and bumps Release to 2%{?dist} |
6037a2e
to
dd5fbcc
Compare
Add `%define _find_debuginfo_opts --keep-section '.BTF'` to the kernel spec to ensure that the BTF section is preserved in kernel modules. This allows modules to retain BTF info required for eBPF and kernel introspection tools.
dd5fbcc
to
5aaceb7
Compare
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-static
subpackages, etc.) have had theirRelease
tag incremented../cgmanifest.json
,./toolkit/scripts/toolchain/cgmanifest.json
,.github/workflows/cgmanifest.json
)./LICENSES-AND-NOTICES/SPECS/data/licenses.json
,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md
,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON
)*.signatures.json
filessudo make go-tidy-all
andsudo make go-test-coverage
passSummary
This PR updates the kernel spec file to ensure that the BTF (BPF Type Format) section is preserved in all built kernel modules. Specifically, it introduces the following change:
This directive prevents the
find-debuginfo.sh
script (invoked during RPM build and packaged in debugedit) from removing the.BTF
ELF section when stripping debug information from kernel modules._find_debuginfo_opts
is an RPM macro for additional options passed tofind-debuginfo.sh
. (link)--keep-section
is an argument to find-debuginfo.sh as defined in the script.BTF data is expected as the kernel config sets
CONFIG_DEBUG_INFO_BTF_MODULES
(kconfig) and thus each kernel module should contain a.BTF
section.Without this change, module BTF data is not exposed in /sys/kernel/btf/, preventing eBPF tools from tracing module symbols and types.
Change Log
Does this affect the toolchain?
YES
Associated issues
Test Methodology
https://dev.azure.com/mariner-org/mariner/_build/results?buildId=810883&view=results
Built kernel modules using the updated spec were verified to contain the
.BTF
section:readelf -S <module.ko>
and confirmed.BTF
is present.eBPF tools (bpftool and bpftrace) were able to successfully introspect and load BTF data from modules after this change.
No regressions in module loading were observed.
AMD64
ARM64