OSDN Git Service

bionic: Stack pointer/signal race condition.
authorPeter Enderborg <peter.enderborg@sonymobile.com>
Mon, 9 Jul 2012 14:17:17 +0000 (16:17 +0200)
committerJohan Redestig <johan.redestig@sonymobile.com>
Fri, 27 Jul 2012 13:11:01 +0000 (15:11 +0200)
Move the stackpointer so a captured signal does not corrupt
stack variables needed for __thread_entry.

Change-Id: I3e1e7b94a6d7cd3a07081f849043262743aa8064

libc/arch-arm/bionic/clone.S

index a95d2d6..7ff3d0d 100644 (file)
@@ -30,8 +30,7 @@
 
 ENTRY(__pthread_clone)
     @ insert the args onto the new stack
-    str     r0, [r1, #-4]
-    str     r3, [r1, #-8]
+    stmdb r1!, {r0, r3}
 
     @ do the system call
     @ get flags
@@ -60,8 +59,7 @@ ENTRY(__pthread_clone)
     @ to the C __thread_entry function which does some setup and then
     @ calls the thread's start function
 
-    ldr     r0, [sp, #-4]
-    ldr     r1, [sp, #-8]
+    pop     {r0, r1}
     mov     r2, sp                     @ __thread_entry needs the TLS pointer
     b       __thread_entry