Skip to content

Commit bd71c45

Browse files
committed
ARC: wireup clone3 syscall
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 7980dff commit bd71c45

6 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎arch/arc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config ARC
2828
select GENERIC_SMP_IDLE_THREAD
2929
select HAVE_ARCH_KGDB
3030
select HAVE_ARCH_TRACEHOOK
31+
select HAVE_COPY_THREAD_TLS
3132
select HAVE_DEBUG_STACKOVERFLOW
3233
select HAVE_DEBUG_KMEMLEAK
3334
select HAVE_FUTEX_CMPXCHG if FUTEX

‎arch/arc/include/asm/syscalls.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/types.h>
1212

1313
int sys_clone_wrapper(int, int, int, int, int);
14+
int sys_clone3_wrapper(void *, size_t);
1415
int sys_cacheflush(uint32_t, uint32_t uint32_t);
1516
int sys_arc_settls(void *);
1617
int sys_arc_gettls(void);

‎arch/arc/include/uapi/asm/unistd.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define __ARCH_WANT_SET_GET_RLIMIT
2222
#define __ARCH_WANT_SYS_EXECVE
2323
#define __ARCH_WANT_SYS_CLONE
24+
#define __ARCH_WANT_SYS_CLONE3
2425
#define __ARCH_WANT_SYS_VFORK
2526
#define __ARCH_WANT_SYS_FORK
2627
#define __ARCH_WANT_TIME32_SYSCALLS

‎arch/arc/kernel/entry.S‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ ENTRY(sys_clone_wrapper)
3535
b .Lret_from_system_call
3636
END(sys_clone_wrapper)
3737

38+
ENTRY(sys_clone3_wrapper)
39+
SAVE_CALLEE_SAVED_USER
40+
bl @sys_clone3
41+
DISCARD_CALLEE_SAVED_USER
42+
43+
GET_CURR_THR_INFO_FLAGS r10
44+
btst r10, TIF_SYSCALL_TRACE
45+
bnz tracesys_exit
46+
47+
b .Lret_from_system_call
48+
END(sys_clone3_wrapper)
49+
3850
ENTRY(ret_from_fork)
3951
; when the forked child comes here from the __switch_to function
4052
; r0 has the last task pointer.

‎arch/arc/kernel/process.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ asmlinkage void ret_from_fork(void);
171171
* | user_r25 |
172172
* ------------------ <===== END of PAGE
173173
*/
174-
int copy_thread(unsigned long clone_flags,
175-
unsigned long usp, unsigned long kthread_arg,
176-
struct task_struct *p)
174+
int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
175+
unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
177176
{
178177
struct pt_regs *c_regs; /* child's pt_regs */
179178
unsigned long *childksp; /* to unwind out of __switch_to() */
@@ -231,7 +230,7 @@ int copy_thread(unsigned long clone_flags,
231230
* set task's userland tls data ptr from 4th arg
232231
* clone C-lib call is difft from clone sys-call
233232
*/
234-
task_thread_info(p)->thr_ptr = regs->r3;
233+
task_thread_info(p)->thr_ptr = tls;
235234
} else {
236235
/* Normal fork case: set parent's TLS ptr in child */
237236
task_thread_info(p)->thr_ptr =

‎arch/arc/kernel/sys.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <asm/syscalls.h>
88

99
#define sys_clone sys_clone_wrapper
10+
#define sys_clone3 sys_clone3_wrapper
1011

1112
#undef __SYSCALL
1213
#define __SYSCALL(nr, call) [nr] = (call),

0 commit comments

Comments
 (0)