diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-10 22:23:29 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 13:35:23 -0400 |
commit | 9fff2fa0db911b0b75ec1f9bec72460c0a676ef5 (patch) | |
tree | 38fd00adc9bde62de1d5f6346dc670e0e599068f /arch | |
parent | 22e2430d60dbdfcdd732a086e9ef2dbd74c266d1 (diff) |
arm: switch to saner kernel_execve() semantics
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/arm/kernel/entry-common.S | 29 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 5 |
4 files changed, 7 insertions, 29 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a949eec22861..ea3ad0641952 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -50,6 +50,7 @@ config ARM | |||
50 | select GENERIC_STRNLEN_USER | 50 | select GENERIC_STRNLEN_USER |
51 | select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN | 51 | select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN |
52 | select GENERIC_KERNEL_THREAD | 52 | select GENERIC_KERNEL_THREAD |
53 | select GENERIC_KERNEL_EXECVE | ||
53 | help | 54 | help |
54 | The ARM series is a line of low-power-consumption RISC chip designs | 55 | The ARM series is a line of low-power-consumption RISC chip designs |
55 | licensed by ARM Ltd and targeted at embedded applications and | 56 | licensed by ARM Ltd and targeted at embedded applications and |
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 6a70aa42debb..984ad42ed0af 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -470,7 +470,6 @@ | |||
470 | #define __ARCH_WANT_SYS_SOCKETCALL | 470 | #define __ARCH_WANT_SYS_SOCKETCALL |
471 | #endif | 471 | #endif |
472 | #define __ARCH_WANT_SYS_EXECVE | 472 | #define __ARCH_WANT_SYS_EXECVE |
473 | #define __ARCH_WANT_KERNEL_EXECVE | ||
474 | 473 | ||
475 | /* | 474 | /* |
476 | * "Conditional" syscalls | 475 | * "Conditional" syscalls |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index ed7941277ca2..91069666af9f 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -86,35 +86,14 @@ ENDPROC(ret_to_user) | |||
86 | */ | 86 | */ |
87 | ENTRY(ret_from_fork) | 87 | ENTRY(ret_from_fork) |
88 | bl schedule_tail | 88 | bl schedule_tail |
89 | cmp r5, #0 | ||
90 | movne r0, r4 | ||
91 | movne lr, pc | ||
92 | movne pc, r5 | ||
89 | get_thread_info tsk | 93 | get_thread_info tsk |
90 | mov why, #1 | ||
91 | b ret_slow_syscall | 94 | b ret_slow_syscall |
92 | ENDPROC(ret_from_fork) | 95 | ENDPROC(ret_from_fork) |
93 | 96 | ||
94 | ENTRY(ret_from_kernel_thread) | ||
95 | UNWIND(.fnstart) | ||
96 | UNWIND(.cantunwind) | ||
97 | bl schedule_tail | ||
98 | mov r0, r4 | ||
99 | adr lr, BSYM(1f) @ kernel threads should not exit | ||
100 | mov pc, r5 | ||
101 | 1: bl do_exit | ||
102 | nop | ||
103 | UNWIND(.fnend) | ||
104 | ENDPROC(ret_from_kernel_thread) | ||
105 | |||
106 | /* | ||
107 | * turn a kernel thread into userland process | ||
108 | * use: ret_from_kernel_execve(struct pt_regs *normal) | ||
109 | */ | ||
110 | ENTRY(ret_from_kernel_execve) | ||
111 | mov why, #0 @ not a syscall | ||
112 | str why, [r0, #S_R0] @ ... and we want 0 in ->ARM_r0 as well | ||
113 | get_thread_info tsk @ thread structure | ||
114 | mov sp, r0 @ stack pointer just under pt_regs | ||
115 | b ret_slow_syscall | ||
116 | ENDPROC(ret_from_kernel_execve) | ||
117 | |||
118 | .equ NR_syscalls,0 | 97 | .equ NR_syscalls,0 |
119 | #define CALL(x) .equ NR_syscalls,NR_syscalls+1 | 98 | #define CALL(x) .equ NR_syscalls,NR_syscalls+1 |
120 | #include "calls.S" | 99 | #include "calls.S" |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index c10e4395bc47..0f83fa2e58e3 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -373,7 +373,6 @@ void release_thread(struct task_struct *dead_task) | |||
373 | } | 373 | } |
374 | 374 | ||
375 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); | 375 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); |
376 | asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread"); | ||
377 | 376 | ||
378 | int | 377 | int |
379 | copy_thread(unsigned long clone_flags, unsigned long stack_start, | 378 | copy_thread(unsigned long clone_flags, unsigned long stack_start, |
@@ -388,13 +387,13 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, | |||
388 | *childregs = *regs; | 387 | *childregs = *regs; |
389 | childregs->ARM_r0 = 0; | 388 | childregs->ARM_r0 = 0; |
390 | childregs->ARM_sp = stack_start; | 389 | childregs->ARM_sp = stack_start; |
391 | thread->cpu_context.pc = (unsigned long)ret_from_fork; | ||
392 | } else { | 390 | } else { |
391 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
393 | thread->cpu_context.r4 = stk_sz; | 392 | thread->cpu_context.r4 = stk_sz; |
394 | thread->cpu_context.r5 = stack_start; | 393 | thread->cpu_context.r5 = stack_start; |
395 | thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread; | ||
396 | childregs->ARM_cpsr = SVC_MODE; | 394 | childregs->ARM_cpsr = SVC_MODE; |
397 | } | 395 | } |
396 | thread->cpu_context.pc = (unsigned long)ret_from_fork; | ||
398 | thread->cpu_context.sp = (unsigned long)childregs; | 397 | thread->cpu_context.sp = (unsigned long)childregs; |
399 | 398 | ||
400 | clear_ptrace_hw_breakpoint(p); | 399 | clear_ptrace_hw_breakpoint(p); |