-
Notifications
You must be signed in to change notification settings - Fork 7.9k
zend call stack, follow-up on 75e9980. #11626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
user stack usable implementation for openbsd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Zend/zend_call_stack.c
Outdated
|
||
static bool zend_call_stack_get_openbsd(zend_call_stack *stack) | ||
{ | ||
if (getthrid() == getpid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trick doesn't appear to work on my machine: the IDs are different (I've verified that there is a single thread in the process). I'm not sure how we can determine that we are the main thread. From reading the code, !TIB_GET()->tib_thread || !TIB_GET()->tib_thread->stack
would work (tib_thread is null if pthread is not initialized, and tib_thread->stack appears to imply non-main thread), but you may know a better way?
Zend/zend_call_stack.c
Outdated
} | ||
|
||
// arch dependent top user's stack | ||
stack->base = USRSTACK - rlim.rlim_cur; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my machine with OpenBSD 7.3 the actual stack base as reported by procmap
is randomized, and the value of USRSTACK does not match. Maybe we could use sysctl() like pthread does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ve looked at first at sysctl and did not find anything relevant (a way may have existed before tough), however there is a hope to achieve it I ll have a better look later today.
stack_limit zend tests seem to pass now. |
b84497b
to
a368570
Compare
Thank you! |
user stack usable implementation for openbsd.