diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 23:02:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 23:02:25 -0400 |
commit | 42859eea96ba6beabfb0369a1eeffa3c7d2bd9cb (patch) | |
tree | fa38aeda0d6e7a4c48a882b166b8643594a1ad50 /arch/x86/kernel/process.c | |
parent | f59b51fe3d3092c08d7d554ecb40db24011b2ebc (diff) | |
parent | f322220d6159455da2b5a8a596d802c8695fed30 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull generic execve() changes from Al Viro:
"This introduces the generic kernel_thread() and kernel_execve()
functions, and switches x86, arm, alpha, um and s390 over to them."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (26 commits)
s390: convert to generic kernel_execve()
s390: switch to generic kernel_thread()
s390: fold kernel_thread_helper() into ret_from_fork()
s390: fold execve_tail() into start_thread(), convert to generic sys_execve()
um: switch to generic kernel_thread()
x86, um/x86: switch to generic sys_execve and kernel_execve
x86: split ret_from_fork
alpha: introduce ret_from_kernel_execve(), switch to generic kernel_execve()
alpha: switch to generic kernel_thread()
alpha: switch to generic sys_execve()
arm: get rid of execve wrapper, switch to generic execve() implementation
arm: optimized current_pt_regs()
arm: introduce ret_from_kernel_execve(), switch to generic kernel_execve()
arm: split ret_from_fork, simplify kernel_thread() [based on patch by rmk]
generic sys_execve()
generic kernel_execve()
new helper: current_pt_regs()
preparation for generic kernel_thread()
um: kill thread->forking
um: let signal_delivered() do SIGTRAP on singlestepping into handler
...
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index dc3567e083f9..b644e1c765dc 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -293,71 +293,6 @@ sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
293 | } | 293 | } |
294 | 294 | ||
295 | /* | 295 | /* |
296 | * This gets run with %si containing the | ||
297 | * function to call, and %di containing | ||
298 | * the "args". | ||
299 | */ | ||
300 | extern void kernel_thread_helper(void); | ||
301 | |||
302 | /* | ||
303 | * Create a kernel thread | ||
304 | */ | ||
305 | int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
306 | { | ||
307 | struct pt_regs regs; | ||
308 | |||
309 | memset(®s, 0, sizeof(regs)); | ||
310 | |||
311 | regs.si = (unsigned long) fn; | ||
312 | regs.di = (unsigned long) arg; | ||
313 | |||
314 | #ifdef CONFIG_X86_32 | ||
315 | regs.ds = __USER_DS; | ||
316 | regs.es = __USER_DS; | ||
317 | regs.fs = __KERNEL_PERCPU; | ||
318 | regs.gs = __KERNEL_STACK_CANARY; | ||
319 | #else | ||
320 | regs.ss = __KERNEL_DS; | ||
321 | #endif | ||
322 | |||
323 | regs.orig_ax = -1; | ||
324 | regs.ip = (unsigned long) kernel_thread_helper; | ||
325 | regs.cs = __KERNEL_CS | get_kernel_rpl(); | ||
326 | regs.flags = X86_EFLAGS_IF | X86_EFLAGS_BIT1; | ||
327 | |||
328 | /* Ok, create the new process.. */ | ||
329 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); | ||
330 | } | ||
331 | EXPORT_SYMBOL(kernel_thread); | ||
332 | |||
333 | /* | ||
334 | * sys_execve() executes a new program. | ||
335 | */ | ||
336 | long sys_execve(const char __user *name, | ||
337 | const char __user *const __user *argv, | ||
338 | const char __user *const __user *envp, struct pt_regs *regs) | ||
339 | { | ||
340 | long error; | ||
341 | char *filename; | ||
342 | |||
343 | filename = getname(name); | ||
344 | error = PTR_ERR(filename); | ||
345 | if (IS_ERR(filename)) | ||
346 | return error; | ||
347 | error = do_execve(filename, argv, envp, regs); | ||
348 | |||
349 | #ifdef CONFIG_X86_32 | ||
350 | if (error == 0) { | ||
351 | /* Make sure we don't return using sysenter.. */ | ||
352 | set_thread_flag(TIF_IRET); | ||
353 | } | ||
354 | #endif | ||
355 | |||
356 | putname(filename); | ||
357 | return error; | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | * Idle related variables and functions | 296 | * Idle related variables and functions |
362 | */ | 297 | */ |
363 | unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE; | 298 | unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE; |