[php-src] PHP-8.4: Zend: Fix stack limit on OpenBSD threads other than the main one
| From: | Ostap Brehin via David Carlier | Date: | Fri, 20 Nov 2026 22:40:51 +0000 |
| Subject: | [php-src] PHP-8.4: Zend: Fix stack limit on OpenBSD threads other than the main one | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143991@lists.php.net to get a copy of this message | ||
Author: Ostap Brehin (osbre)
Committer: David Carlier (devnexen)
Date: 2026-11-20T22:39:06Z
Commit: https://github.com/php/php-src/commit/e7e5bb18168b4504b7ae555309c866117c990525
Raw diff: https://github.com/php/php-src/commit/e7e5bb18168b4504b7ae555309c866117c990525.diff
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
Changed paths:
M NEWS
M Zend/zend_call_stack.c
Diff:
diff --git a/NEWS b/NEWS
index 70d1c4221e93..d29b778cd7f4 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 ab00781b47dc..533ff39bddcd 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;