anatol / booster

Fast and secure initramfs generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify soft dependencies behavior

anatol opened this issue · comments

Kernel module soft dependencies is a bit of a bizarre Linux concept that does not have a clear specification (or at least I did not find one). I was trying to read kmod sourcecode https://github.com/kmod-project/kmod to understand the soft dependencies behavior better.

Here is summary of the proposed booster softdeps behavior:

  • Softdeps are optional, it means the main module would work even if any (or even all) of the softdeps failed to load. I.e. we should print the softmodule load error but it should not interrupt the main module loading.
  • Deps + PreSoftdeps are loaded before the main module. These dependencies will be loaded in parallel without particular ordering between deps/softdeps
  • Booster waits for deps+presoftdeps loading completion then loads the main module then starts loading postsoftdeps. PostSoftdeps are loaded in parallel as well.
  • Regular deps are always added to booster image and loaded at init. Softdeps are subject to host-mode filtering. I.e. if host-mode is enabled then only softmodules that are used at the host machine will be added to the image and later loaded.
  • In the case of universal mode all deps and softdeps are added to the image.
  • Modules filtering configuration (e.g. “modules: btrfs,-foo,-bar”) effects softdeps as well.

Another concept used by kmod is aliases. Alias represents a “pointer” to one or many other modules. If a dep/softdep contains an alias then booster replaces it with the real module name(s) and then processes it (config filtering, host-mode filtering) if needed.

It is related to issues #133 #64, cc @nmeum @oech3