<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to pass a structure pointer of a recursive structure between Enclave and Untrust memory in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1392787#M5332</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have escalated this issue further. I will let you know when I have more information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;Sahira&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 21:35:48 GMT</pubDate>
    <dc:creator>Sahira_Intel</dc:creator>
    <dc:date>2022-06-15T21:35:48Z</dc:date>
    <item>
      <title>How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1390511#M5323</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to pass a recursive structure to Untrust memory with Ocall. However, when I try to access the next member of the structure, I get a Segmentation Fault.&lt;BR /&gt;What should I do to correctly pass the structure of the recursive structure? I would like to know if anyone can help me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the sample below, the process transits to the Enclave with ecall_enter(), creates an instance of the recursive structure there, and passes it to the Untrust area with ocall_struct_test_func4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;recursive structure in edl (OcallClassTest4)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;struct OcallStructTest4 {
        [size=100] char* ident;
        struct OcallStructTest4* next;
};&lt;/LI-CODE&gt;
&lt;P&gt;ecall_enter&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void ecall_enter() {
    OcallStructTest4* ocall_struct_test4 = new OcallStructTest4();
    ocall_struct_test4-&amp;gt;ident            = "hello struct!";
    ocall_struct_test4-&amp;gt;next             = new OcallStructTest4();
    OcallStructTest4* next               = ocall_struct_test4-&amp;gt;next;
    next-&amp;gt;ident                          = "hello next!!!";
    ocall_struct_test_func4(ocall_struct_test4);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;ocall_struct_test_func4&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void ocall_struct_test_func4(OcallStructTest4* ocall_struct_test4) {
    std::cout &amp;lt;&amp;lt; "ocall struct test func4 start.\n";
    std::cout &amp;lt;&amp;lt; ocall_struct_test4-&amp;gt;ident &amp;lt;&amp;lt; std::endl;

    OcallStructTest4* next = ocall_struct_test4-&amp;gt;next;
    std::cout &amp;lt;&amp;lt; "next ident" &amp;lt;&amp;lt; next-&amp;gt;ident &amp;lt;&amp;lt; std::endl;
}&lt;/LI-CODE&gt;
&lt;P&gt;ocall definition in edl&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void ocall_struct_test_func4([in] struct OcallStructTest4* ocall_struct_test);&lt;/LI-CODE&gt;
&lt;P&gt;Execution result&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ocall struct test func4 start.
hello struct!
Segmentation fault
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 06:59:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1390511#M5323</guid>
      <dc:creator>wwfbear789</dc:creator>
      <dc:date>2022-06-07T06:59:01Z</dc:date>
    </item>
    <item>
      <title>Re:How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1391069#M5324</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You might need to increase heap size. Seg fault usually means there is not enough memory allocated to the enclave&lt;/P&gt;&lt;P&gt;Can you please send over your enclave config file so I can take a look.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Sahira &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2022 21:50:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1391069#M5324</guid>
      <dc:creator>Sahira_Intel</dc:creator>
      <dc:date>2022-06-08T21:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1391303#M5328</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;BR /&gt;The config file for Enclave is below (the application I am currently making is based on SampleEnclave from SampleCode, and the config file has not been changed).&lt;/P&gt;
&lt;P&gt;Enclave.config.xml&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;EnclaveConfiguration&amp;gt;
  &amp;lt;ProdID&amp;gt;0&amp;lt;/ProdID&amp;gt;
  &amp;lt;ISVSVN&amp;gt;0&amp;lt;/ISVSVN&amp;gt;
  &amp;lt;StackMaxSize&amp;gt;0x40000&amp;lt;/StackMaxSize&amp;gt;
  &amp;lt;HeapMaxSize&amp;gt;0x100000&amp;lt;/HeapMaxSize&amp;gt;
  &amp;lt;TCSNum&amp;gt;10&amp;lt;/TCSNum&amp;gt;
  &amp;lt;TCSPolicy&amp;gt;1&amp;lt;/TCSPolicy&amp;gt;
  &amp;lt;!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release --&amp;gt;
  &amp;lt;DisableDebug&amp;gt;0&amp;lt;/DisableDebug&amp;gt;
  &amp;lt;MiscSelect&amp;gt;0&amp;lt;/MiscSelect&amp;gt;
  &amp;lt;MiscMask&amp;gt;0xFFFFFFFF&amp;lt;/MiscMask&amp;gt;
&amp;lt;/EnclaveConfiguration&amp;gt;
&lt;/LI-CODE&gt;
&lt;P&gt;Also, I have a question, is it not possible to access the next referenced data just by passing the pointer of the self-reference structure from the Enclave to the Untrust area (or vice versa)?&lt;BR /&gt;Currently I am not able to do that, so I am using a technique such as passing a uint8_t* converted to a byte string. Is there another smarter way?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 14:32:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1391303#M5328</guid>
      <dc:creator>wwfbear789</dc:creator>
      <dc:date>2022-06-09T14:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1392787#M5332</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have escalated this issue further. I will let you know when I have more information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;Sahira&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 21:35:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1392787#M5332</guid>
      <dc:creator>Sahira_Intel</dc:creator>
      <dc:date>2022-06-15T21:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1392845#M5333</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;
&lt;P&gt;I am sorry for the trouble. I&amp;nbsp;&lt;SPAN&gt;look forward to hearing back from you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sincerely&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;wwfbear789&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 02:35:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1392845#M5333</guid>
      <dc:creator>wwfbear789</dc:creator>
      <dc:date>2022-06-16T02:35:21Z</dc:date>
    </item>
    <item>
      <title>Re:How to pass a structure pointer of a recursive structure between Enclave and Untrust memory</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1394611#M5348</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;No trouble at all. &lt;/P&gt;&lt;P&gt;In the SGX Developer Guide, there is a section on Structure Deep Copy: &lt;A href="https://download.01.org/intel-sgx/latest/linux-latest/docs/Intel_SGX_Developer_Reference_Linux_2.17_Open_Source.pdf#page=56" target="_blank"&gt;https://download.01.org/intel-sgx/latest/linux-latest/docs/Intel_SGX_Developer_Reference_Linux_2.17_Open_Source.pdf#page=56&lt;/A&gt; &lt;/P&gt;&lt;P&gt;There is a sample there that you can follow that might help&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Sahira&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Jun 2022 20:55:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-pass-a-structure-pointer-of-a-recursive-structure-between/m-p/1394611#M5348</guid>
      <dc:creator>Sahira_Intel</dc:creator>
      <dc:date>2022-06-22T20:55:11Z</dc:date>
    </item>
  </channel>
</rss>

