about summary refs log tree commit diff
path: root/nptl/sem_init.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-12-20 16:31:43 -0800
committerH.J. Lu <hjl.tools@gmail.com>2023-12-22 05:37:00 -0800
commit3502440397bbb840e2f7223734aa5cc2cc0e29b6 (patch)
treedc6ca80d1ce3455ae7fe5c24f44fc83c047a73de /nptl/sem_init.c
parent61bac1a9d2ab80ebcbc51484722e6ea43414bec7 (diff)
downloadglibc-3502440397bbb840e2f7223734aa5cc2cc0e29b6.tar.gz
glibc-3502440397bbb840e2f7223734aa5cc2cc0e29b6.tar.xz
glibc-3502440397bbb840e2f7223734aa5cc2cc0e29b6.zip
x86-64: Fix the dtv field load for x32 [BZ #31184]
On x32, I got

FAIL: elf/tst-tlsgap

$ gdb elf/tst-tlsgap
...
open tst-tlsgap-mod1.so

Thread 2 "tst-tlsgap" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 2268754]
_dl_tlsdesc_dynamic () at ../sysdeps/x86_64/dl-tlsdesc.S:108
108		movq	(%rsi), %rax
(gdb) p/x $rsi
$4 = 0xf7dbf9005655fb18
(gdb)

This is caused by

_dl_tlsdesc_dynamic:
        _CET_ENDBR
        /* Preserve call-clobbered registers that we modify.
           We need two scratch regs anyway.  */
        movq    %rsi, -16(%rsp)
        movq    %fs:DTV_OFFSET, %rsi

Since the dtv field in TCB is a pointer, %fs:DTV_OFFSET is a 32-bit
location, not 64-bit.  Load the dtv field to RSI_LP instead of rsi.
This fixes BZ #31184.
Diffstat (limited to 'nptl/sem_init.c')
0 files changed, 0 insertions, 0 deletions