Use kmod library to load modules in init script#2034
Merged
katiewasnothere merged 1 commit intomicrosoft:mainfrom Mar 20, 2024
Merged
Use kmod library to load modules in init script#2034katiewasnothere merged 1 commit intomicrosoft:mainfrom
katiewasnothere merged 1 commit intomicrosoft:mainfrom
Conversation
0f9eaf9 to
df8108b
Compare
helsaawy
reviewed
Mar 6, 2024
msscotb
reviewed
Mar 11, 2024
- Update Makefile to use libkmod when building init and remove static compilation Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
df8108b to
8c5f531
Compare
helsaawy
approved these changes
Mar 15, 2024
msscotb
approved these changes
Mar 15, 2024
KenGordon
pushed a commit
to KenGordon/hcsshim
that referenced
this pull request
May 17, 2024
…e/kabaldau/kmod_load_modules_init"" This reverts commit 60c7f51.
anmaxvl
pushed a commit
that referenced
this pull request
Oct 29, 2025
Add a step for installing dependencies to build the init script for hcsshim. Related PR #2034 Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
anmaxvl
added a commit
that referenced
this pull request
Oct 29, 2025
…u/kmod_load_modules_init"" This reverts commit 60c7f51.
anmaxvl
added a commit
that referenced
this pull request
Oct 29, 2025
…ewasnothere/kabaldau/kmod_l... Revert "Revert "Merge pull request 2034 from katiewasnothere/kabaldau/kmod_load_modules_init"" This reverts commit 60c7f51.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows for loading kernel modules in the init binary that is run during UVM boot. This is necessary for running certain distros of linux since many builtin modules have been moved out into their own .ko files. We use the same library, libkmod, that is used by programs like systemd and dracut to accomplish this.
We could alternatively manually call the __NR_finit_module syscall with each .ko file that we find to load the modules. However, some modules have dependencies on other modules being loaded first, which would require us to manually track the dependency graph of modules. When you run
depmodin a system, a series of files such as modules.dep are created under /lib/modules/<uname -r>. These files contain information about the modules, such as their dependencies. However, the man page specifically mentions that these files should not be read or used by any additional utilities as they may be subject to change in the future. libkmod handles dependencies internally.WARNING: libkmod does not allow for static compilation, so we have to remove the static ldflag for building the init binary. This is a breaking change with older versions of hcsshim, since now we MUST have certain files present in the UVM for the init to run. If those files are not present, we will simply fail to start the UVM with an unintuitive error message.
Future work: