SHA256
1
0
forked from pool/kmod

Accepting request 1131540 from Base:System

OBS-URL: https://build.opensuse.org/request/show/1131540
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kmod?expand=0&rev=80
This commit is contained in:
Ana Guerrero 2023-12-08 21:31:18 +00:00 committed by Git OBS Bridge
commit eb5edb23d0
12 changed files with 332 additions and 51 deletions

View File

@ -0,0 +1,46 @@
From 48b0c75f79f86140314b9656d3d855a515e18a73 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 10 Nov 2023 13:13:55 +0100
Subject: [PATCH 8/9] configure: Check that provided paths are absolute
configure checks that its built-in directory options get an absolute
path. Copy the check for custom options.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/8aff0c9c491d8afeec7f6b2cd96cbd0439e26fbb.1699618135.git.msuchanek@suse.de
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
---
configure.ac | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/configure.ac b/configure.ac
index d6da5ee9ae9a..de01e08cf2e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,23 @@ AC_ARG_WITH([module_directory],
[], [with_module_directory=/lib/modules])
AC_SUBST([module_directory], [$with_module_directory])
+# Check all directory arguments for consistency.
+for ac_var in distconfdir rootlibdir module_directory
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*@<:@^/@:>@\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ @<:@\\/$@:>@* | ?:@<:@\\/@:>@* ) continue;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
[], [with_zstd=no])
--
2.42.0

View File

@ -1,13 +1,15 @@
From 1bb5f3aafc9b4bff638ed3288308289fdec60270 Mon Sep 17 00:00:00 2001 From 1bb23d7f19d888fbdd96ae0fe929b7086713ef33 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 17 Jul 2023 21:23:51 +0200 Date: Tue, 18 Jul 2023 14:01:52 +0200
Subject: [PATCH 1/6] configure: Detect openssl sm3 support Subject: [PATCH 1/9] configure: Detect openssl sm3 support
Older openssl versions do not support sm3. The code has an option to Older openssl versions do not support sm3. The code has an option to
disable the sm3 hash but the lack of openssl support is not detected disable the sm3 hash but the lack of openssl support is not detected
automatically. automatically.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/b97e20faa07e9e31c6eaf96683011aa24e80760c.1689681454.git.msuchanek@suse.de
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
--- ---
configure.ac | 7 +++++++ configure.ac | 7 +++++++
1 file changed, 7 insertions(+) 1 file changed, 7 insertions(+)

View File

@ -1,7 +1,7 @@
From 6760cce5b59eeb2ba9b96f43626221df0128a285 Mon Sep 17 00:00:00 2001 From ecef7c131618bbd9c559924ecae55764089db0dd Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 16:16:24 +0200 Date: Tue, 18 Jul 2023 14:01:55 +0200
Subject: [PATCH 4/6] kmod: Add pkgconfig file with kmod compile time Subject: [PATCH 4/9] kmod: Add pkgconfig file with kmod compile time
configuration configuration
Show distconfdir (where system configuration files are searched/to be Show distconfdir (where system configuration files are searched/to be
@ -9,10 +9,8 @@ installed), sysconfdir (where user configuration files are searched),
module compressions, and module signatures supported. module compressions, and module signatures supported.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- Link: https://lore.kernel.org/r/468b3f572d3b84f25bb53ec8fcb15ed4871914d4.1689681454.git.msuchanek@suse.de
v2: mention module signature in commit message Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
v3: add sysconfdir
v5: add distconfdir, switch to pkgconfig
--- ---
Makefile.am | 2 +- Makefile.am | 2 +-
configure.ac | 11 +++++++++++ configure.ac | 11 +++++++++++

View File

@ -43,8 +43,11 @@ Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: configure-Detect-openssl-sm3-support.patch Patch7: configure-Detect-openssl-sm3-support.patch
Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch
Patch9: usr-lib-modprobe.patch Patch9: usr-lib-modprobe.patch
Patch14: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch Patch10: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch Patch11: tools-depmod-fix-Walloc-size.patch
Patch12: libkmod-remove-pkcs7-obj_to_hash_algo.patch
Patch13: usr-lib-modules.patch
Patch14: configure-Check-that-provided-paths-are-absolute.patch
Patch16: no-stylesheet-download.patch Patch16: no-stylesheet-download.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Dec 6 20:00:12 UTC 2023 - Michal Suchanek <msuchanek@suse.de>
- Add upstream fixes since v31
* tools-depmod-fix-Walloc-size.patch
* libkmod-remove-pkcs7-obj_to_hash_algo.patch
* configure-Check-that-provided-paths-are-absolute.patch
- Refresh usrmerge patches to upstream version (cosmetic change only)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 17 15:34:57 UTC 2023 - Michal Suchanek <msuchanek@suse.de> Tue Oct 17 15:34:57 UTC 2023 - Michal Suchanek <msuchanek@suse.de>

View File

@ -44,8 +44,11 @@ Patch6: 0012-modprobe-print-unsupported-status.patch
Patch7: configure-Detect-openssl-sm3-support.patch Patch7: configure-Detect-openssl-sm3-support.patch
Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch Patch8: man-depmod.d-Fix-incorrect-usr-lib-search-path.patch
Patch9: usr-lib-modprobe.patch Patch9: usr-lib-modprobe.patch
Patch14: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch Patch10: kmod-Add-pkgconfig-file-with-kmod-compile-time-confi.patch
Patch15: usr-lib-modules.patch Patch11: tools-depmod-fix-Walloc-size.patch
Patch12: libkmod-remove-pkcs7-obj_to_hash_algo.patch
Patch13: usr-lib-modules.patch
Patch14: configure-Check-that-provided-paths-are-absolute.patch
Patch16: no-stylesheet-download.patch Patch16: no-stylesheet-download.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake

View File

@ -0,0 +1,150 @@
From 510c8b7f7455c6613dd1706e5e41ec7b09cf6703 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Date: Sun, 29 Oct 2023 03:03:19 +0200
Subject: [PATCH 6/9] libkmod: remove pkcs7 obj_to_hash_algo()
Switch to using OBJ_obj2txt() to calculate and print the pkcs7
signature hash name. This eliminates the need to duplicate libcrypto
NID to name mapping, detect SM3 openssl compile-time support, and
enables using any hashes that openssl and kernel know about. For
example SHA3 are being added for v6.7 and with this patch are
automatically supported.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Link: https://lore.kernel.org/r/20231029010319.157390-1-dimitri.ledkov@canonical.com
---
configure.ac | 7 -----
libkmod/libkmod-signature.c | 59 +++++++++++++------------------------
2 files changed, 20 insertions(+), 46 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7bf8d78ca747..a6b8fa0308b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,13 +133,6 @@ AC_ARG_WITH([openssl],
AS_IF([test "x$with_openssl" != "xno"], [
PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0], [LIBS="$LIBS $libcrypto_LIBS"])
AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <openssl/ssl.h>
- int nid = NID_sm3;]])], [
- AC_MSG_NOTICE([openssl supports sm3])
- ], [
- AC_MSG_NOTICE([openssl sm3 support not detected])
- CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SM3"
- ])
module_signatures="PKCS7 $module_signatures"
], [
AC_MSG_NOTICE([openssl support not requested])
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index b749a818f994..80f6447bcea0 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -127,6 +127,7 @@ struct pkcs7_private {
PKCS7 *pkcs7;
unsigned char *key_id;
BIGNUM *sno;
+ char *hash_algo;
};
static void pkcs7_free(void *s)
@@ -137,42 +138,11 @@ static void pkcs7_free(void *s)
PKCS7_free(pvt->pkcs7);
BN_free(pvt->sno);
free(pvt->key_id);
+ free(pvt->hash_algo);
free(pvt);
si->private = NULL;
}
-static int obj_to_hash_algo(const ASN1_OBJECT *o)
-{
- int nid;
-
- nid = OBJ_obj2nid(o);
- switch (nid) {
- case NID_md4:
- return PKEY_HASH_MD4;
- case NID_md5:
- return PKEY_HASH_MD5;
- case NID_sha1:
- return PKEY_HASH_SHA1;
- case NID_ripemd160:
- return PKEY_HASH_RIPE_MD_160;
- case NID_sha256:
- return PKEY_HASH_SHA256;
- case NID_sha384:
- return PKEY_HASH_SHA384;
- case NID_sha512:
- return PKEY_HASH_SHA512;
- case NID_sha224:
- return PKEY_HASH_SHA224;
-# ifndef OPENSSL_NO_SM3
- case NID_sm3:
- return PKEY_HASH_SM3;
-# endif
- default:
- return -1;
- }
- return -1;
-}
-
static const char *x509_name_to_str(X509_NAME *name)
{
int i;
@@ -219,7 +189,8 @@ static bool fill_pkcs7(const char *mem, off_t size,
unsigned char *key_id_str;
struct pkcs7_private *pvt;
const char *issuer_str;
- int hash_algo;
+ char *hash_algo;
+ int hash_algo_len;
size -= sig_len;
pkcs7_raw = mem + size;
@@ -278,27 +249,37 @@ static bool fill_pkcs7(const char *mem, off_t size,
X509_ALGOR_get0(&o, NULL, NULL, dig_alg);
- hash_algo = obj_to_hash_algo(o);
- if (hash_algo < 0)
+ // Use OBJ_obj2txt to calculate string length
+ hash_algo_len = OBJ_obj2txt(NULL, 0, o, 0);
+ if (hash_algo_len < 0)
goto err3;
- sig_info->hash_algo = pkey_hash_algo[hash_algo];
- // hash algo has not been recognized
- if (sig_info->hash_algo == NULL)
+ hash_algo = malloc(hash_algo_len + 1);
+ if (hash_algo == NULL)
goto err3;
+ hash_algo_len = OBJ_obj2txt(hash_algo, hash_algo_len + 1, o, 0);
+ if (hash_algo_len < 0)
+ goto err4;
+
+ // Assign libcrypto hash algo string or number
+ sig_info->hash_algo = hash_algo;
+
sig_info->id_type = pkey_id_type[modsig->id_type];
pvt = malloc(sizeof(*pvt));
if (pvt == NULL)
- goto err3;
+ goto err4;
pvt->pkcs7 = pkcs7;
pvt->key_id = key_id_str;
pvt->sno = sno_bn;
+ pvt->hash_algo = hash_algo;
sig_info->private = pvt;
sig_info->free = pkcs7_free;
return true;
+err4:
+ free(hash_algo);
err3:
free(key_id_str);
err2:
--
2.42.0

View File

@ -1,14 +1,14 @@
From 7bf3543e3cc24dfc9ffca93d0469a5e0e60f8f29 Mon Sep 17 00:00:00 2001 From 4e7effbdc00307d0d1e83115e0d00cc75aae5cc6 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 30 Jun 2023 10:56:31 +0200 Date: Tue, 18 Jul 2023 14:01:53 +0200
Subject: [PATCH 1/7] man/depmod.d: Fix incorrect /usr/lib search path Subject: [PATCH 2/9] man/depmod.d: Fix incorrect /usr/lib search path
depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is depmod searches /lib/depmod.d but the man page says /usr/lib/depmod.d is
searched. Align the documentation with the code. searched. Align the documentation with the code.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- Link: https://lore.kernel.org/r/9c5a6356b1a111eb6e17ddb110494b7f1d1b44c0.1689681454.git.msuchanek@suse.de
v2: Fix commit message typo Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
--- ---
man/depmod.d.xml | 2 +- man/depmod.d.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
@ -27,5 +27,5 @@ index 76548e92a312..8d3d821cddc8 100644
<para><filename>/run/depmod.d/*.conf</filename></para> <para><filename>/run/depmod.d/*.conf</filename></para>
<para><filename>/etc/depmod.d/*.conf</filename></para> <para><filename>/etc/depmod.d/*.conf</filename></para>
-- --
2.41.0 2.42.0

View File

@ -1,7 +1,7 @@
From b46c23e46ad9b19d74362eb3528404293bb03d12 Mon Sep 17 00:00:00 2001 From 11979d01f72a0da574b795ad3029a52706c16f6d Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 6 Sep 2021 14:52:35 +0200 Date: Mon, 6 Sep 2021 14:52:35 +0200
Subject: [PATCH 5/7] Do not download the docbook stylesheet during build, use Subject: [PATCH 9/9] Do not download the docbook stylesheet during build, use
local copy instead. local copy instead.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
@ -20,5 +20,5 @@ index f550091a216a..a8ddb8bfd0ed 100644
- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl - - http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
+ /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl - + /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl -
-- --
2.41.0 2.42.0

View File

@ -0,0 +1,73 @@
From 3af2f475b0b729f20279f2ce488cc9f727f0b763 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 5 Nov 2023 22:02:25 +0000
Subject: [PATCH 5/9] tools: depmod: fix -Walloc-size
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
tools/depmod.c:192:14: warning: allocation of insufficient size 1 for type struct index_node with size 1048 [-Walloc-size]
tools/depmod.c:255:11: warning: allocation of insufficient size 1 for type struct index_value with size 16 [-Walloc-size]
tools/depmod.c:286:35: warning: allocation of insufficient size 1 for type struct index_node with size 1048 [-Walloc-size]
tools/depmod.c:315:44: warning: allocation of insufficient size 1 for type struct index_node with size 1048 [-Walloc-size]
```
The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```
So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
doing anything wrong.
Signed-off-by: Sam James <sam@gentoo.org>
---
tools/depmod.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/depmod.c b/tools/depmod.c
index 630fef9c8fb0..ab8513b21526 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -190,7 +190,7 @@ static struct index_node *index_create(void)
{
struct index_node *node;
- node = NOFAIL(calloc(sizeof(struct index_node), 1));
+ node = NOFAIL(calloc(1, sizeof(struct index_node)));
node->prefix = NOFAIL(strdup(""));
node->first = INDEX_CHILDMAX;
@@ -253,7 +253,7 @@ static int index_add_value(struct index_value **values,
values = &(*values)->next;
len = strlen(value);
- v = NOFAIL(calloc(sizeof(struct index_value) + len + 1, 1));
+ v = NOFAIL(calloc(1, sizeof(struct index_value) + len + 1));
v->next = *values;
v->priority = priority;
memcpy(v->value, value, len + 1);
@@ -284,7 +284,7 @@ static int index_insert(struct index_node *node, const char *key,
struct index_node *n;
/* New child is copy of node with prefix[j+1..N] */
- n = NOFAIL(calloc(sizeof(struct index_node), 1));
+ n = NOFAIL(calloc(1, sizeof(struct index_node)));
memcpy(n, node, sizeof(struct index_node));
n->prefix = NOFAIL(strdup(&prefix[j+1]));
@@ -313,7 +313,7 @@ static int index_insert(struct index_node *node, const char *key,
node->first = ch;
if (ch > node->last)
node->last = ch;
- node->children[ch] = NOFAIL(calloc(sizeof(struct index_node), 1));
+ node->children[ch] = NOFAIL(calloc(1, sizeof(struct index_node)));
child = node->children[ch];
child->prefix = NOFAIL(strdup(&key[i+1]));
--
2.42.0

View File

@ -1,7 +1,7 @@
From 88f6d08df8082f4dbe2407bef59de85290360e88 Mon Sep 17 00:00:00 2001 From 8463809f8a29b254b2cab2ce755641bc690f07c9 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 12 Jan 2021 16:54:46 +0100 Date: Tue, 18 Jul 2023 14:01:54 +0200
Subject: [PATCH 2/7] libkmod, depmod: Load modprobe.d, depmod.d from Subject: [PATCH 3/9] libkmod, depmod: Load modprobe.d, depmod.d from
${prefix}/lib. ${prefix}/lib.
There is an ongoing effort to limit use of files outside of /usr (or There is an ongoing effort to limit use of files outside of /usr (or
@ -16,10 +16,8 @@ and only one configuration file of the same name is loaded from any of
the search directories. the search directories.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- Link: https://lore.kernel.org/r/a290343ce32e2a3c25b134e4f27c13b26e06c9e0.1689681454.git.msuchanek@suse.de
v2: Fix commit message typo Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
v3: Fix modprobe.d path list in code comment
v5: Add distconfdir
--- ---
Makefile.am | 1 + Makefile.am | 1 +
configure.ac | 5 +++++ configure.ac | 5 +++++
@ -31,7 +29,7 @@ v5: Add distconfdir
7 files changed, 20 insertions(+), 5 deletions(-) 7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Makefile.am b/Makefile.am diff --git a/Makefile.am b/Makefile.am
index ac47ea625e71..a03846d02b9c 100644 index 5b7abfe6a20e..e6630a36e18c 100644
--- a/Makefile.am --- a/Makefile.am
+++ b/Makefile.am +++ b/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \ @@ -19,6 +19,7 @@ AM_CPPFLAGS = \
@ -43,10 +41,10 @@ index ac47ea625e71..a03846d02b9c 100644
AM_CFLAGS = $(OUR_CFLAGS) AM_CFLAGS = $(OUR_CFLAGS)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index a74d3baf0a42..18206ccdb607 100644 index e5bceeaa1722..fd88d1fbdbf7 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -78,6 +78,10 @@ AC_COMPILE_IFELSE( @@ -79,6 +79,10 @@ AC_COMPILE_IFELSE(
# --with- # --with-
##################################################################### #####################################################################
@ -57,7 +55,7 @@ index a74d3baf0a42..18206ccdb607 100644
AC_ARG_WITH([rootlibdir], AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
[], [with_rootlibdir=$libdir]) [], [with_rootlibdir=$libdir])
@@ -303,6 +307,7 @@ AC_MSG_RESULT([ @@ -313,6 +317,7 @@ AC_MSG_RESULT([
prefix: ${prefix} prefix: ${prefix}
sysconfdir: ${sysconfdir} sysconfdir: ${sysconfdir}
@ -66,10 +64,10 @@ index a74d3baf0a42..18206ccdb607 100644
rootlibdir: ${rootlibdir} rootlibdir: ${rootlibdir}
includedir: ${includedir} includedir: ${includedir}
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 7c2b889d713e..bc05a1873edf 100644 index 1b8773cdf452..57fac1cb9f7b 100644
--- a/libkmod/libkmod.c --- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c +++ b/libkmod/libkmod.c
@@ -65,6 +65,7 @@ static const char *default_config_paths[] = { @@ -65,6 +65,7 @@ static const char *const default_config_paths[] = {
SYSCONFDIR "/modprobe.d", SYSCONFDIR "/modprobe.d",
"/run/modprobe.d", "/run/modprobe.d",
"/usr/local/lib/modprobe.d", "/usr/local/lib/modprobe.d",
@ -77,7 +75,7 @@ index 7c2b889d713e..bc05a1873edf 100644
"/lib/modprobe.d", "/lib/modprobe.d",
NULL NULL
}; };
@@ -237,9 +238,9 @@ static char *get_kernel_release(const char *dirname) @@ -272,9 +273,9 @@ static enum kmod_file_compression_type get_kernel_compression(struct kmod_ctx *c
* to load from user-defined configuration parameters such as * to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If NULL * alias, blacklists, commands (install, remove). If NULL
* defaults to /etc/modprobe.d, /run/modprobe.d, * defaults to /etc/modprobe.d, /run/modprobe.d,
@ -136,10 +134,10 @@ index 0ab3e9110a7e..2bf6537f07e6 100644
<para><filename>/run/modprobe.d/*.conf</filename></para> <para><filename>/run/modprobe.d/*.conf</filename></para>
<para><filename>/etc/modprobe.d/*.conf</filename></para> <para><filename>/etc/modprobe.d/*.conf</filename></para>
diff --git a/tools/depmod.c b/tools/depmod.c diff --git a/tools/depmod.c b/tools/depmod.c
index 553659755194..aada5ac57902 100644 index 1d1d41db860f..630fef9c8fb0 100644
--- a/tools/depmod.c --- a/tools/depmod.c
+++ b/tools/depmod.c +++ b/tools/depmod.c
@@ -54,6 +54,7 @@ static const char *default_cfg_paths[] = { @@ -54,6 +54,7 @@ static const char *const default_cfg_paths[] = {
SYSCONFDIR "/depmod.d", SYSCONFDIR "/depmod.d",
"/run/depmod.d", "/run/depmod.d",
"/usr/local/lib/depmod.d", "/usr/local/lib/depmod.d",
@ -148,5 +146,5 @@ index 553659755194..aada5ac57902 100644
NULL NULL
}; };
-- --
2.41.0 2.42.0

View File

@ -1,7 +1,7 @@
From 4ad85461d27d240efcb4922eb5810a65356a8d6a Mon Sep 17 00:00:00 2001 From 9d1fb317c8dbf2b834b3d0efb34208eb8fb790fb Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de> From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 26 May 2023 10:38:05 +0200 Date: Fri, 10 Nov 2023 13:13:54 +0100
Subject: [PATCH 5/6] libkmod, depmod, modprobe: Make directory for kernel Subject: [PATCH 7/9] libkmod, depmod, modprobe: Make directory for kernel
modules configurable modules configurable
Now that modprobe.d is searched under ${prefix}/lib, allow a complete Now that modprobe.d is searched under ${prefix}/lib, allow a complete
@ -14,9 +14,8 @@ With this distributions that do not want to ship files in /lib can also
move kernel modules to /usr while others can keep them in /lib. move kernel modules to /usr while others can keep them in /lib.
Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
--- Link: https://lore.kernel.org/r/a3765f4e8ae3ce29c0847a0132d4a8d51ad040a9.1699618135.git.msuchanek@suse.de
v4: Make the whole path configurable Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
v5: More verbose commit message
--- ---
Makefile.am | 3 +- Makefile.am | 3 +-
configure.ac | 7 ++ configure.ac | 7 ++
@ -60,7 +59,7 @@ index 2a54c25bd631..4062d81227df 100644
build-module-playground: build-module-playground:
$(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \ $(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 7bf8d78ca747..d282fef9a08c 100644 index a6b8fa0308b6..d6da5ee9ae9a 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -91,6 +91,12 @@ AC_ARG_WITH([rootlibdir], @@ -91,6 +91,12 @@ AC_ARG_WITH([rootlibdir],
@ -76,7 +75,7 @@ index 7bf8d78ca747..d282fef9a08c 100644
AC_ARG_WITH([zstd], AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]), AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
[], [with_zstd=no]) [], [with_zstd=no])
@@ -326,6 +332,7 @@ AC_MSG_RESULT([ @@ -319,6 +325,7 @@ AC_MSG_RESULT([
$PACKAGE $VERSION $PACKAGE $VERSION
======= =======
@ -85,7 +84,7 @@ index 7bf8d78ca747..d282fef9a08c 100644
sysconfdir: ${sysconfdir} sysconfdir: ${sysconfdir}
distconfdir: ${distconfdir} distconfdir: ${distconfdir}
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 57fac1cb9f7b..4489cbd04bf7 100644 index 57fac1cb9f7b..213b42482fb6 100644
--- a/libkmod/libkmod.c --- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c +++ b/libkmod/libkmod.c
@@ -210,7 +210,7 @@ static int log_priority(const char *priority) @@ -210,7 +210,7 @@ static int log_priority(const char *priority)
@ -102,7 +101,7 @@ index 57fac1cb9f7b..4489cbd04bf7 100644
* kmod_new: * kmod_new:
* @dirname: what to consider as linux module's directory, if NULL * @dirname: what to consider as linux module's directory, if NULL
- * defaults to /lib/modules/`uname -r`. If it's relative, - * defaults to /lib/modules/`uname -r`. If it's relative,
+ * defaults to ${module_prefix}/lib/modules/`uname -r`. If it's relative, + * defaults to $MODULE_DIRECTORY/`uname -r`. If it's relative,
* it's treated as relative to the current working directory. * it's treated as relative to the current working directory.
* Otherwise, give an absolute dirname. * Otherwise, give an absolute dirname.
* @config_paths: ordered array of paths (directories or files) where * @config_paths: ordered array of paths (directories or files) where
@ -492,7 +491,7 @@ index 56e73609f204..c77c4bbc04eb 100644
return EXIT_FAILURE; return EXIT_FAILURE;
} }
diff --git a/tools/depmod.c b/tools/depmod.c diff --git a/tools/depmod.c b/tools/depmod.c
index 630fef9c8fb0..7f7c4b74d216 100644 index ab8513b21526..43fc354afb09 100644
--- a/tools/depmod.c --- a/tools/depmod.c
+++ b/tools/depmod.c +++ b/tools/depmod.c
@@ -911,7 +911,7 @@ struct vertex; @@ -911,7 +911,7 @@ struct vertex;