1808df9ce5
We were reading from the wrong offset. It just happened to work on Linux because the values stored in the first and third fields of tcbhead_t[1] are the same. But that is not the case on FreeBSD for the same thing[2]. Confirmed by disassembly. Linux: Dump of assembler code for function __GI___pthread_self: 0x00007ffff71b6efe <+0>: endbr64 0x00007ffff71b6f02 <+4>: nop 0x00007ffff71b6f03 <+5>: nop 0x00007ffff71b6f04 <+6>: mov %fs:0x10,%rax 0x00007ffff71b6f0d <+15>: ret FreeBSD: (gdb) disass pthread_self Dump of assembler code for function _Tthr_self: 0x0000000800324790 <+0>: push %rbp 0x0000000800324791 <+1>: mov %rsp,%rbp 0x0000000800324794 <+4>: cmpq $0x0,0x8b1c(%rip) # 0x80032d2b8 <_thr_initial> 0x000000080032479c <+12>: jne 0x8003247a5 <_Tthr_self+21> 0x000000080032479e <+14>: xor %edi,%edi 0x00000008003247a0 <+16>: call 0x80031de40 <_libpthread_init> 0x00000008003247a5 <+21>: mov %fs:0x10,%rax 0x00000008003247ae <+30>: pop %rbp 0x00000008003247af <+31>: ret Also confirmed not to affect macOS: (lldb) disass -n pthread_self libsystem_pthread.dylib`pthread_self: libsystem_pthread.dylib[0x7ff80032186c] <+0>: pushq %rbp libsystem_pthread.dylib[0x7ff80032186d] <+1>: movq %rsp, %rbp libsystem_pthread.dylib[0x7ff800321870] <+4>: movq %gs:0x0, %rax [1] https://code.woboq.org/userspace/glibc/sysdeps/x86_64/nptl/tls.h.html#tcbhead_t [2] https://github.com/freebsd/freebsd-src/blob/main/sys/x86/include/tls.h#L43 Pick-to: 6.2 6.3 Fixes: QTBUG-103000 Change-Id: I7fb65b80b7844c8d8f26fffd16ea67d2f3461964 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
LICENSE.FDL | ||
LICENSE.GPL2 | ||
LICENSE.GPL3 | ||
LICENSE.GPL3-EXCEPT | ||
LICENSE.LGPL3 | ||
LICENSE.QT-LICENSE-AGREEMENT | ||
qt_cmdline.cmake | ||
sync.profile |