arm: switch to saner kernel_execve() semantics
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 11 Oct 2012 02:23:29 +0000 (22:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Oct 2012 17:35:23 +0000 (13:35 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/arm/Kconfig
arch/arm/include/asm/unistd.h
arch/arm/kernel/entry-common.S
arch/arm/kernel/process.c

index a949eec2286190c8739e60017165f2e50381b917..ea3ad0641952a2c5f1efa215422c47877a36cb92 100644 (file)
@@ -50,6 +50,7 @@ config ARM
        select GENERIC_STRNLEN_USER
        select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN
        select GENERIC_KERNEL_THREAD
+       select GENERIC_KERNEL_EXECVE
        help
          The ARM series is a line of low-power-consumption RISC chip designs
          licensed by ARM Ltd and targeted at embedded applications and
index 6a70aa42debb1ab738eef726c98f84ad7c0c72ab..984ad42ed0afd2398fa92d44c653f37c20b8e0f6 100644 (file)
 #define __ARCH_WANT_SYS_SOCKETCALL
 #endif
 #define __ARCH_WANT_SYS_EXECVE
-#define __ARCH_WANT_KERNEL_EXECVE
 
 /*
  * "Conditional" syscalls
index ed7941277ca2b467ee1771a3e45dfe0a5d793715..91069666af9f0c3d2cc54a9e29e824edbbc90cad 100644 (file)
@@ -86,35 +86,14 @@ ENDPROC(ret_to_user)
  */
 ENTRY(ret_from_fork)
        bl      schedule_tail
+       cmp     r5, #0
+       movne   r0, r4
+       movne   lr, pc
+       movne   pc, r5
        get_thread_info tsk
-       mov     why, #1
        b       ret_slow_syscall
 ENDPROC(ret_from_fork)
 
-ENTRY(ret_from_kernel_thread)
- UNWIND(.fnstart)
- UNWIND(.cantunwind)
-       bl      schedule_tail
-       mov     r0, r4
-       adr     lr, BSYM(1f)    @ kernel threads should not exit
-       mov     pc, r5
-1:     bl      do_exit
-       nop
- UNWIND(.fnend)
-ENDPROC(ret_from_kernel_thread)
-
-/*
- * turn a kernel thread into userland process
- * use: ret_from_kernel_execve(struct pt_regs *normal)
- */
-ENTRY(ret_from_kernel_execve)
-       mov     why, #0                 @ not a syscall
-       str     why, [r0, #S_R0]        @ ... and we want 0 in ->ARM_r0 as well
-       get_thread_info tsk             @ thread structure
-       mov     sp, r0                  @ stack pointer just under pt_regs
-       b       ret_slow_syscall
-ENDPROC(ret_from_kernel_execve)
-
        .equ NR_syscalls,0
 #define CALL(x) .equ NR_syscalls,NR_syscalls+1
 #include "calls.S"
index c10e4395bc47c20b14ae09dd6e212d6c027849b9..0f83fa2e58e397b1e67cbab0228d392130b9e98c 100644 (file)
@@ -373,7 +373,6 @@ void release_thread(struct task_struct *dead_task)
 }
 
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
 
 int
 copy_thread(unsigned long clone_flags, unsigned long stack_start,
@@ -388,13 +387,13 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
                *childregs = *regs;
                childregs->ARM_r0 = 0;
                childregs->ARM_sp = stack_start;
-               thread->cpu_context.pc = (unsigned long)ret_from_fork;
        } else {
+               memset(childregs, 0, sizeof(struct pt_regs));
                thread->cpu_context.r4 = stk_sz;
                thread->cpu_context.r5 = stack_start;
-               thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread;
                childregs->ARM_cpsr = SVC_MODE;
        }
+       thread->cpu_context.pc = (unsigned long)ret_from_fork;
        thread->cpu_context.sp = (unsigned long)childregs;
 
        clear_ptrace_hw_breakpoint(p);