From e7dccdf683616347a8fa65aba02ee3e12babbcf4 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 27 May 2014 15:47:32 -0700 Subject: [PATCH] Clear the return address register in __bionic_clone. The unwinder will end up on the parent thread's stack if the return address register is not cleared. Bug: 14270816 Bug: 15195760 Change-Id: Iebcdf5cc881cad245643bb193760de35eb7f8b19 --- libc/arch-mips/bionic/__bionic_clone.S | 3 +++ libc/arch-mips64/bionic/__bionic_clone.S | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libc/arch-mips/bionic/__bionic_clone.S b/libc/arch-mips/bionic/__bionic_clone.S index 11d596b85..7b138ae43 100644 --- a/libc/arch-mips/bionic/__bionic_clone.S +++ b/libc/arch-mips/bionic/__bionic_clone.S @@ -54,6 +54,9 @@ ENTRY(__bionic_clone) j ra .L__thread_start_bc: + # Clear return address in child so we don't unwind further. + li ra,0 + lw a0,0(sp) # fn lw a1,4(sp) # arg diff --git a/libc/arch-mips64/bionic/__bionic_clone.S b/libc/arch-mips64/bionic/__bionic_clone.S index 754861bb6..868790630 100644 --- a/libc/arch-mips64/bionic/__bionic_clone.S +++ b/libc/arch-mips64/bionic/__bionic_clone.S @@ -75,6 +75,9 @@ LEAF(__bionic_clone, FRAMESZ) j ra .L__thread_start_bc: + # Clear return address in child so we don't unwind further. + li ra,0 + # void __bionic_clone_entry(int (*func)(void*), void *arg) PTR_L a0,FRAME_FN(sp) # fn PTR_L a1,FRAME_ARG(sp) # arg