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

modules_linux: Add support for builtin kernel modules #23953

Merged
merged 1 commit into from
Mar 17, 2023
Merged

modules_linux: Add support for builtin kernel modules #23953

merged 1 commit into from
Mar 17, 2023

Conversation

TheAifam5
Copy link
Contributor

Previously, kernel modules names were read from the /proc/modules only which prevented k8s linux distribution with kernel modules builtin into the kernel to pass the validation of required kernel modules by Cilium.

This patch adds support for systems with builtin modules by trying to read the kernel module names from following files additionally:

  • /lib/modules/<kernel-version>/modules.builtin
  • /usr/lib/modules/<kernel-version>/modules.builtin
  • /usr/lib/debug/lib/modules/<kernel-version>/modules.builtin

Fixes: #23863

Add support for builtin kernel modules

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible
    Unable to test on my current machine
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Thanks for contributing!

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 22, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Feb 22, 2023
@TheAifam5
Copy link
Contributor Author

TheAifam5 commented Feb 22, 2023

I mistakenly made it as draft. Please publish the PR. I am unable to change the state of this PR. :)

@pchaigno pchaigno added kind/bug This is a bug in the Cilium logic. release-note/bug This PR fixes an issue in a previous release of Cilium. labels Feb 22, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 22, 2023
@pchaigno pchaigno marked this pull request as ready for review February 22, 2023 23:03
@pchaigno pchaigno requested a review from a team as a code owner February 22, 2023 23:03
@pchaigno pchaigno added the sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. label Feb 22, 2023
@TheAifam5
Copy link
Contributor Author

Should I rebase? The one of the pipelines is failing (perhaps due to 0.6 gateway api upgrade).

@pchaigno
Copy link
Member

Should I rebase? The one of the pipelines is failing (perhaps due to 0.6 gateway api upgrade).

Yes, please. The ConformanceGatewayAPI failure doesn't look like a flake and seems fixed on master.

@pchaigno
Copy link
Member

pchaigno commented Mar 6, 2023

/test

pkg/modules/modules_linux.go Outdated Show resolved Hide resolved
@gentoo-root
Copy link
Contributor

This patch adds support for systems with builtin modules by trying to read the kernel module names from following files additionally:
/lib/modules//modules.builtin
/usr/lib/modules//modules.builtin
/usr/lib/debug/lib/modules//modules.builtin

IMO, it's more reliable to query subdirectories of /sys/module (which also exist for builtin modules), rather than files on filesystem (which technically don't have to exist). Imagine a hypothetical situation when all modules are builtin, there is no /lib/modules at all, and even the kernel image doesn't have to be on a mounted filesystem. In this case the only way to check what modules are present is to query sysfs.

@TheAifam5
Copy link
Contributor Author

@gentoo-root

IMO, it's more reliable to query subdirectories of /sys/module

I thought that also. The problem with /sys/module is that only appears when at least has a version or at least one parameter and it is not reliable source due to The conditions of creation in the built-in case are not by design and may be removed in the future.

Since the /lib/modules is getting already mounted due to cilium's btf (findVMLinux function) - I see no problem here.

@NikAleksandrov
Copy link

@TheAifam5 could you please squash the last commit into the first? Since it's not merged yet we can just have the
correct code in the original commit.

@TheAifam5
Copy link
Contributor Author

@NikAleksandrov Understood. I will do it today, around 19-23:00 GMT+1.

Copy link

@NikAleksandrov NikAleksandrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but it needs to be rebased on top of latest master.

Previously, kernel modules names were read from the `/proc/modules` only which prevented k8s linux distribution with kernel modules builtin into the kernel to pass the validation of required kernel modules by Cilium.

This patch adds support for systems with builtin modules by trying to read the kernel module names from following files additionally:
- `/lib/modules/<kernel-version>/modules.builtin`
- `/usr/lib/modules/<kernel-version>/modules.builtin`
- `/usr/lib/debug/lib/modules/<kernel-version>/modules.builtin`

Fixes: #23863

Signed-off-by: Mateusz Paluszkiewicz (TheAifam5) <theaifam5@gmail.com>
@pchaigno
Copy link
Member

/test

@TheAifam5
Copy link
Contributor Author

Should I rebase it again?

@pchaigno
Copy link
Member

Should I rebase it again?

No. In general it's best not to rebase unless 1) you're going to push a change anyway, or 2) there is a merge conflict, or 3) a maintainer asks you to. When rebasing all tests need to be restarted.

I'll triage CI results now and will rerun or mark ready to merge accordingly.

@pchaigno pchaigno merged commit 5163094 into cilium:master Mar 17, 2023
@pchaigno
Copy link
Member

Thanks for fixing this @TheAifam5!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 17, 2023
@dedene
Copy link

dedene commented Apr 21, 2023

@pchaigno I was hoping this to be in the 1.13.2 release, but it seems to be not. Any idea when this will be released?

@pchaigno pchaigno added needs-backport/1.12 needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch and removed needs-backport/1.12 labels Apr 21, 2023
@pchaigno
Copy link
Member

This will be released in v1.14.0. I've added the backport label given that it fits the backporting criteria and shouldn't cause backport conflicts (that code is rarely touched). So unless the backporter hits issues, it should also be in the next v1.13 release.

@dedene
Copy link

dedene commented Apr 21, 2023

Awesome, thanks!

@sayboras sayboras mentioned this pull request Apr 26, 2023
7 tasks
@sayboras sayboras added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Apr 26, 2023
@dedene
Copy link

dedene commented May 17, 2023

Any idea when there will be another 1.13 release or the 1.14 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. kind/bug This is a bug in the Cilium logic. kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cilium doesn't recognize built-in kernel modules, causing IPv6 to fail on Talos Linux
7 participants