FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 03-26-2012, 01:28 AM
Tim Gardner
 
Default usermodehelper: kill umh_wait, renumber UMH_* constants

From: Oleg Nesterov <oleg@redhat.com>

BugLink: http://bugs.launchpad.net/bugs/963685

No functional changes. It is not sane to use UMH_KILLABLE with enum
umh_wait, but obviously we do not want another argument in
call_usermodehelper_* helpers. Kill this enum, use the plain int.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 9d944ef32e83405a07376f112e9f02161d3e9731)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
include/linux/kmod.h | 18 +++++++-----------
kernel/kmod.c | 8 ++------
security/keys/request_key.c | 2 +-
3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 846f569..0f2c5a6 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -48,12 +48,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
struct cred;
struct file;

-enum umh_wait {
- UMH_NO_WAIT = -1, /* don't wait at all */
- UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
- UMH_WAIT_PROC = 1, /* wait for the process to complete */
-};
-
+#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 */

struct subprocess_info {
@@ -62,7 +59,7 @@ struct subprocess_info {
char *path;
char **argv;
char **envp;
- enum umh_wait wait;
+ int wait;
int retval;
int (*init)(struct subprocess_info *info, struct cred *new);
void (*cleanup)(struct subprocess_info *info);
@@ -80,7 +77,7 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
void *data);

/* Actually execute the sub-process */
-int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
+int call_usermodehelper_exec(struct subprocess_info *info, int wait);

/* Free the subprocess_info. This is only needed if you're not going
to call call_usermodehelper_exec */
@@ -89,8 +86,7 @@ void call_usermodehelper_freeinfo(struct subprocess_info *info);
extern void populate_rootfs_wait(void);

static inline int
-call_usermodehelper_fns(char *path, char **argv, char **envp,
- enum umh_wait wait,
+call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
int (*init)(struct subprocess_info *info, struct cred *new),
void (*cleanup)(struct subprocess_info *), void *data)
{
@@ -110,7 +106,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
}

static inline int
-call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
+call_usermodehelper(char *path, char **argv, char **envp, int wait)
{
return call_usermodehelper_fns(path, argv, envp, wait,
NULL, NULL, NULL);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 4f89555..8a65e78 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -255,12 +255,9 @@ static void __call_usermodehelper(struct work_struct *work)
{
struct subprocess_info *sub_info =
container_of(work, struct subprocess_info, work);
- enum umh_wait wait = sub_info->wait;
+ int wait = sub_info->wait & ~UMH_KILLABLE;
pid_t pid;

- if (wait != UMH_NO_WAIT)
- wait &= ~UMH_KILLABLE;
-
/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done. */
@@ -430,8 +427,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns);
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*/
-int call_usermodehelper_exec(struct subprocess_info *sub_info,
- enum umh_wait wait)
+int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
{
DECLARE_COMPLETION_ONSTACK(done);
int retval = 0;
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 8246532..cc37903 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -91,7 +91,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
* Call a usermode helper with a specific session keyring.
*/
static int call_usermodehelper_keys(char *path, char **argv, char **envp,
- struct key *session_keyring, enum umh_wait wait)
+ struct key *session_keyring, int wait)
{
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
struct subprocess_info *info =
--
1.7.9.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 03-26-2012, 02:53 PM
Tim Gardner
 
Default usermodehelper: kill umh_wait, renumber UMH_* constants

From: Oleg Nesterov <oleg@redhat.com>

BugLink: http://bugs.launchpad.net/bugs/963685

No functional changes. It is not sane to use UMH_KILLABLE with enum
umh_wait, but obviously we do not want another argument in
call_usermodehelper_* helpers. Kill this enum, use the plain int.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(back ported from commit 9d944ef32e83405a07376f112e9f02161d3e9731)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
include/linux/kmod.h | 17 +++++++----------
kernel/kmod.c | 8 ++------
security/keys/request_key.c | 2 +-
3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 223a8d9..dcdce72 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -47,12 +47,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
struct key;
struct file;

-enum umh_wait {
- UMH_NO_WAIT = -1, /* don't wait at all */
- UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
- UMH_WAIT_PROC = 1, /* wait for the process to complete */
-};
-
+#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 */

struct subprocess_info {
@@ -61,7 +58,7 @@ struct subprocess_info {
char *path;
char **argv;
char **envp;
- enum umh_wait wait;
+ int wait;
int retval;
int (*init)(struct subprocess_info *info);
void (*cleanup)(struct subprocess_info *info);
@@ -79,7 +76,7 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
void *data);

/* Actually execute the sub-process */
-int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
+int call_usermodehelper_exec(struct subprocess_info *info, int wait);

/* Free the subprocess_info. This is only needed if you're not going
to call call_usermodehelper_exec */
@@ -89,7 +86,7 @@ extern void populate_rootfs_wait(void);

static inline int
call_usermodehelper_fns(char *path, char **argv, char **envp,
- enum umh_wait wait,
+ int wait,
int (*init)(struct subprocess_info *info),
void (*cleanup)(struct subprocess_info *), void *data)
{
@@ -109,7 +106,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
}

static inline int
-call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
+call_usermodehelper(char *path, char **argv, char **envp, int wait)
{
return call_usermodehelper_fns(path, argv, envp, wait,
NULL, NULL, NULL);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 504ed15..27e89a1 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -229,12 +229,9 @@ static void __call_usermodehelper(struct work_struct *work)
{
struct subprocess_info *sub_info =
container_of(work, struct subprocess_info, work);
- enum umh_wait wait = sub_info->wait;
+ int wait = sub_info->wait & ~UMH_KILLABLE;
pid_t pid;

- if (wait != UMH_NO_WAIT)
- wait &= ~UMH_KILLABLE;
-
/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done. */
@@ -402,8 +399,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns);
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*/
-int call_usermodehelper_exec(struct subprocess_info *sub_info,
- enum umh_wait wait)
+int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
{
DECLARE_COMPLETION_ONSTACK(done);
int retval = 0;
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index a3dc0d4..598e91a 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -92,7 +92,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
* Call a usermode helper with a specific session keyring.
*/
static int call_usermodehelper_keys(char *path, char **argv, char **envp,
- struct key *session_keyring, enum umh_wait wait)
+ struct key *session_keyring, int wait)
{
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
struct subprocess_info *info =
--
1.7.9.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 03-26-2012, 06:01 PM
Tim Gardner
 
Default usermodehelper: kill umh_wait, renumber UMH_* constants

From: Oleg Nesterov <oleg@redhat.com>

BugLink: http://bugs.launchpad.net/bugs/963685

No functional changes. It is not sane to use UMH_KILLABLE with enum
umh_wait, but obviously we do not want another argument in
call_usermodehelper_* helpers. Kill this enum, use the plain int.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(back ported from commit 9d944ef32e83405a07376f112e9f02161d3e9731)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
include/linux/kmod.h | 19 ++++++++-----------
kernel/kmod.c | 8 ++------
2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index da7db04..1ebe117 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -46,12 +46,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
struct key;
struct file;

-enum umh_wait {
- UMH_NO_WAIT = -1, /* don't wait at all */
- UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
- UMH_WAIT_PROC = 1, /* wait for the process to complete */
-};
-
+#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 */

struct subprocess_info {
@@ -61,7 +58,7 @@ struct subprocess_info {
char *path;
char **argv;
char **envp;
- enum umh_wait wait;
+ int wait;
int retval;
struct file *stdin;
int (*init)(struct subprocess_info *info);
@@ -84,7 +81,7 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
void *data);

/* Actually execute the sub-process */
-int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
+int call_usermodehelper_exec(struct subprocess_info *info, int wait);

/* Free the subprocess_info. This is only needed if you're not going
to call call_usermodehelper_exec */
@@ -92,7 +89,7 @@ void call_usermodehelper_freeinfo(struct subprocess_info *info);

static inline int
call_usermodehelper_fns(char *path, char **argv, char **envp,
- enum umh_wait wait,
+ int wait,
int (*init)(struct subprocess_info *info),
void (*cleanup)(struct subprocess_info *), void *data)
{
@@ -110,7 +107,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
}

static inline int
-call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
+call_usermodehelper(char *path, char **argv, char **envp, int wait)
{
return call_usermodehelper_fns(path, argv, envp, wait,
NULL, NULL, NULL);
@@ -118,7 +115,7 @@ call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)

static inline int
call_usermodehelper_keys(char *path, char **argv, char **envp,
- struct key *session_keyring, enum umh_wait wait)
+ struct key *session_keyring, int wait)
{
struct subprocess_info *info;
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 92296e1..ca3fda9 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -263,14 +263,11 @@ static void __call_usermodehelper(struct work_struct *work)
{
struct subprocess_info *sub_info =
container_of(work, struct subprocess_info, work);
+ int wait = sub_info->wait & ~UMH_KILLABLE;
pid_t pid;
- enum umh_wait wait = sub_info->wait;

BUG_ON(atomic_read(&sub_info->cred->usage) != 1);

- if (wait != UMH_NO_WAIT)
- wait &= ~UMH_KILLABLE;
-
/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done. */
@@ -518,8 +515,7 @@ EXPORT_SYMBOL(call_usermodehelper_stdinpipe);
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*/
-int call_usermodehelper_exec(struct subprocess_info *sub_info,
- enum umh_wait wait)
+int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
{
DECLARE_COMPLETION_ONSTACK(done);
int retval = 0;
--
1.7.9.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 03:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org