Skip to content

zend_call_stack sort of GH-13358 follow-up. #13368

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

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

devnexen
Copy link
Member

for threaded context, it solely uses a new api only available on illumos.
Here using a common older api to get the stack info for the current thread.
while at it, completing stack_limit_010 test for these platforms.

@devnexen
Copy link
Member Author

@petk if you have a moment would it be possible to test if it builds for you on your solaris machines and passing the tests (including stack_limit_010.phpt which needs STACK_LIMIT_DEFAULTS_CHECK env var) ? thanks in advance.

@petk
Copy link
Member

petk commented Feb 10, 2024

This test fails specifically. Actually it failed also before, I just didn't notice it.

With the patch from the pull request it does look better a bit:

Zend/tests/stack_limit/stack_limit_010.diff:

--
     }
     Expected max_size: 0x%x
     Actual   max_size: 0x%x
013- bool(true)
013+ bool(false)

Zend/tests/stack_limit/stack_limit_010.out:

array(4) {
  ["base"]=>
  string(14) "0x7fffc0000000"
  ["max_size"]=>
  string(8) "0x800000"
  ["position"]=>
  string(14) "0x7fffbfffc120"
  ["EG(stack_limit)"]=>
  string(14) "0x7fffbf80c000"
}
Expected max_size: 0xa00000
Actual   max_size: 0x800000

Without patch (as is the current master branch) - Zend/tests/stack_limit/stack_limit_010.out:

array(4) {
  ["base"]=>
  string(14) "0x7fffc0000000"
  ["max_size"]=>
  string(8) "0x800000"
  ["position"]=>
  string(14) "0x7fffbfffc120"
  ["EG(stack_limit)"]=>
  string(14) "0x7fffbf80c000"
}

Fatal error: Uncaught UnhandledMatchError: Unhandled match case 'SunOS' in .../php-src/Zend/tests/stack_limit/stack_limit_010.php:7
Stack trace:
#0 {main}
  thrown in .../php-src/Zend/tests/stack_limit/stack_limit_010.php on line 7

I'm not sure if we should bother too much about Solaris 11.4 here. On Solaris there will be no more upgrades with new features. Only backwards compatibility and maintenance patches of existing applications until 2037. I think nobody will adjust new software for Solaris 11.4 specifically anymore because that would mean a dead end for the software itself. If there are patches possible, sure. I think looking forward to Oracle Linux and Solaris-alike illumos systems is the way forward here.

Realistically, I'm not sure PHP 8.2 version will be available at all on Solaris at any point in the future, let alone 8.4.

Regarding the patch in the PR, I think we can add it and go from there.

P.S.: All other Zend tests pass, otherwise.

@devnexen
Copy link
Member Author

ah the stack is smaller on solaris.
well I thought of this PR because someone posted a build fix for solaris 10 just few months ago. Which means newer versions of PHP might come from third party repositories.

@divinity76
Copy link
Contributor

Is Oracle Solaris a supported platform?

@devnexen
Copy link
Member Author

Not a top supported platform, more like a lower tier one ; couple of other major oss projects still support it too. As I mentioned above at least one person cared enough to report a build issue for solaris 10.

@devnexen devnexen requested a review from arnaud-lb February 15, 2024 16:09
Comment on lines 675 to 676
stack->max_size = s.ss_size;
stack->base = (char *)s.ss_sp - stack->max_size;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stack->base should be the high address of the stack (see the diagram in zend_call_stack_get_linux_proc_maps), and ss_sp is the high address already according to the manpage so I think we shouldn't subtract stack->max_size from it here.

Note that in tests, zend_call_stack_get_solaris will use zend_call_stack_get_solaris_proc_maps and not zend_call_stack_get_solaris_pthread because we are the main thread.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stack->base should be the high address of the stack

ah true I forgot.

for threaded context, it solely uses a new api only available on
illumos.
Here using a common older api to get the stack info for the current
thread.
while at it, completing stack_limit_010 test for these platforms.
@devnexen devnexen force-pushed the zend_call_stack_solaris_upd2 branch from a054542 to 21c653e Compare February 16, 2024 13:13
Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@devnexen devnexen merged commit eaaffae into php:master Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants