]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc: Wire up clone3 syscall
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 22 Jul 2019 12:26:56 +0000 (22:26 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 28 Jul 2019 23:34:27 +0000 (09:34 +1000)
Wire up the new clone3 syscall added in commit 7f192e3cd316 ("fork:
add clone3").

This requires a ppc_clone3 wrapper, in order to save the non-volatile
GPRs before calling into the generic syscall code. Otherwise we hit
the BUG_ON in CHECK_FULL_REGS in copy_thread().

Lightly tested using Christian's test code on a Power8 LE VM.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Christian Brauner <christian@brauner.io>
Link: https://lore.kernel.org/r/20190724140259.23554-1-mpe@ellerman.id.au
arch/powerpc/include/asm/unistd.h
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/syscalls/syscall.tbl

index 68473c3c471cacad92b82958f2202ad1ab0ec984..b0720c7c3fcf620ceaa212266e4fc6c02c2a2989 100644 (file)
@@ -49,6 +49,7 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_SYS_CLONE3
 
 #endif         /* __ASSEMBLY__ */
 #endif /* _ASM_POWERPC_UNISTD_H_ */
index 85fdb6d879f174365f828859b5e8a047e5aafcfa..54fab22c9a4355edfdd41e1557b6e27c7c73c7ff 100644 (file)
@@ -597,6 +597,14 @@ ppc_clone:
        stw     r0,_TRAP(r1)            /* register set saved */
        b       sys_clone
 
+       .globl  ppc_clone3
+ppc_clone3:
+       SAVE_NVGPRS(r1)
+       lwz     r0,_TRAP(r1)
+       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
+       stw     r0,_TRAP(r1)            /* register set saved */
+       b       sys_clone3
+
        .globl  ppc_swapcontext
 ppc_swapcontext:
        SAVE_NVGPRS(r1)
index d9105fcf4021cac77120fc87ed1a70ab961a6201..0a0b5310f54a6fac4664b9180cdd67603b733543 100644 (file)
@@ -487,6 +487,11 @@ _GLOBAL(ppc_clone)
        bl      sys_clone
        b       .Lsyscall_exit
 
+_GLOBAL(ppc_clone3)
+       bl      save_nvgprs
+       bl      sys_clone3
+       b       .Lsyscall_exit
+
 _GLOBAL(ppc32_swapcontext)
        bl      save_nvgprs
        bl      compat_sys_swapcontext
index 3331749aab20abdd84d21d019240b8cecc60dfba..43f736ed47f28a1dff42ffb7ae7b3e19613e0211 100644 (file)
 432    common  fsmount                         sys_fsmount
 433    common  fspick                          sys_fspick
 434    common  pidfd_open                      sys_pidfd_open
-# 435 reserved for clone3
+435    nospu   clone3                          ppc_clone3