[PATCH] x86-64: Align the stack in __tls_get_addr [BZ #21609]
Florian Weimer
fweimer@redhat.com
Tue Jun 20 13:59:00 GMT 2017
On 06/19/2017 12:18 PM, Florian Weimer wrote:
> This is a follow-up to bug 15128, where an unaligned stack was
> compensated for in the dynamic linker relocation trampoline.
> __tls_get_addr itself was not fixed, though, and the function can reach
> deeply into libc due to its malloc dependency, so can result crashes
> with an unaligned stack, too.
>
> The attached patch adds a compatibility implementation of __tls_get_addr
> which aligns the stack, but only on the slow path. Internal calls go to
> the default implementation (from elf/dl-tls.c) which does not perform
> stack realignment.
>
> I plan to submit a follow-up patch which adds a new symbol version for
> __tls_get_addr which bypasses the stack alignment for new binaries.
>
> In my patch, the CFI annotations need review. I have never written
> those before.
I went over the CFI annotations with Jakub. He suggested some
simplifications, incorporated in the attached patch. We don't need
.cfi_restore because the %rbp value at the specified offset is protected
by the red zone until the function returns.
Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug21609.patch
Type: text/x-patch
Size: 8339 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170620/688ec5b3/attachment.bin>
More information about the Libc-alpha
mailing list