<!-- 
RSS generated by JIRA (9.4.5#940005-sha1:e3094934eac4fd8653cf39da58f39364fb9cc7c1) at Sat Feb 10 06:02:15 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>Akraino JIRA</title>
    <link>https://jira.akraino.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.5</version>
        <build-number>940005</build-number>
        <build-date>11-04-2023</build-date>
    </build-info>


<item>
            <title>[IEC-26] [IEC][SEBA][PONSim] cord-tester setup_venv fails: pynacl pwhash_scrypt out of memory </title>
                <link>https://jira.akraino.org/browse/IEC-26</link>
                <project id="10201" key="IEC">Integrated Edge Cloud</project>
                    <description>&lt;p&gt;This problem happens on aarch64 when trying to prepare the env for cord-tester testing framework. Because the pynacl python package is not compiled for aarch64, the setup_venv.sh will try to build it and in the process also runs the tests (i.e. calls make check). One of the 72 tests (pwhash_scrypt) fails after timing out and what seems to be an out of memory error.&lt;/p&gt;

&lt;p&gt;The same problem has been reported last year here:&lt;br/&gt;
&lt;a href=&quot;https://github.com/jedisct1/libsodium/issues/721&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/jedisct1/libsodium/issues/721&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the solutions suggested is to increase the memlock ulimit, which for some reason is very low by default on aarch64.&lt;/p&gt;

&lt;p&gt;I have tried setting up this ulimit in the container we use for testing and it works when running on the jenkins slave (baremetal). However the test still crashes when running the framework from the same cord-tester image but on the master node of an aarch64 virtual pod.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="10905">IEC-26</key>
            <summary>[IEC][SEBA][PONSim] cord-tester setup_venv fails: pynacl pwhash_scrypt out of memory </summary>
                <type id="10004" iconUrl="https://jira.akraino.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.akraino.org/images/icons/priorities/medium.svg">Medium</priority>
                        <status id="10001" iconUrl="https://jira.akraino.org/" description="">Done</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ciprian.barbu.enea">Ciprian Barbu</reporter>
                        <labels>
                    </labels>
                <created>Fri, 25 Oct 2019 16:35:10 +0000</created>
                <updated>Wed, 30 Oct 2019 13:39:47 +0000</updated>
                            <resolved>Wed, 30 Oct 2019 13:39:47 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="10842" author="ciprian.barbu.enea" created="Tue, 29 Oct 2019 16:53:43 +0000"  >&lt;p&gt;My bug was closed on the libsodium github repo, but I replied to this thread on pynacl:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/pyca/pynacl/issues/486&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/pyca/pynacl/issues/486&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="10840" author="ciprian.barbu.enea" created="Tue, 29 Oct 2019 15:00:57 +0000"  >&lt;p&gt;I have opened a new issue for the github repository:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/jedisct1/libsodium/issues/890&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/jedisct1/libsodium/issues/890&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="10838" author="ciprian.barbu.enea" created="Tue, 29 Oct 2019 14:30:38 +0000"  >&lt;p&gt;So it looks like there are two problems here. Most of the times (if not always) the build of pynacl will fail during the tests because the ulimit for max memory lock is very low. This is also described in the bug report mentioned in the description.&lt;/p&gt;

&lt;p&gt;The second problem was seen when running the build on the IEC master node. Here the test would suddenly start taking up more and more memory, exhausting all of the available RAM and then going on to consume the swap memory.&lt;/p&gt;

&lt;p&gt;I eventually started debugging this test case and found there is a negative test in pwhash_scrypt &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; which by the looks of it specifies an invalid encoded string which probably is supposed to cause a failure down the line when allocating memory&#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;&#160;for the decryption process. I noticed that the computed required memory goes in the range of TB, which is really not supposed to work.&lt;/p&gt;

&lt;p&gt;Searching for references on mmap not failing when large amounts of memory are requests, I ended up on this thread &lt;span class=&quot;error&quot;&gt;&amp;#91;3&amp;#93;&lt;/span&gt;, called:&lt;br/&gt;
 In a 64 bit process, will my mmap / malloc request ever be denied?&lt;/p&gt;

&lt;p&gt;One of the answers in this thread talks about memory overcommit limit, which can be set via sysctl vm.memory_overcommit. This parameter controls the amount of memory overcommit checks that the kernel performs during syscalls like mmap and related. On our IEC K8S master, this was set to 1, which means no overcommit handling is performed.&lt;/p&gt;

&lt;p&gt;Additionally, the way libsodium implements scrypt alloc_region function, it forces it to also populate the pages, which is useful under normal circumstances, but in this case, combined with the value of vm.memory_overcommit, caused the OS to exhaust all the memory trying to perform the mmap request.&lt;/p&gt;

&lt;p&gt;So the solution is to set the vm.memory_overcommit value to something that allows extra memory checks, values of 0 or 2 both work fine.&lt;/p&gt;

&lt;p&gt;But in my opinion the libsodium implementation of maybe the test case is not very well thought, since this is one valid example of configuring the OS, to allow better control for memory in virtualized environments. One could also consider this a security threat.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;&#160;&lt;a href=&quot;https://github.com/jedisct1/libsodium/blob/1.0.16/test/default/pwhash_scrypt.c#L269&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/jedisct1/libsodium/blob/1.0.16/test/default/pwhash_scrypt.c#L269&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;&#160;&lt;a href=&quot;https://github.com/jedisct1/libsodium/blob/1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c#L45&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/jedisct1/libsodium/blob/1.0.16/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c#L45&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;3&amp;#93;&lt;/span&gt;&#160;&lt;a href=&quot;https://stackoverflow.com/questions/4923116/in-a-64-bit-process-will-my-mmap-malloc-request-ever-be-denied&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/4923116/in-a-64-bit-process-will-my-mmap-malloc-request-ever-be-denied&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10105" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i002hw:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>