Browse Source

arc: clone: Recover PID correctly

Caught by tst-getpid1 test from uClibc's test-suite.

It looks like original implementation was not correct.
The code in question is supposed to recover PID of the new
thread. And by no means that could happen with clone() syscall
while getpid() does exactly this.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Reported-by: Eugeniy Paltsev <paltsev@synopsys.com>
Alexey Brodkin 7 years ago
parent
commit
25f4ae1de7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/sysdeps/linux/arc/clone.S

+ 1 - 1
libc/sysdeps/linux/arc/clone.S

@@ -72,7 +72,7 @@ ENTRY(clone)
 	and_s	r2, r2, r12
 	brne	r2, r12, .Lgo_thread
 
-	mov	r8, __NR_clone
+	mov	r8, __NR_getpid
 	ARC_TRAP_INSN		; r0 has PID
 	THREAD_SELF r1		; Get to struct pthread (just before TCB)
 	st	r0, [r1, PTHREAD_PID]