diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-10 21:28:25 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 13:35:07 -0400 |
commit | a74fb73c12398b250fdc5e333a11e15a9e3a84fc (patch) | |
tree | 2bec2f6e20320f5a4bc01d1e19d7190842ef1c37 /kernel | |
parent | fb45550d76bb584857cf0ea3be79fa78207a3cff (diff) |
infrastructure for saner ret_from_kernel_thread semantics
* allow kernel_execve() leave the actual return to userland to
caller (selected by CONFIG_GENERIC_KERNEL_EXECVE). Callers
updated accordingly.
* architecture that does select GENERIC_KERNEL_EXECVE in its
Kconfig should have its ret_from_kernel_thread() do this:
call schedule_tail
call the callback left for it by copy_thread(); if it ever
returns, that's because it has just done successful kernel_execve()
jump to return from syscall
IOW, its only difference from ret_from_fork() is that it does call the
callback.
* such an architecture should also get rid of ret_from_kernel_execve()
and __ARCH_WANT_KERNEL_EXECVE
This is the last part of infrastructure patches in that area - from
that point on work on different architectures can live independently.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kmod.c | 3 | ||||
-rw-r--r-- | kernel/kthread.c | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index b6e5ca9c758a..1c317e386831 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/notifier.h> | 37 | #include <linux/notifier.h> |
38 | #include <linux/suspend.h> | 38 | #include <linux/suspend.h> |
39 | #include <linux/rwsem.h> | 39 | #include <linux/rwsem.h> |
40 | #include <linux/ptrace.h> | ||
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | 42 | ||
42 | #include <trace/events/module.h> | 43 | #include <trace/events/module.h> |
@@ -221,6 +222,8 @@ static int ____call_usermodehelper(void *data) | |||
221 | retval = kernel_execve(sub_info->path, | 222 | retval = kernel_execve(sub_info->path, |
222 | (const char *const *)sub_info->argv, | 223 | (const char *const *)sub_info->argv, |
223 | (const char *const *)sub_info->envp); | 224 | (const char *const *)sub_info->envp); |
225 | if (!retval) | ||
226 | return 0; | ||
224 | 227 | ||
225 | /* Exec failed? */ | 228 | /* Exec failed? */ |
226 | fail: | 229 | fail: |
diff --git a/kernel/kthread.c b/kernel/kthread.c index b579af57ea10..7ba65c1aa6b3 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/freezer.h> | 18 | #include <linux/freezer.h> |
19 | #include <linux/ptrace.h> | ||
19 | #include <trace/events/sched.h> | 20 | #include <trace/events/sched.h> |
20 | 21 | ||
21 | static DEFINE_SPINLOCK(kthread_create_lock); | 22 | static DEFINE_SPINLOCK(kthread_create_lock); |