Skip to content

Commit 433fe39

Browse files
committed
openrisc: Add clone3 ABI wrapper
Like fork and clone the clone3 syscall needs a wrapper to save callee saved registers, which is required by the OpenRISC ABI. This came up after auditing code following a discussion with Rob Landley and Arnd Bergmann [0]. Tested with the clone3 kselftests and there were no issues. [0] https://lore.kernel.org/all/[email protected]/T/#m9c0cdb2703813b9df4da04cf6b30de1f1aa89944 Fixes: 07e83df ("openrisc: Enable the clone3 syscall") Cc: Rob Landley <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent 07baf50 commit 433fe39

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

arch/openrisc/include/asm/syscalls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,
2222

2323
asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
2424
void __user *parent_tid, void __user *child_tid, int tls);
25+
asmlinkage long __sys_clone3(struct clone_args __user *uargs, size_t size);
2526
asmlinkage long __sys_fork(void);
2627

2728
#define sys_clone __sys_clone
29+
#define sys_clone3 __sys_clone3
2830
#define sys_fork __sys_fork
2931

3032
#endif /* __ASM_OPENRISC_SYSCALLS_H */

arch/openrisc/kernel/entry.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,11 @@ ENTRY(__sys_clone)
11651165
l.j _fork_save_extra_regs_and_call
11661166
l.ori r29,r29,lo(sys_clone)
11671167

1168+
ENTRY(__sys_clone3)
1169+
l.movhi r29,hi(sys_clone3)
1170+
l.j _fork_save_extra_regs_and_call
1171+
l.ori r29,r29,lo(sys_clone3)
1172+
11681173
ENTRY(__sys_fork)
11691174
l.movhi r29,hi(sys_fork)
11701175
l.j _fork_save_extra_regs_and_call

0 commit comments

Comments
 (0)