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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81n281ns-s8on-rsrn-pp61-q28pn42ns531@vanv.qr>
Date:   Tue, 18 Jul 2023 11:41:32 +0200 (CEST)
From:   Jan Engelhardt <jengelh@...i.de>
To:     Michal Suchánek <msuchanek@...e.de>
cc:     linux-modules@...r.kernel.org, Takashi Iwai <tiwai@...e.com>,
        Lucas De Marchi <lucas.de.marchi@...il.com>,
        Michal Koutný <mkoutny@...e.com>,
        Jiri Slaby <jslaby@...e.com>,
        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: Re: [PATCH kmod v4 4/4] libkmod, depmod, modprobe: Make directory
 for kernel modules configurable


On Tuesday 2023-07-18 10:43, Michal Suchánek wrote:
>> >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.
>> 
>> This patch breaks kernel builds/installation / bisecting [when the
>> system has a kmod ./configure'd --with-module-directory=/usr/lib/modules]
>
>It might be nice to provide backwads compatibility with earlier
>configurations.
>
>However, if it comes at the cost of making the implementation more
>complex and future maintenance more difficult it might not be such a
>great idea. So far I have not seen a proposal how to do it nicely.



diff --git a/configure.ac b/configure.ac
index a195c8e..7fde927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,11 +84,7 @@ AC_ARG_WITH([rootlibdir],
         [], [with_rootlibdir=$libdir])
 AC_SUBST([rootlibdir], [$with_rootlibdir])
 
-# Ideally this would be $prefix/lib/modules but default to /lib/modules for compatibility with earlier versions
-AC_ARG_WITH([module_directory],
-        AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules - typically '/lib/modules' or '${prefix}/lib/modules']),
-        [], [with_module_directory=/lib/modules])
-AC_SUBST([module_directory], [$with_module_directory])
+AC_SUBST([module_directory], [/lib/modules])
 
 AC_ARG_WITH([zstd],
 	AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
index 4a4af58..e2f9c95 100644
--- a/libkmod/libkmod-internal.h
+++ b/libkmod/libkmod-internal.h
@@ -199,3 +199,5 @@ void kmod_module_signature_info_free(struct kmod_signature_info *sig_info) __att
 
 /* libkmod-builtin.c */
 ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname, char ***modinfo) __attribute__((nonnull(1, 2, 3)));
+
+extern const char *dirname_default_prefix;
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index d2ed874..b426cde 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -209,7 +209,7 @@ static int log_priority(const char *priority)
 	return 0;
 }
 
-static const char *dirname_default_prefix = MODULE_DIRECTORY;
+const char *dirname_default_prefix = MODULE_DIRECTORY;
 
 static char *get_kernel_release(const char *dirname)
 {
diff --git a/tools/depmod.c b/tools/depmod.c
index 22bc1d8..929060f 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -65,6 +65,7 @@ static const struct option cmdopts[] = {
 	{ "quick", no_argument, 0, 'A' },
 	{ "basedir", required_argument, 0, 'b' },
 	{ "outdir", required_argument, 0, 'o' },
+	{ "modulesdir", required_argument, 0, 'M' },
 	{ "config", required_argument, 0, 'C' },
 	{ "symvers", required_argument, 0, 'E' },
 	{ "filesyms", required_argument, 0, 'F' },
@@ -2943,6 +2944,9 @@ static int do_depmod(int argc, char *argv[])
 				free(out_root);
 			out_root = path_make_absolute_cwd(optarg);
 			break;
+		case 'M':
+			dirname_default_prefix = optarg;
+			break;
 		case 'C': {
 			size_t bytes = sizeof(char *) * (n_config_paths + 2);
 			void *tmp = realloc(config_paths, bytes);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ