This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 08/19] nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683)
On Mon, 11 Dec 2017, Adhemerval Zanella wrote:
> +ENTRY (__syscall_cancel_arch)
> + .fnstart
> + mov ip,sp
> + stmfd sp!, {r4,r5,r6,r7,lr}
> + .save {r4,r5,r6,r7,lr}
> +
> + cfi_adjust_cfa_offset (20)
> + cfi_rel_offset (lr, 16)
I'd expect the saves of other registers to be described in the CFI as well
(that is, the .debug_frame CFI which is generated by cfi_* on ARM).
> + .globl __syscall_cancel_arch_end
> +__syscall_cancel_arch_end:
> + ldmfd sp!, {r4,r5,r6,r7,lr}
> + cfi_adjust_cfa_offset (-20);
Then, I'd expect cfi_restore calls here.
> +1:
> + mov lr, pc
> + b __syscall_do_cancel
And this code is jumped to from a position where the stack has been
adjusted, but the CFI at this point reflects a state where it has been
restored. So you need a fresh set of CFI directives to make the CFI
accurate in this part of the function. (I haven't checked whether any
other architecture versions of this function might have similar CFI
issues.)
Also, it looks like you jump to the C function __syscall_do_cancel with a
stack adjustment that is not a multiple of 8. I think the AAPCS
requirement for the stack pointer to be a multiple of 8 at public
interfaces applies to such a jump to a C function, so you need to save and
restore an additional register to preserve alignment.
--
Joseph S. Myers
joseph@codesourcery.com