Deprecated exec_usermodehelper, enhance call_usermodehelper
Subsystems (8)
PATCH 1/1 Deprecated exec_usermodehelper, enhance call_usermodehelper
Linus, please apply.
Adds a wait flag to call_usermodehelper, which makes it double-fork off keventd (so it can wait), and return the child's exit status.
Once the three exec_usermodehelper pieces are converted, we can get rid of the horrible (probably buggy) "try to clean up this process to look like init" code, and the sun will come out, birds will start singing, hackers will run joyfully through the streets, etc.
Thanks for the feedback!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: call_usermodehelper can wait for us: exec_usermodehelper sucks
Author: Rusty Russell
Status: Tested on 2.5.54
D: Urban Widmark points out that modprobe calls system() in many
D: configurations, which drops privs since request_module() doesn't
D: doesn't set ruid and rguid.
D:
D: Use a known-clean environment (as call_usermodehelper does).
D: Deprecate exec_usermodehelper, since it's probably buggy, maybe
D: exploitable.
include/linux/kmod.h +3 -2
@@ -21,6 +21,7 @@#include <linux/config.h> #include <linux/errno.h> +#include <linux/compiler.h> #ifdef CONFIG_KMOD extern int request_module (const char * name);
@@ -29,8 +30,8 @@ static inline int request_module(const c#endif #define try_then_request_module (x, mod) ((x) ?: request_module(mod), (x)) -extern int exec_usermodehelper (char *program_path,char *argv[],char *envp[]); -extern int call_usermodehelper (char *path,char *argv[],char *envp[]); +extern int exec_usermodehelper (char *program_path,char *argv[],char *envp[])__deprecated ; +extern int call_usermodehelper (char *path,char *argv[],char *envp[],int wait);#ifdef CONFIG_HOTPLUG extern char hotplug_path [];
kernel/kmod.c +76 -91
251 lines not on this page · raw message
drivers/acpi/thermal.c +1 -1
@@ -431,7 +431,7 @@ acpi_thermal_call_usermode ( envp[0 ] ="HOME=/" ; envp[1 ] ="PATH=/sbin:/bin:/usr/sbin:/usr/bin" ; -call_usermodehelper (argv[0 ], argv, envp); +call_usermodehelper (argv[0 ], argv, envp,0 );return_VALUE (0 ); }
drivers/base/hotplug.c +1 -1
@@ -114,7 +114,7 @@ static int do_hotplug (struct device *depr_debug ("%s: %s %s %s %s %s %s\n" , __FUNCTION__, argv [0 ], argv[1 ], envp[0 ], envp[1 ], envp[2 ], envp[3 ]); - retval =call_usermodehelper (argv [0 ], argv, envp); + retval =call_usermodehelper (argv [0 ], argv, envp,0 );if (retval)pr_debug ("%s - call_usermodehelper returned %d\n" , __FUNCTION__, retval);
drivers/ieee1394/nodemgr.c +1 -1
@@ -786,7 +786,7 @@ static void nodemgr_call_policy(char *ve#ifdef CONFIG_IEEE1394_VERBOSEDEBUG HPSB_DEBUG ("NodeMgr: %s %s %016Lx" , argv[0 ], verb, (long long unsigned )ud->ne->guid);#endif - value =call_usermodehelper (argv[0 ], argv, envp); + value =call_usermodehelper (argv[0 ], argv, envp,0 );kfree (buf);kfree (envp);if (value !=0 )
drivers/input/input.c +1 -1
@@ -383,7 +383,7 @@ static void input_call_hotplug(char *ver argv[0], argv[1], envp[0], envp[1], envp[2], envp[3], envp[4]);#endif - value =call_usermodehelper (argv [0 ], argv, envp); + value =call_usermodehelper (argv [0 ], argv, envp,0 );kfree (buf);kfree (envp);
drivers/isdn/hardware/eicon/divasmain.c +1 -1
@@ -263,7 +263,7 @@ static void diva_adapter_trapped(void *c pdpc->card_failed =0 ; argv[2 ] = &adapter[0 ]; - ret =call_usermodehelper (argv[0 ], argv, envp); + ret =call_usermodehelper (argv[0 ], argv, envp,0 );if (ret) { printk(KERN_ERR
drivers/pnp/pnpbios/core.c +1 -1
@@ -602,7 +602,7 @@ static int pnp_dock_event(int dock, stru info->location_id, info->serial, info->capabilities); envp[i] =0 ; - value =call_usermodehelper (argv [0 ], argv, envp); + value =call_usermodehelper (argv [0 ], argv, envp,0 );kfree (buf);kfree (envp);return 0 ;
net/bluetooth/hci_core.c +1 -1
@@ -114,7 +114,7 @@ static int hci_run_hotplug(char *dev, ch envp[3 ] = astr; envp[4 ] =NULL ; -return call_usermodehelper (argv[0 ], argv, envp); +return call_usermodehelper (argv[0 ], argv, envp,0 ); }#else #define hci_run_hotplug(A...)
net/core/dev.c +1 -1
@@ -2918,6 +2918,6 @@ static int net_run_sbin_hotplug(struct n envp [i++] = action_str; envp [i] =0 ; - return call_usermodehelper(argv [0], argv, envp); + return call_usermodehelper(argv [0], argv, envp, 0); }#endif
Quoted 2 lines · Rusty Russell
Linus, please apply.
Nope, I really don't want to deprecate any more interfaces while my build is still so noisy about the _existing_ deprecated stuff.
The noisiness of the current build is quite distracting, and likely makes people just ignore potentially valid warnings simply because there are too many of them-
Linus
In message <[email protected]> you wri te:
Quoted 7 lines · Rusty Russell
Quoted 2 lines
Linus, please apply.
Nope, I really don't want to deprecate any more interfaces while my build is still so noisy about the _existing_ deprecated stuff.
OK. I'll work with the various authors to actually remove all 3 users in the tree, then submit a patch to rip it out.
Quoted 3 lines
The noisiness of the current build is quite distracting, and likely makes people just ignore potentially valid warnings simply because there are too many of them-
Damn. I guess you don't want this patch then?
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Deprecate cli/sti/restore_flags etc.
Author: Rusty Russell
Status: Tested on 2.5.54
D: These functions have long been deprecated: they don't exist on SMP.
D: Mark them deprecated.
include/linux/interrupt.h +24 -6
@@ -5,6 +5,7 @@#include <linux/config.h> #include <linux/linkage.h> #include <linux/bitops.h> +#include <linux/compiler.h> #include <asm/atomic.h> #include <asm/hardirq.h> #include <asm/ptrace.h>
@@ -28,12 +29,29 @@ extern void free_irq(unsigned int, void/* * Temporary defines for UP kernels, until all code gets fixed. */ -#if !CONFIG_SMP -# define cli () local_irq_disable() -# define sti () local_irq_enable() -# define save_flags (x) local_save_flags(x) -# define restore_flags (x) local_irq_restore(x) -# define save_and_cli (x) local_irq_save(x) +#ifndef CONFIG_SMP +static inline void __deprecated cli (void ) +{ +local_irq_disable (); +} +static inline void __deprecated sti (void ) +{ +local_irq_enable (); +} +static inline void __deprecated deprecated_save_flags (unsigned long *flags) +{ +local_save_flags (*flags); +} +static inline void __deprecated restore_flags (unsigned long flags) +{ +local_irq_restore (flags); +} +static inline void __deprecated deprecated_save_and_cli (unsigned long *flags) +{ +local_irq_save (*flags); +} +# define save_flags (x) deprecated_save_flags(&(x)) +# define save_and_cli (x) deprecated_save_and_cli(&(x))#endif