This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Memory fencing problem in pthread cancellation


On Mon, 14 Jan 2013, Carlos O'Donell wrote:

> diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
> index 58ca9ac..d7ac847 100644
> --- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
> +++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
> @@ -104,6 +104,7 @@ asm (
>  "      mov     r6, r0\n"
>  "      cmp     r3, #0\n"
>  "      beq     4f\n"
> +       atomic_asm_full_barrier()
>  "5:    mov     r0, r6\n"
>  "      ldmfd   sp!, {r4, r5, r6, lr}\n"
>  "      " CFI_ADJUST_CFA_OFFSET (-16) "\n"
> @@ -123,7 +124,7 @@ asm (
>  #else
>  "1:    .word   _GLOBAL_OFFSET_TABLE_ - 3b - 8\n"
>  #endif
> -"2:    .word   libgcc_s_resume(GOTOFF)\n"
> +"2:    .word   libgcc_s_handle(GOTOFF)\n"
>  "      .size   _Unwind_Resume, .-_Unwind_Resume\n"
>  );

That last change doesn't seem right.  Note the subsequent "bx r3" if r3 
isn't zero.  If you want to test libgcc_s_handle for being zero, you then 
need, separately (after the barrier?) to load the libgcc_s_resume value.

(Whatever you do in unwind-forcedunwind.c, presumably much the same change 
should go in unwind-resume.c as well.)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]