Skip to content

Commit e9e4d1f

Browse files
stffrdhrngregkh
authored andcommitted
openrisc: Add clone3 ABI wrapper
[ Upstream commit 433fe39 ] 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/41206fc7-f8ce-98aa-3718-ba3e1431e320@landley.net/T/#m9c0cdb2703813b9df4da04cf6b30de1f1aa89944 Fixes: 07e83df ("openrisc: Enable the clone3 syscall") Cc: Rob Landley <rob@landley.net> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Stafford Horne <shorne@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 551a785 commit e9e4d1f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎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
@@ -1170,6 +1170,11 @@ ENTRY(__sys_clone)
11701170
l.j _fork_save_extra_regs_and_call
11711171
l.nop
11721172

1173+
ENTRY(__sys_clone3)
1174+
l.movhi r29,hi(sys_clone3)
1175+
l.j _fork_save_extra_regs_and_call
1176+
l.ori r29,r29,lo(sys_clone3)
1177+
11731178
ENTRY(__sys_fork)
11741179
l.movhi r29,hi(sys_fork)
11751180
l.ori r29,r29,lo(sys_fork)

0 commit comments

Comments
 (0)