<?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 Fix to compile error for in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185059#M3685</link>
    <description>&lt;P&gt;Fix to compile error for kernels past 5.4.0 is "easy":&amp;nbsp; Ubuntu version shouldn't matter.&lt;/P&gt;&lt;P&gt;Jim B.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;diff --git a/driver/linux/encl.c b/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;index b049839..8e8e861 100644&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;--- a/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+++ b/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;@@ -134,6 +134,7 @@ static struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl,&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return entry;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;}&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+#if (LINUX_VERSION_CODE &amp;lt; KERNEL_VERSION(5,4,0))&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;static void sgx_encl_mm_release_deferred(struct rcu_head *rcu)&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;{&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct sgx_encl_mm *encl_mm =&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;@@ -141,6 +142,7 @@ static void sgx_encl_mm_release_deferred(struct rcu_head *rcu)&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kfree(encl_mm);&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;}&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+#endif&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 17:49:30 GMT</pubDate>
    <dc:creator>James_B_Intel2</dc:creator>
    <dc:date>2020-06-12T17:49:30Z</dc:date>
    <item>
      <title>Linux SGX SampleCodes failure in Hardware Mode</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185057#M3683</link>
      <description>&lt;P&gt;Hi! I tried installing the SGX driver, PSW and SDK following the latest installation guide: &lt;A href="https://download.01.org/intel-sgx/sgx-linux/2.9.1/docs/Intel_SGX_Installation_Guide_Linux_2.9.1_Open_Source.pdf" target="_blank"&gt;https://download.01.org/intel-sgx/sgx-linux/2.9.1/docs/Intel_SGX_Installation_Guide_Linux_2.9.1_Open_Source.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am able to build the sample codes in every mode, however running them in hardware modes fails(simulation mode works fine).&lt;/P&gt;&lt;P&gt;For example, SampleEnclave outputs "Unexpected error" and LocalAttestation outputs "fail to load enclave" in hw mode.&lt;/P&gt;&lt;P&gt;The only driver I was able to install is the OOT one (Ubuntu 18 version 2.6). When I tried to install the Ubuntu 18 driver version 1.32, I got the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screenshot from 2020-05-22 16-51-12.jpg"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/10727iFC8F2E2C30CCB2D7/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot from 2020-05-22 16-51-12.jpg" alt="Screenshot from 2020-05-22 16-51-12.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The make.log:&lt;/P&gt;
&lt;PRE class="brush:; class-name:dark;"&gt;DKMS make.log for sgx-1.32 for kernel 5.4.0-31-generic (x86_64)
Fri 22 May 2020 04:51:03 PM EEST
make -C /lib/modules/5.4.0-31-generic/build M=/var/lib/dkms/sgx/1.32/build CFLAGS_MODULE="-I/var/lib/dkms/sgx/1.32/build -I/var/lib/dkms/sgx/1.32/build/include" modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-31-generic'
  CC &lt;M&gt;  /var/lib/dkms/sgx/1.32/build/encl.o
In file included from ./include/asm-generic/bug.h:5,
                 from ./arch/x86/include/asm/bug.h:83,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/mm.h:9,
                 from /var/lib/dkms/sgx/1.32/build/encl.c:5:
/var/lib/dkms/sgx/1.32/build/encl.c: In function ‘sgx_encl_mm_release_deferred’:
./include/linux/kernel.h:994:51: error: ‘struct sgx_encl_mm’ has no member named ‘rcu’
  994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)-&amp;gt;member) &amp;amp;&amp;amp; \
      |                                                   ^~
./include/linux/compiler.h:330:9: note: in definition of macro ‘__compiletime_assert’
  330 |   if (!(condition))     \
      |         ^~~~~~~~~
./include/linux/compiler.h:350:2: note: in expansion of macro ‘_compiletime_assert’
  350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/kernel.h:994:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
  994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)-&amp;gt;member) &amp;amp;&amp;amp; \
      |  ^~~~~~~~~~~~~~~~
./include/linux/kernel.h:994:20: note: in expansion of macro ‘__same_type’
  994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)-&amp;gt;member) &amp;amp;&amp;amp; \
      |                    ^~~~~~~~~~~
/var/lib/dkms/sgx/1.32/build/encl.c:140:3: note: in expansion of macro ‘container_of’
  140 |   container_of(rcu, struct sgx_encl_mm, rcu);
      |   ^~~~~~~~~~~~
In file included from &amp;lt;command-line&amp;gt;:
././include/linux/compiler_types.h:129:35: error: ‘struct sgx_encl_mm’ has no member named ‘rcu’
  129 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
      |                                   ^~~~~~~~~~~~~~~~~~
./include/linux/stddef.h:17:32: note: in expansion of macro ‘__compiler_offsetof’
   17 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
      |                                ^~~~~~~~~~~~~~~~~~~
./include/linux/kernel.h:997:21: note: in expansion of macro ‘offsetof’
  997 |  ((type *)(__mptr - offsetof(type, member))); })
      |                     ^~~~~~~~
/var/lib/dkms/sgx/1.32/build/encl.c:140:3: note: in expansion of macro ‘container_of’
  140 |   container_of(rcu, struct sgx_encl_mm, rcu);
      |   ^~~~~~~~~~~~
At top level:
/var/lib/dkms/sgx/1.32/build/encl.c:137:13: warning: ‘sgx_encl_mm_release_deferred’ defined but not used [-Wunused-function]
  137 | static void sgx_encl_mm_release_deferred(struct rcu_head *rcu)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:275: /var/lib/dkms/sgx/1.32/build/encl.o] Error 1
make[1]: *** [Makefile:1719: /var/lib/dkms/sgx/1.32/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-31-generic'
make: *** [Makefile:22: default] Error 2&lt;/M&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, after installing the PSW, the aesmd.service could not be found.&lt;/P&gt;
&lt;P&gt;The guide says that:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screenshot from 2020-05-22 17-33-35.jpg"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/10728i81B019705BE67AD9/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot from 2020-05-22 17-33-35.jpg" alt="Screenshot from 2020-05-22 17-33-35.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, there is no uRTS or AESM library in the directories indicated, nor the aesm.conf in /etc. Trying to uninstall the PSW and reinstall it gives the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screenshot from 2020-05-22 17-29-52.jpg"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/10729iF82747D074231B2E/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot from 2020-05-22 17-29-52.jpg" alt="Screenshot from 2020-05-22 17-29-52.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;System Information:&lt;/P&gt;
&lt;P&gt;OS: Ubuntu 20.04 LTS&lt;/P&gt;
&lt;P&gt;Processor: Intel® Core™ i7-7500U CPU @ 2.70GHz × 4&lt;/P&gt;
&lt;P&gt;The SGX is enabled in BIOS. Ubuntu is booting in Legacy Mode, Secure Mode OFF.&lt;/P&gt;
&lt;P&gt;Also, I have Ubuntu in dual boot with Windows 10. I am able to work with SGX in Windows, I have the drivers, PSW and SDK installed and are working fine.&lt;/P&gt;
&lt;P&gt;Alternatively I tried to enable SGX in Ubuntu following &lt;A href="https://github.com/intel/linux-sgx" target="_blank"&gt;https://github.com/intel/linux-sgx&lt;/A&gt;, but did not have any more success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 14:55:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185057#M3683</guid>
      <dc:creator>Criston__Anna</dc:creator>
      <dc:date>2020-05-22T14:55:41Z</dc:date>
    </item>
    <item>
      <title>Hello Anna,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185058#M3684</link>
      <description>&lt;P&gt;Hello Anna,&lt;/P&gt;&lt;P&gt;Unfortunately, SGX is not yet supported in Ubuntu 20.04 and we don't have a workaround at the moment.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 19:42:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185058#M3684</guid>
      <dc:creator>JesusG_Intel</dc:creator>
      <dc:date>2020-05-26T19:42:45Z</dc:date>
    </item>
    <item>
      <title>Fix to compile error for</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185059#M3685</link>
      <description>&lt;P&gt;Fix to compile error for kernels past 5.4.0 is "easy":&amp;nbsp; Ubuntu version shouldn't matter.&lt;/P&gt;&lt;P&gt;Jim B.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;diff --git a/driver/linux/encl.c b/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;index b049839..8e8e861 100644&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;--- a/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+++ b/driver/linux/encl.c&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;@@ -134,6 +134,7 @@ static struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl,&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return entry;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;}&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+#if (LINUX_VERSION_CODE &amp;lt; KERNEL_VERSION(5,4,0))&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;static void sgx_encl_mm_release_deferred(struct rcu_head *rcu)&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;{&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct sgx_encl_mm *encl_mm =&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;@@ -141,6 +142,7 @@ static void sgx_encl_mm_release_deferred(struct rcu_head *rcu)&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kfree(encl_mm);&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;}&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;+#endif&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 17:49:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Linux-SGX-SampleCodes-failure-in-Hardware-Mode/m-p/1185059#M3685</guid>
      <dc:creator>James_B_Intel2</dc:creator>
      <dc:date>2020-06-12T17:49:30Z</dc:date>
    </item>
  </channel>
</rss>

