summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-06-05 23:38:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-05 23:38:19 +0000
commit50b79530c6fea6d47d54edf6f351dcbd7d87ab6a (patch)
treea851972a86748785b583acd0766441371162911a
parent9c101eb9d12a87c9b68fce9052751df75e36d172 (diff)
parentaeb3016f8132689d1b49d30056005b667e3d2d0e (diff)
downloadbionic-50b79530c6fea6d47d54edf6f351dcbd7d87ab6a.zip
bionic-50b79530c6fea6d47d54edf6f351dcbd7d87ab6a.tar.gz
bionic-50b79530c6fea6d47d54edf6f351dcbd7d87ab6a.tar.bz2
Merge "Fix unwinding through x86-64 __bionic_clone."
-rw-r--r--libc/arch-x86/bionic/__bionic_clone.S6
-rw-r--r--libc/arch-x86_64/bionic/__bionic_clone.S20
2 files changed, 17 insertions, 9 deletions
diff --git a/libc/arch-x86/bionic/__bionic_clone.S b/libc/arch-x86/bionic/__bionic_clone.S
index 7c972de..672512c 100644
--- a/libc/arch-x86/bionic/__bionic_clone.S
+++ b/libc/arch-x86/bionic/__bionic_clone.S
@@ -25,8 +25,8 @@ ENTRY(__bionic_clone)
int $0x80
# Check result.
- cmpl $0, %eax
- je .L_bc_child
+ testl %eax, %eax
+ jz .L_bc_child
jg .L_bc_parent
# An error occurred, so set errno and return -1.
@@ -44,7 +44,7 @@ ENTRY(__bionic_clone)
hlt
.L_bc_parent:
- # we're the parent; nothing to do.
+ # We're the parent; nothing to do.
.L_bc_return:
popl %edi
popl %esi
diff --git a/libc/arch-x86_64/bionic/__bionic_clone.S b/libc/arch-x86_64/bionic/__bionic_clone.S
index db7d05c..7fe44a2 100644
--- a/libc/arch-x86_64/bionic/__bionic_clone.S
+++ b/libc/arch-x86_64/bionic/__bionic_clone.S
@@ -45,17 +45,23 @@ ENTRY(__bionic_clone)
# Make the system call.
movl $__NR_clone, %eax
syscall
- testl %eax, %eax
- jns 1f
+
+ # Check result.
+ testq %rax, %rax
+ jz .L_bc_child
+ jg .L_bc_parent
# An error occurred, set errno and return -1.
negl %eax
movl %eax, %edi
call __set_errno
orl $-1, %eax
- jmp 2f
-1:
- jnz 2f
+ ret
+
+.L_bc_child:
+ # We don't want anyone to unwind past this point.
+ .cfi_undefined %rip
+ .cfi_undefined %rbp
# We're in the child now, so call __bionic_clone_entry
# with the arguments from the child stack moved into
@@ -64,7 +70,9 @@ ENTRY(__bionic_clone)
popq %rsi # arg
call __bionic_clone_entry
hlt
-2:
+
+.L_bc_parent:
+ # We're the parent; nothing to do.
ret
END(__bionic_clone)
.hidden __bionic_clone