Prevent late calls to zend_add_system_entropy() #20468
Draft
+22
−12
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.
Calling
zend_add_system_entropy()afterzend_finalize_system_id()has no effect. The function returnsFAILUREin that case, but it's not checked in practice, so somezend_add_system_entropy()calls are unknowingly no-ops.Here I change
zend_add_system_entropy()so that calling it too late triggers an assertion failure. I also fix JIT initialization, which calledzend_add_system_entropy()too late.Extensions using
zend_get_resource_handle(),zend_get_op_array_extension_handle(),zend_get_internal_function_extension_handle(), or callingzend_add_system_entropy()explicitly, should do so inMINIT()(for PHP modules) or in the startup hook (for Zend extensions).