Commit e7e5bb18168 for php
commit e7e5bb18168b4504b7ae555309c866117c990525
Author: Ostap Brehin <osbre@protonmail.com>
Date: Thu Nov 19 22:13:48 2026 +0000
Zend: Fix stack limit on OpenBSD threads other than the main one
On OpenBSD, pthread_stackseg_np() returns the top of the stack in
ss_sp, not the bottom. zend_call_stack_get_openbsd_pthread() subtracted
ss_size from it, so the base ended up one stack size below the real
stack and the limit was never reached.
Close GH-25635
diff --git a/NEWS b/NEWS
index 70d1c4221e9..d29b778cd7f 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ PHP NEWS
. Fixed object_properties_load() adding integer keys to property tables, which
made the properties unreadable and clone hit an assertion.
(Nicolas Grekas)
+ . Fixed stack limit on OpenBSD threads other than the main one.
+ (Ostap Brehin)
- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
diff --git a/Zend/zend_call_stack.c b/Zend/zend_call_stack.c
index ab00781b47d..533ff39bddc 100644
--- a/Zend/zend_call_stack.c
+++ b/Zend/zend_call_stack.c
@@ -493,7 +493,7 @@ static bool zend_call_stack_get_openbsd_pthread(zend_call_stack *stack)
return false;
}
- stack->base = (char *)ss.ss_sp - ss.ss_size;
+ stack->base = ss.ss_sp;
stack->max_size = ss.ss_size - sysconf(_SC_PAGE_SIZE);
return true;