Skip to content

Commit cee3536

Browse files
committed
powerpc: Wire up clone3 syscall
Wire up the new clone3 syscall added in commit 7f192e3 ("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
1 parent 609488b commit cee3536

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

arch/powerpc/include/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#define __ARCH_WANT_SYS_FORK
5050
#define __ARCH_WANT_SYS_VFORK
5151
#define __ARCH_WANT_SYS_CLONE
52+
#define __ARCH_WANT_SYS_CLONE3
5253

5354
#endif /* __ASSEMBLY__ */
5455
#endif /* _ASM_POWERPC_UNISTD_H_ */

arch/powerpc/kernel/entry_32.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,14 @@ ppc_clone:
597597
stw r0,_TRAP(r1) /* register set saved */
598598
b sys_clone
599599

600+
.globl ppc_clone3
601+
ppc_clone3:
602+
SAVE_NVGPRS(r1)
603+
lwz r0,_TRAP(r1)
604+
rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
605+
stw r0,_TRAP(r1) /* register set saved */
606+
b sys_clone3
607+
600608
.globl ppc_swapcontext
601609
ppc_swapcontext:
602610
SAVE_NVGPRS(r1)

arch/powerpc/kernel/entry_64.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ _GLOBAL(ppc_clone)
487487
bl sys_clone
488488
b .Lsyscall_exit
489489

490+
_GLOBAL(ppc_clone3)
491+
bl save_nvgprs
492+
bl sys_clone3
493+
b .Lsyscall_exit
494+
490495
_GLOBAL(ppc32_swapcontext)
491496
bl save_nvgprs
492497
bl compat_sys_swapcontext

arch/powerpc/kernel/syscalls/syscall.tbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,4 +516,4 @@
516516
432 common fsmount sys_fsmount
517517
433 common fspick sys_fspick
518518
434 common pidfd_open sys_pidfd_open
519-
# 435 reserved for clone3
519+
435 nospu clone3 ppc_clone3

0 commit comments

Comments
 (0)