[PATCH] x86: Check invalid TLS descriptor call

Alexandre Oliva oliva@gnu.org
Mon Sep 2 17:53:18 GMT 2024


On Aug 31, 2024, "H.J. Lu" <hjl.tools@gmail.com> wrote:

> On Sat, Aug 31, 2024 at 4:07 AM Alexandre Oliva <oliva@gnu.org> wrote:
>> 
>> On Aug 29, 2024, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>> 
>> > TLS descriptor call,
>> > call *x@tlsdesc(%rax)
>> 
>> > or
>> 
>> > call *x@tlsdesc(%eax)
>> 
>> > calls _dl_tlsdesc_return which expects that RAX/EAX points to the TLS
>> > descriptor.

>> But it doesn't follow that one must not use any other register that
>> holds a copy of %[er]ax for the call, does it?

> Did you mean that

> lea foo@tlsdesc(%ebx), %eax
> mov %eax, %ecx
> call *foo@tlscall(%ecx)

> also works?

I didn't quite mean that; I meant there's no reason why it couldn't be
made to work.

-- 
Alexandre Oliva, happy hacker                  https://FSFLA.org/blogs/lxo/
   Free Software Activist                         GNU Toolchain Engineer
GNU's Day, qui tollis peccata mundi, libera nobis, dona nobis IV libertates


More information about the Binutils mailing list