Align the child stack in clone(2).
Also let clone(2) set the TLS for x86. Also ensure we initialize the TLS before we clone(2) for all architectures. Change-Id: Ie5fa4466e1c9ee116a281dfedef574c5ba60c0b5
This commit is contained in:
@@ -30,9 +30,6 @@
|
||||
|
||||
// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
|
||||
ENTRY(__bionic_clone)
|
||||
# Align 'child_stack' to 16 bytes.
|
||||
andq $~15, %rsi
|
||||
|
||||
# Copy 'fn' and 'arg' onto the child stack.
|
||||
movq %r9, -16(%rsi) # fn
|
||||
movq 8(%rsp), %rax # Read 'arg'.
|
||||
|
||||
@@ -32,7 +32,5 @@
|
||||
extern int __arch_prctl(int, unsigned long);
|
||||
|
||||
int __set_tls(void* ptr) {
|
||||
// We also need to write the location of the tls to ptr[0].
|
||||
*(void**) ptr = ptr;
|
||||
return __arch_prctl(ARCH_SET_FS, (uintptr_t) ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user