patch-2.4.0-test11 linux/kernel/kmod.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/fork.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test10/linux/kernel/kmod.c linux/kernel/kmod.c
@@ -16,17 +16,13 @@
 #define __KERNEL_SYSCALLS__
 
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/unistd.h>
 #include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
-/*
-	modprobe_path is set via /proc/sys.
-*/
-char modprobe_path[256] = "/sbin/modprobe";
-
 extern int max_threads;
 
 static inline void
@@ -118,7 +114,8 @@
 	}
 
 	/* Give kmod all effective privileges.. */
-	current->uid = current->euid = current->fsuid = 0;
+	current->euid = current->fsuid = 0;
+	current->egid = current->fsgid = 0;
 	cap_set_full(current->cap_effective);
 
 	/* Allow execve args to be in kernel space. */
@@ -130,10 +127,17 @@
 	return 0;
 }
 
+#ifdef CONFIG_KMOD
+
+/*
+	modprobe_path is set via /proc/sys.
+*/
+char modprobe_path[256] = "/sbin/modprobe";
+
 static int exec_modprobe(void * module_name)
 {
 	static char * envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
-	char *argv[] = { modprobe_path, "-s", "-k", (char*)module_name, NULL };
+	char *argv[] = { modprobe_path, "-s", "-k", "--", (char*)module_name, NULL };
 	int ret;
 
 	ret = exec_usermodehelper(modprobe_path, argv, envp);
@@ -226,6 +230,7 @@
 	}
 	return 0;
 }
+#endif /* CONFIG_KMOD */
 
 
 #ifdef CONFIG_HOTPLUG
@@ -247,6 +252,10 @@
 */
 char hotplug_path[256] = "/sbin/hotplug";
 
+EXPORT_SYMBOL(hotplug_path);
+
+#endif /* CONFIG_HOTPLUG */
+
 
 static int exec_helper (void *arg)
 {
@@ -286,5 +295,10 @@
 	return retval;
 }
 
+EXPORT_SYMBOL(exec_usermodehelper);
+EXPORT_SYMBOL(call_usermodehelper);
+
+#ifdef CONFIG_KMOD
+EXPORT_SYMBOL(request_module);
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)