Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH 0/1] usermodehelper: use UMH_WAIT_PROC consistently
       [not found]             ` <201202080227.q182RnCp077670@www262.sakura.ne.jp>
@ 2012-02-08 14:03               ` Oleg Nesterov
  2012-02-08 14:04                 ` [Drbd-dev] [PATCH 1/1] " Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2012-02-08 14:03 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: john.johansen, Greg Kroah-Hartman, fhrbata, rusty, apw,
	Michal Januszewski, rientjes, tj, akpm, arjan, Lars Ellenberg

On 02/08, Tetsuo Handa wrote:
>
> Oleg Nesterov wrote:
>
> > Subject: [PATCH 1/5] usermodehelper: kill umh_wait, renumber UMH_* constants
> >
> > No functional changes, preparation.
> >
> > umh_wait doesn't can't be used as a bitmask, and we do not want
> > to add another argument call_usermodehelper_* helpers.
> >
> > Kill this enum and redefine the UMH_* constants.
>
> There are several users that call call_usermodehelper() without using this
> enum. security/tomoyo/load_policy.c is one of such users

... and there are more.

Thanks a lot Tetsuo.

> and there will be some
> in out-of-tree code.

Well, they should be fixed imho.

> Since I think distro kernels want
> to backport this killable request_module() patchset, this patch should not
> change the constants in a way that makes impossible to detect kABI changes.

Good point, but I think the backporter should take care to not break
the KABI. I do not think we should defer the possible cleanups for
the sake of backporting.

It is possible to skip the first patch and add UMH_KILLABLE, just
call_usermodehelper_exec() needs the additional wait != UMH_NO_WAIT
check before testind/clearing UMH_KILLABLE. UMH_NO_WAIT | KILLABLE
is not possible.

>  #define UMH_WAIT_EXEC	 0	/* wait for the exec, but not the process */
>  #define UMH_WAIT_PROC	 1	/* wait for the process to complete */
>  #define UMH_KILLABLE	 2	/* wait for EXEC/PROC killable */
>  #define UMH_NO_WAIT     4	/* don't wait at all */
>
> might be acceptable because we can remap -1 -> UMH_NO_WAIT on
> call_usermodehelper_exec() side.

Yes... but I think it is better to fix the users.

Perhaps we can do something like

	#define UMH_NO_WAIT	0x8000
	#define UMH_WAIT_EXEC	0x8001
	#define UMH_WAIT_	0x8002

and then call_usermodehelper_exec() does

	/* catch the old buggy users */
	BUG_ON(!(wait & 0x8000) || (wait < 0))

In any case. Whatever we do, I think we should fix the current ab-users.

Andrew, could you take this patch? Or should I split this trivial change
by file/maintainer?

Oleg.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Drbd-dev] [PATCH 1/1] usermodehelper: use UMH_WAIT_PROC consistently
  2012-02-08 14:03               ` [Drbd-dev] [PATCH 0/1] usermodehelper: use UMH_WAIT_PROC consistently Oleg Nesterov
@ 2012-02-08 14:04                 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2012-02-08 14:04 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: john.johansen, Greg Kroah-Hartman, fhrbata, rusty, apw,
	Michal Januszewski, rientjes, tj, akpm, arjan, Lars Ellenberg

A few call_usermodehelper() callers use the hardcoded constant
instead of the proper UMH_WAIT_PROC, fix them.

Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 drivers/block/drbd/drbd_nl.c               |    2 +-
 drivers/staging/rtl8187se/r8180_core.c     |    2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c |    4 ++--
 drivers/video/uvesafb.c                    |    2 +-
 security/tomoyo/load_policy.c              |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index af2a250..e407da6 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -179,7 +179,7 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd)
 	dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb);
 
 	drbd_bcast_ev_helper(mdev, cmd);
-	ret = call_usermodehelper(usermode_helper, argv, envp, 1);
+	ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC);
 	if (ret)
 		dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n",
 				usermode_helper, cmd, mb,
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 04c2391..24072f7 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -4144,7 +4144,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
 		argv[0] = RadioPowerPath;
 		argv[2] = NULL;
 
-		call_usermodehelper(RadioPowerPath, argv, envp, 1);
+		call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC);
 	}
 }
 
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index a7fa9aa..f026b71 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -208,7 +208,7 @@ static void dm_check_ac_dc_power(struct net_device *dev)
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
 		return;
-	call_usermodehelper(ac_dc_check_script_path, argv, envp, 1);
+	call_usermodehelper(ac_dc_check_script_path, argv, envp, UMH_WAIT_PROC);
 
 	return;
 };
@@ -2296,7 +2296,7 @@ void dm_CheckRfCtrlGPIO(void *data)
 
 		argv[0] = RadioPowerPath;
 		argv[2] = NULL;
-		call_usermodehelper(RadioPowerPath, argv, envp, 1);
+		call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC);
 	}
 }
 
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index e7f69ef..506d16e 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -121,7 +121,7 @@ static int uvesafb_helper_start(void)
 		NULL,
 	};
 
-	return call_usermodehelper(v86d_path, argv, envp, 1);
+	return call_usermodehelper(v86d_path, argv, envp, UMH_WAIT_PROC);
 }
 
 /*
diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c
index 6797540..078fac0 100644
--- a/security/tomoyo/load_policy.c
+++ b/security/tomoyo/load_policy.c
@@ -102,7 +102,7 @@ void tomoyo_load_policy(const char *filename)
 	envp[0] = "HOME=/";
 	envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
 	envp[2] = NULL;
-	call_usermodehelper(argv[0], argv, envp, 1);
+	call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
 	tomoyo_check_profile();
 }
 
-- 
1.5.5.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-08 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20120202173504.GA25528@redhat.com>
     [not found] ` <201202032254.GCJ30240.SLMOVFFHtJOFOQ@I-love.SAKURA.ne.jp>
     [not found]   ` <20120203151534.GB32503@redhat.com>
     [not found]     ` <201202041426.ICI23458.FFFtOMLOJOVSQH@I-love.SAKURA.ne.jp>
     [not found]       ` <201202051415.JEB43260.SFMJOHLtOFVQOF@I-love.SAKURA.ne.jp>
     [not found]         ` <201202072055.GEC05251.FFMSVHOLOFOQJt@I-love.SAKURA.ne.jp>
     [not found]           ` <20120207171031.GA11215@redhat.com>
     [not found]             ` <201202080227.q182RnCp077670@www262.sakura.ne.jp>
2012-02-08 14:03               ` [Drbd-dev] [PATCH 0/1] usermodehelper: use UMH_WAIT_PROC consistently Oleg Nesterov
2012-02-08 14:04                 ` [Drbd-dev] [PATCH 1/1] " Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox