Repository navigation
Conversation
devnexen
reviewed
Nov 20, 2026
| } | ||
|
|
||
| stack->base = (char *)ss.ss_sp - ss.ss_size; | ||
| stack->base = ss.ss_sp; |
Member
There was a problem hiding this comment.
unlikely indeed but only one machine/arch exception. I guess we can go with it.
Contributor
Author
There was a problem hiding this comment.
Looks like configure only defines ZEND_CHECK_STACK_LIMIT when the stack grows down (Zend.m4), so this code isn't built on hppa
osbre
marked this pull request as ready for review
November 20, 2026 21:08
Member
|
Thanks ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On OpenBSD,
pthread_stackseg_np()returns the top of the stack inss_sp, not the bottom (lib/librthread/rthread_np.c):zend_call_stack_get_openbsd_pthread()subtractsss_sizefrom it, sostack->baseends up one stack size below the real stack. The limit then sits below the stack and is never reached.The main thread isn't affected.
zend_call_stack_get_openbsd_vm()computes the same value libc returns for it (VM_PSSTRINGSrounded up to a page) and already uses it as the base.A small test program on a thread with a 512 KB stack shows a local variable just below
ss_sp:So deep recursion on any thread but the main one crashes the process with SIGILL instead of throwing
Error: Maximum call stack size of ... reached. I found this with FrankenPHP, which runs PHP in threads: one request recursing 1000 levels througharray_map()took down the whole server. With this change it throws the Error, as the CLI already does.The code came in with #11578. I didn't add a test: run-tests only uses the CLI, where PHP runs on the main thread, and CI has no OpenBSD job.