Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: sgx_get_aep #24

Closed
shujiecui opened this issue Jun 1, 2020 · 7 comments
Closed

undefined symbol: sgx_get_aep #24

shujiecui opened this issue Jun 1, 2020 · 7 comments

Comments

@shujiecui
Copy link

shujiecui commented Jun 1, 2020

Hi there,
I installed SGX-step by following the steps, and tried to test the samples in /app, but I always get the following errors. How could I solve it? Thanks.
./app: symbol lookup error: ./app: undefined symbol: sgx_get_aep

@jovanbulck
Copy link
Owner

HI shujiecui,

This error indicates that the linker doesn't find the customly patched SGX SDK. Did you make sure to patch and install the SGX SDK? This should be automatically taken care of when you use the "install_sdk.sh" script. The Makefiles by default expect a system-wide SDK installation under /opt/intel. You can check if this is okay on your system, eg as follows:

jo@breuer:~$ objdump -D /opt/intel/sgxsdk/lib64/libsgx_urts.so | grep sgx_get_aep
0000000000000ab6 <sgx_get_aep>:

Let me know if this works for you!

@shujiecui
Copy link
Author

Yes, I installed the driver and SDK with the scripts.
By running the above objdump command, I get: 0000000000000b86 <sgx_get_aep>:
By the way, I haven't disable C-States and SpeedStep technology in the BIOS. Does that matter?

@jovanbulck
Copy link
Owner

Okay, so since the objdump lists the symbol, patching and installing went fine indeed. Did you make sure to source /opt/intel/sgxsdk/environment in the same terminal as were you execute the make command, so that all environment variables are properly set? Also, to be sure you're not using old objects, try doing make clean first?

Re C-States and SpeedStep: no, that's not crucial. Not needed at all if you don't do single-stepping and eg only page-table manipulations. In general speedstep may somewhat improve predictability when doing timer-based single-stepping, but I found that this is not required in practice. Current versions of sgx-step furthermore already try to fix the processor clock at runtime through the MSR interface.

@shujiecui
Copy link
Author

yes, I did all that, but still not work

@jovanbulck
Copy link
Owner

Without more information, I can only guess what's going wrong on your system. I suspect you may have another SGX-SDK installed earlier through apt or so that may interfere and leave global symbolic links and make that the default path will not find the patched SDK under /opt/intel/. You should check this and/or provide more details. Particularly, try finding out which dynamic library is being used by ldd and then check whether or not it has the patches. It turns out on my system I use a patched /usr/lib/libsgx_urts.so by default. You can manually override the desired library location using the LD_LIBRARY_PATH environment variable, as shown below

jo@breuer:~/sgx-step-fresh/app/aep-redirect$ ldd ./app 
	linux-vdso.so.1 (0x00007ffebeb60000)
	libsgx_urts.so => /usr/lib/libsgx_urts.so (0x00007f8330ee2000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8330cc3000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f83308d2000)
	libsgx_enclave_common.so.1 => /usr/lib/libsgx_enclave_common.so.1 (0x00007f83306cd000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f83304c9000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8330140000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f832ff28000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f833130f000)
	libsgx_launch.so.1 => /usr/lib/libsgx_launch.so.1 (0x00007f832fcdd000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f832f93f000)
	libprotobuf.so.10 => /usr/lib/x86_64-linux-gnu/libprotobuf.so.10 (0x00007f832f4e6000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f832f2c9000)
jo@breuer:~/sgx-step-fresh/app/aep-redirect$ nm -g /usr/lib/libsgx_urts.so | grep aep
000000000000c070 T sgx_get_aep
000000000000c090 T sgx_set_aep
jo@breuer:~/sgx-step-fresh/app/aep-redirect$ LD_LIBRARY_PATH=/opt/intel/sgxsdk/lib64/ ldd ./app 
	linux-vdso.so.1 (0x00007ffc2d69c000)
	libsgx_urts.so => /opt/intel/sgxsdk/lib64/libsgx_urts.so (0x00007fa3dce26000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa3dcc07000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa3dc816000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fa3dd231000)
jo@breuer:~/sgx-step-fresh/app/aep-redirect$ nm -g /opt/intel/sgxsdk/lib64/libsgx_urts.so | grep aep
0000000000000ab6 T sgx_get_aep
0000000000000acd T sgx_set_aep

@shujiecui
Copy link
Author

shujiecui commented Jun 1, 2020

Aha, you are right. LLD doesn't link to /opt../libsgx_urts.so. Instead, it links to /user/.../libsgx_urts.so, and this one doesn't have sgx_get_aep.
Thanks for your help.

@jovanbulck
Copy link
Owner

glad it got figured out, closing this issue ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants