Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Requires libsgx_urts.so to run in SGX hardware mode #93

Closed
nhoriguchi opened this issue May 24, 2019 · 9 comments
Closed

Requires libsgx_urts.so to run in SGX hardware mode #93

nhoriguchi opened this issue May 24, 2019 · 9 comments
Assignees
Labels
documentation Improve documentation/description/comment

Comments

@nhoriguchi
Copy link
Contributor

Current installation procedure seems to cover only cases of running in SGX simulation mode. I saw the following error in running keytool generate with SGX_MODE=HW:

bin/keytool: error while loading shared libraries: libsgx_urts.so: cannot open shared object file: No such file or directory

libsgx_urts_sim.so for simulation mode is installed by SGX SDK installer sgx_linux_x64_sdk_2.3.101.46683.bin, and libsgx_urts.so for hardware mode is delivered by libsgx-enclave-common_2.3.101.46683-1_amd64.deb. So we might be better to add some instruction for users who want to run MinBFT in hardware mode.

@nhoriguchi nhoriguchi added the documentation Improve documentation/description/comment label May 24, 2019
@ynamiki
Copy link
Contributor

ynamiki commented May 27, 2019

Right, we need to install a driver and a platform software (PSW) in addition to the SDK to run the command in the hardware mode. We can update the README to ask a user to install these packages based on the Intel's Installation Guide.

@Naoya-Horiguchi Are you creating a patch for this? Shall I do this?

@nhoriguchi
Copy link
Contributor Author

@ynamiki, I'll work on this.

@nhoriguchi nhoriguchi self-assigned this May 27, 2019
@sergefdrv
Copy link
Contributor

Please check if we actually need to install PSW. MinBFT doesn't seem to use any of PSW features. If I remember correctly, it was enough to install SGX driver prior to SDK to make hardware libraries available.

@nhoriguchi
Copy link
Contributor Author

@sergefdrv, thanks for the comment. Actually libsgx_urts.so is included in Intel SGX SDK, so installing PSW is not mandatory. It seems that the problem is that libsgx_urts.so and libsgx_urts_sim.so are located under different directories, and only libsgx_urts_sim.so is available under the library path /opt/intel/sgxsdk/sdk_libs (specified in /etc/ld.so.conf.d/sgx-sdk.conf):

root@sgx3:~/tmp# find /opt/intel | grep urts
/opt/intel/sgxsdk/include/sgx_urts.h
/opt/intel/sgxsdk/lib64/libsgx_urts_sim.so
/opt/intel/sgxsdk/lib64/libsgx_urts.so
/opt/intel/sgxsdk/sdk_libs/libsgx_urts_sim.so
/opt/intel/sgxsdk/pkgconfig/libsgx_urts_sim.pc
/opt/intel/sgxsdk/pkgconfig/libsgx_urts.pc

So adding another path /opt/intel/sgxsdk/lib64 to /etc/ld.so.conf.d/sgx-sdk.conf might improve the situation?

@sergefdrv
Copy link
Contributor

@Naoya-Horiguchi thanks for investigating that. I think it would be enough to simply change /opt/intel/sgxsdk/sdk_libs to /opt/intel/sgxsdk/lib64 in /etc/ld.so.conf.d/sgx-sdk.conf in order to support both simulation- and hardware-based USIG.

@nhoriguchi
Copy link
Contributor Author

When I tried to include /opt/intel/sgxsdk/lib64 into library path, I encountered an interesting error on running usig_test:

RUN    test/usig_test                                                                    
Please use the correct uRTS library from PSW package.                                    
usig_test: test/usig_test.c:38: test_init_destroy: Assertion `usig_init(enclave_file, &ei, NULL, 0) == SGX_SUCCESS' failed.                                                       

This error message is self-descriptive and also mentioned here. We have to use the reliable version distributed with PSW library and can't use one in SGX SDK. So my current approach doesn't work 😟.

Another point is that I think we don't need to create /etc/ld.so.conf.d/sgx-sdk.conf because that doesn't become effective without running ldconfig command to update /etc/ld.so.cache. For testing purpose in simulation mode, LD_LIBRARY_PATH is updated in $SGX_SDK/environment and that's enough.

If these points sound OK, I'll update related part in README.

@sergefdrv
Copy link
Contributor

@Naoya-Horiguchi Thanks for the analysis. Indeed, we seem to have to install PSW, then. So we need to mention this in Readme file.

LD_LIBRARY_PATH is updated in $SGX_SDK/environment and that's enough

It might be a bit inconvenient to invoke $SGX_SDK/environmenteach time. So it might be useful to keep the optional advise to create /etc/ld.so.conf.d/sgx-sdk.conf. Let's just mention that sudo ldconfig has to be invoked once after adding the file.

@nhoriguchi
Copy link
Contributor Author

So it might be useful to keep the optional advise to create /etc/ld.so.conf.d/sgx-sdk.conf. Let's just mention that sudo ldconfig has to be invoked once after adding the file.

@sergefdrv I'll update #95 with this direction. Thanks for sharing ideas.

@nhoriguchi
Copy link
Contributor Author

closes by merging #96.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improve documentation/description/comment
Projects
None yet
Development

No branches or pull requests

3 participants