Skip to content

Commit 19af2e4

Browse files
committed
ext/opcache: zend_jit_resolve_tsrm_ls_cache_offsets() TEXTREL from bare __tls_get_addr call.
Fix GH-22693 The x86_64 General Dynamic TLS sequence called __tls_get_addr without @plt, which could emit a PC-relative relocation against the external symbol landing in read-only .text, producing a DT_TEXTREL and a linker warning about a possible runtime segfault. Routing the call through the PLT matches the x86-64 TLS ABI canonical sequence and the already correct i386 variant, without changing the emitted instruction bytes. Close GH-22801
1 parent 817f6d2 commit 19af2e4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ PHP NEWS
55
- Date:
66
. Fixed leak on double DatePeriod::__construct() call. (ilutov)
77

8+
- Opcache:
9+
. Fixed GH-22693 (DT_TEXTREL in JIT-generated TLS access on x86_64).
10+
(David Carlier)
11+
812
- Sockets:
913
. Fixed socket_set_option() validation error messages for UDP_SEGMENT and
1014
SO_LINGER options. (Weilin Du)

ext/opcache/jit/tls/zend_jit_tls_x86_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ zend_result zend_jit_resolve_tsrm_ls_cache_offsets(
102102
"leaq _tsrm_ls_cache@tlsgd(%%rip), %%rdi\n"
103103
".word 0x6666\n"
104104
"rex64\n"
105-
"call __tls_get_addr\n"
105+
"call __tls_get_addr@PLT\n"
106106
/* Load thread pointer address */
107107
"movq %%fs:0, %%rsi\n"
108108
: "=a" (addr), "=b" (code), "=S" (thread_pointer)

0 commit comments

Comments
 (0)