<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:20:31 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-4297] Do not declare OpenSSL 1.1 polyfill functions in global scope</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-4297</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;In &lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/issues/1302&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb/mongo-php-driver#1302&lt;/a&gt;, a user reported a segfault when the PHP driver (with libmongoc) was initialized but otherwise unused and the PHP script went on to use a separate library and the OpenSSL extension. According to the user, they were using CentOS 7 with OpenSSL 1.0.2k-fips 26 Jan 2017.&lt;/p&gt;

&lt;p&gt;Once we obtained a backtrace, it was evident that OpenSSL 1.1 had been linked by some shared libraries loaded in the same PHP process. The PHP driver and libmongoc had evidently been compiled with OpenSSL 1.0.x, which resulted in polyfills for several OpenSSL 1.1 functions being defined:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;EVP_MD_CTX_new&lt;/tt&gt; and &lt;tt&gt;EVP_MD_CTX_free&lt;/tt&gt;, which are defined in &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.21.0/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c#L41&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;src/libmongoc/src/mongoc/mongoc-crypto-openssl.c&lt;/a&gt;. Declarations in &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.21.0/src/kms-message/src/kms_crypto_libcrypto.c#L25&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;src/kms-message/src/kms_crypto_libcrypto.c&lt;/a&gt; already use &lt;tt&gt;static&lt;/tt&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Because these functions were declared in the global scope, they were inadvertently invoked by the other shared library was was compiled against OpenSSL. I expect the segfault was due to mismatched memory allocation functions (the polyfills use libbson&apos;s API).&lt;/p&gt;

&lt;p&gt;Although the root of this issue goes beyond libmongoc (linking multiple versions of OpenSSL in the same process is a no-no), the polyfills made the error more difficult to diagnose.&lt;/p&gt;

&lt;p&gt;These functions should either be declared statically or renamed/prefixed, as is done for some libbson compat functions.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1984687">CDRIVER-4297</key>
            <summary>Do not declare OpenSSL 1.1 polyfill functions in global scope</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Wed, 16 Feb 2022 15:54:16 +0000</created>
                <updated>Sat, 28 Oct 2023 11:28:12 +0000</updated>
                            <resolved>Wed, 16 Feb 2022 19:17:50 +0000</resolved>
                                                    <fixVersion>1.21.1</fixVersion>
                                    <component>tls</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="4384376" author="xgen-internal-githook" created="Tue, 1 Mar 2022 19:04:20 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Remi Collet&apos;, &apos;email&apos;: &apos;remi@remirepo.net&apos;, &apos;username&apos;: &apos;remicollet&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4297&quot; title=&quot;Do not declare OpenSSL 1.1 polyfill functions in global scope&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4297&quot;&gt;&lt;del&gt;CDRIVER-4297&lt;/del&gt;&lt;/a&gt; use static decls for OpenSSL 1.1 polyfills (#946)&lt;br/&gt;
Branch: r1.21&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/c2e78b48a0bec5f11ebd2f9f588ba1375b3ea33f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/c2e78b48a0bec5f11ebd2f9f588ba1375b3ea33f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4359663" author="xgen-internal-githook" created="Wed, 16 Feb 2022 19:17:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Remi Collet&apos;, &apos;email&apos;: &apos;remi@remirepo.net&apos;, &apos;username&apos;: &apos;remicollet&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4297&quot; title=&quot;Do not declare OpenSSL 1.1 polyfill functions in global scope&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4297&quot;&gt;&lt;del&gt;CDRIVER-4297&lt;/del&gt;&lt;/a&gt; use static decls for OpenSSL 1.1 polyfills (#946)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/79955086e4761d4a1add449c02bcde5963bce94c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/79955086e4761d4a1add449c02bcde5963bce94c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4358933" author="jmikola@gmail.com" created="Wed, 16 Feb 2022 15:59:12 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=remi&quot; class=&quot;user-hover&quot; rel=&quot;remi&quot;&gt;remi&lt;/a&gt; submitted a PR: &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/946&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/pull/946&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kevin.albertson&quot; class=&quot;user-hover&quot; rel=&quot;kevin.albertson&quot;&gt;kevin.albertson&lt;/a&gt;: Assigning this to you for review.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1984689">MONGOCRYPT-383</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i03gzj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>