Clean up OpenSSL engine list when OpenSSL 1.0.2 used #9767
Closed
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.
This is an attempt to fix GH-8620 . The problem is that OpenSSL adds new engine (rdrand in the reported case) but it doesn't clean up the engines. It means that internally in OpenSSL 1.0.2, the
engine_list_head
is still set even after OpenSSL reference drops to zero and then curl tries to clean it up and it crashes. Interestingly it happens only when shared ldap extension is in the mix which might be related to the fact that it might be somehow releasing the reference too. So the idea of this fix is to clear the engine list before curl tries to clear it so it is empty at that time.@remicollet Unfortunately I'm unable to test it - tried to compile it but no segfault there - it happens for me only with RPM including your RPM's (both php81 and php82) that I tried on Amazon Linux 2 so I assume it might be also visible on CentOS 7 and even RHEL 7 (if you could check that would be awesome). Please would you be able to test this by packaging RPM with this fix (think it should apply cleanly to 8.1 and 8.2 too but also present on 8.0 which I test it with distro package)?
I was just able to get segfault by installing php81 and php81-php-ldap from your repo and then executing this script:
If you can't recreate it and you are able to provide the RPM and steps how to test it on Amazon Linux 2, I can potentially try it too.