From patchwork Wed Mar 28 06:31:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 149155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 91D53B6F62 for ; Wed, 28 Mar 2012 17:32:05 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCmQC-0007qT-5j; Wed, 28 Mar 2012 06:31:52 +0000 Received: from www262.sakura.ne.jp ([202.181.97.72]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCmQ8-0007qJ-WB for kernel-team@lists.ubuntu.com; Wed, 28 Mar 2012 06:31:49 +0000 Received: from www262.sakura.ne.jp (ksav31.sakura.ne.jp [210.224.165.211]) by www262.sakura.ne.jp (8.14.3/8.14.3) with ESMTP id q2S6ViPU057613; Wed, 28 Mar 2012 15:31:44 +0900 (JST) (envelope-from from-ubuntu@i-love.sakura.ne.jp) X-Nat-Received: from [202.181.97.72]:52775 [ident-empty] by smtp-proxy.isp with TPROXY id 1332916304.28803 Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.14.3/8.14.3) with ESMTP id q2S6VhAj057610; Wed, 28 Mar 2012 15:31:43 +0900 (JST) (envelope-from from-ubuntu@i-love.sakura.ne.jp) Received: (from i-love@localhost) by www262.sakura.ne.jp (8.14.3/8.14.3/Submit) id q2S6VhIi057609; Wed, 28 Mar 2012 15:31:43 +0900 (JST) (envelope-from from-ubuntu@i-love.sakura.ne.jp) Message-Id: <201203280631.q2S6VhIi057609@www262.sakura.ne.jp> X-Authentication-Warning: www262.sakura.ne.jp: i-love set sender to from-ubuntu@i-love.sakura.ne.jp using -f Subject: Re: [Acked] [Lucid PATCH 00/10] Backport killable request_module() From: Tetsuo Handa To: apw@canonical.com MIME-Version: 1.0 Date: Wed, 28 Mar 2012 15:31:43 +0900 References: <1332784903-75063-1-git-send-email-tim.gardner@canonical.com> <20120327130111.GA9088@localhost> In-Reply-To: <20120327130111.GA9088@localhost> X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.44/RELEASE, bases: 28032012 #7470186, status: clean Cc: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@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;