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: <1368159316-31744-3-git-send-email-lucas.de.marchi@gmail.com>
Date:	Fri, 10 May 2013 01:15:16 -0300
From:	Lucas De Marchi <lucas.de.marchi@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Lucas De Marchi <lucas.de.marchi@...il.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH 3/3] init/Kconfig: Add option to set modprobe command

The hard-coded path of modprobe doesn't allow distros to put the binary
in another place without add links from one place to another. For
example, in recent versions of distros like Fedora, Arch and Suse, kmod
is the default tool to load modules and they have to create a link from
modprobe to kmod binary.  kmod relies on argv[0] to know what to do but
in future they want to add commands like "kmod load -- modulename",
which is not possible if the path to the tool to load modules is
hard-coded in kernel.

Moreover, it's already possible to set the path through /proc/sys, but
it would have to be done very early in the boot sequence and on every
boot since modprobe may be called even before / is mounted. In this
scenario booting without and initrd would be more difficult as well.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@...il.com>
---
 init/Kconfig  | 7 +++++++
 kernel/kmod.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 5341d72..72eee1c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1593,6 +1593,13 @@ menuconfig MODULES
 
 if MODULES
 
+config DEFAULT_MODULE_LOAD_BIN
+	string "Default module load binary"
+	default "/sbin/modprobe -q --"
+	help
+	  This option determines the default executable to be called when a
+	  module is requested to be loaded via request_module().
+
 config MODULE_FORCE_LOAD
 	bool "Forced module loading"
 	default n
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 70df90b..1828542 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -67,7 +67,7 @@ static DECLARE_RWSEM(umhelper_sem);
 /*
 	modprobe_path is set via /proc/sys.
 */
-char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe -q --";
+char modprobe_path[KMOD_PATH_LEN] = CONFIG_DEFAULT_MODULE_LOAD_BIN;
 
 static void free_modprobe_argv(struct subprocess_info *info)
 {
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ