From patchwork Wed Mar 28 06:31:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Acked,Lucid,00/10] Backport killable request_module() Date: Tue, 27 Mar 2012 20:31:43 -0000 From: Tetsuo Handa X-Patchwork-Id: 149155 Message-Id: <201203280631.q2S6VhIi057609@www262.sakura.ne.jp> To: apw@canonical.com Cc: kernel-team@lists.ubuntu.com Andy Whitcroft wrote: > It should be easy to test, systems should stop booting right if this is wrong. Since we can force recompilation of kernel modules upon ABI bump, we could apply a validator patch (like below untested one) upon next ABI bump (in order to catch forgotten users) and revert it upon some-time-later ABI rebump. diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 9efeae6..1350670 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -48,10 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; struct cred; struct file; -#define UMH_NO_WAIT 0 /* don't wait at all */ -#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ -#define UMH_WAIT_PROC 2 /* wait for the process to complete */ -#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ +#define UMH_NO_WAIT 0x10 /* don't wait at all */ +#define UMH_WAIT_EXEC 0x11 /* wait for the exec, but not the process */ +#define UMH_WAIT_PROC 0x12 /* wait for the process to complete */ +#define UMH_KILLABLE 0x04 /* wait for EXEC/PROC killable */ struct subprocess_info { struct work_struct work; diff --git a/kernel/kmod.c b/kernel/kmod.c index 957a7aa..ecfd3d5 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -483,6 +483,18 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) DECLARE_COMPLETION_ONSTACK(done); int retval = 0; + if (unlikely(wait == -1 || wait == 0 || wait == 1)) { + WARN(1, "Requesting for usermode helper with hardcoded wait " + "flag. Change to use UMH_* symbols and recompile, or " + "this request will fail on Linux 3.4.\n"); + if (wait == -1) + wait = UMH_NO_WAIT; + else if (wait == 0) + wait = UMH_WAIT_EXEC; + else + wait = UMH_WAIT_PROC; + } + helper_lock(); if (sub_info->path[0] == '\0') goto out;