summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0952a55)
raw | patch | inline | side by side (parent: 0952a55)
author | Elliott Hughes <enh@google.com> | |
Wed, 10 Dec 2014 19:08:47 +0000 (11:08 -0800) | ||
committer | Elliott Hughes <enh@google.com> | |
Wed, 10 Dec 2014 19:08:47 +0000 (11:08 -0800) |
Make sure we adjust the stack pointer so a signal can't overwrite data.
Bug: 15195265
Change-Id: I5ab9469a82cb214c32f40a713268a1ab74a4c6fa
Bug: 15195265
Change-Id: I5ab9469a82cb214c32f40a713268a1ab74a4c6fa
libc/arch-arm/bionic/__bionic_clone.S | patch | blob | history | |
libc/arch-arm64/bionic/__bionic_clone.S | patch | blob | history |
index b02a70992e734985768e839281932c315fafb21d..a268f9d1a620a9f438d014376f72bcf413eea6d8 100644 (file)
# load extra parameters
ldmfd ip, {r4, r5, r6}
# load extra parameters
ldmfd ip, {r4, r5, r6}
- # store 'fn' and 'arg' to the child stack
+ # Push 'fn' and 'arg' onto the child stack.
stmdb r1!, {r5, r6}
stmdb r1!, {r5, r6}
- # System call
+ # Make the system call.
ldr r7, =__NR_clone
swi #0
ldr r7, =__NR_clone
swi #0
+
+ # Are we the child?
movs r0, r0
beq 1f
movs r0, r0
beq 1f
1: # The child.
# Setting lr to 0 will make the unwinder stop at __start_thread
mov lr, #0
1: # The child.
# Setting lr to 0 will make the unwinder stop at __start_thread
mov lr, #0
+ # Call __start_thread with the 'fn' and 'arg' we stored on the child stack.
pop {r0, r1}
b __start_thread
END(__bionic_clone)
pop {r0, r1}
b __start_thread
END(__bionic_clone)
index 56ac0f69d450d218174226e1d61863a1ce5d4f27..27e44e7f7598ee1d2ca13df305f269d8ce303bfb 100644 (file)
// 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)
// 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)
- # Copy 'fn' and 'arg' onto the child stack.
- stp x5, x6, [x1, #-16]
+ # Push 'fn' and 'arg' onto the child stack.
+ stp x5, x6, [x1, #-16]!
# Make the system call.
mov x8, __NR_clone
# Make the system call.
mov x8, __NR_clone
ret
.L_bc_child:
ret
.L_bc_child:
- # We're in the child now. Set the end of the frame record chain...
- mov x29, xzr
- # Setting x30 to 0 will make the unwinder stop at __start_thread
- mov x30, xzr
- # ...and call __start_thread with the 'fn' and 'arg' we stored on the child stack.
- ldp x0, x1, [sp, #-16]
+ # We're in the child now. Set the end of the frame record chain.
+ mov x29, #0
+ # Setting x30 to 0 will make the unwinder stop at __start_thread.
+ mov x30, #0
+ # Call __start_thread with the 'fn' and 'arg' we stored on the child stack.
+ ldp x0, x1, [sp], #16
b __start_thread
END(__bionic_clone)
.hidden __bionic_clone
b __start_thread
END(__bionic_clone)
.hidden __bionic_clone