lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1689589902.git.msuchanek@suse.de>
Date:   Mon, 17 Jul 2023 12:39:49 +0200
From:   Michal Suchanek <msuchanek@...e.de>
To:     linux-modules@...r.kernel.org
Cc:     Michal Suchanek <msuchanek@...e.de>, Takashi Iwai <tiwai@...e.com>,
        Lucas De Marchi <lucas.de.marchi@...il.com>,
        Michal Koutný <mkoutny@...e.com>,
        Jiri Slaby <jslaby@...e.com>, Jan Engelhardt <jengelh@...i.de>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nicolas Schier <nicolas@...sle.eu>,
        linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH kmod v4 0/4] kmod /usr support

Hello,

with these patches it is possible to install kernel modules in an arbitrary
directory - eg. moving the /lib/modules to /usr/lib/modules or /opt/linux.

While the modprobe.d and depmod.d search which already includes multiple
paths is expanded to also include $(prefix) the module directory still
supports only one location, only a different one under $(module_directory).

Having kmod search multiple module locations while only one is supported now
might break some assumption about relative module path corresponding to a
specific file, would require more invasive changes to implement, and is not
supportive of the goal of moving the modules away from /lib.

Both kmod and the kernel need to be patched to make use of this feature.
Patched kernel is backwards compatible with older kmod.  Patched kmod
with $(module_directory) set to /lib/modules is equivalent to unpatched kmod.

With this patch the kmod tool can spit out a JSON with the tool build-time
configuration, and jq is used for getting a single value out of that.

I opted for this because crating .pc files requires putting the logic into the
autohell files which is very clumsy. Also pkg-config insists on hiding
the actual .pc file data and only allowing clumsy queries through its
commandline interface.

jq has its downsides, too. So far it is not used by kernel build, only
by other tools shipped with the kernel. This adds another dependency for
kernel builds.

It turns out that the kernel already does use pkg-config. There are two
alternate spellings: pkg-config and pkgconfig. Searching for the latter
gives a few matches in the kernel giving off the impression that it's a
thing but not really used.

Thanks

Michal

Link: https://lore.kernel.org/linux-modules/20210112160211.5614-1-msuchanek@suse.de/


Michal Suchanek (4):
  man/depmod.d: Fix incorrect /usr/lib search path
  libkmod, depmod: Load modprobe.d, depmod.d from $prefix/lib.
  kmod: Add config command to show compile time configuration as JSON
  libkmod, depmod, modprobe: Make directory for kernel modules
    configurable

 Makefile.am                          |   4 +-
 configure.ac                         |   7 ++
 libkmod/libkmod.c                    |  11 +--
 man/Makefile.am                      |  10 ++-
 man/depmod.d.xml                     |   9 ++-
 man/depmod.xml                       |   4 +-
 man/kmod.xml                         |   6 ++
 man/modinfo.xml                      |   2 +-
 man/modprobe.d.xml                   |   1 +
 man/modprobe.xml                     |   2 +-
 man/modules.dep.xml                  |   6 +-
 testsuite/module-playground/Makefile |   2 +-
 testsuite/setup-rootfs.sh            | 109 +++++++++++++++------------
 testsuite/test-depmod.c              |  16 ++--
 testsuite/test-testsuite.c           |   8 +-
 tools/depmod.c                       |   7 +-
 tools/kmod.c                         |  41 ++++++++++
 tools/modinfo.c                      |   4 +-
 tools/modprobe.c                     |   4 +-
 tools/static-nodes.c                 |   6 +-
 20 files changed, 169 insertions(+), 90 deletions(-)

-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ