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

illegal instruction error with sgx switchless mode working with intel-sgx-ssl #40

Open
weicz11 opened this issue Jun 26, 2019 · 1 comment

Comments

@weicz11
Copy link

weicz11 commented Jun 26, 2019

Hi
I encountered "illegal instruction" error when I use sgx switchless mode with intel-sgx-ssl
My link flags are
Enclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) -L${SECP256K1_LIB_PATH} -L${SGX_SSL}/lib64 \ -Wl,--whole-archive -lsgx_tswitchless -lsecp256k1 -l$(Trts_Library_Name) -lsgx_tsgxssl -lsgx_tsgxssl_crypto -Wl,--no-whole-archive \ -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_tcrypto -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ -Wl,--defsym,__ImageBase=0 -Wl,--gc-sections \ -Wl,--version-script=enclave/enclave.lds
and there are two illegal instruction signals before the program exit in sgx-gdb as shown below
`
Program received signal SIGILL, Illegal instruction.
abort () at trts_pic.S:562
562 ud2
Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7_3.5.x86_64 libgcc-4.8.5-36.el7_6.2.x86_64 libstdc++-4.8.5-36.el7_6.2.x86_64 protobuf-2.5.0-8.el7.x86_64 zlib-1.2.7-18.el7.x86_64
(gdb) bt
#0 abort () at trts_pic.S:562
#1 0x00007fffe804bb9c in init_exception_handler ()
#2 0x00007fffe802f225 in const_init_exception_handler ()
#3 0x00007fffe8049819 in do_ctors_aux () at global_init.c:157
#4 0x00007fffe80498c9 in init_global_object () at global_init.c:186
#5 0x00007fffe804725b in trts_ecall (ordinal=4294967290, ms=0x604550) at trts_ecall.cpp:272
#6 0x00007fffe8047aef in _random_stack_noinline_wrapper<_status_t, unsigned int, void*, int&, void*&> (f=0x7fffe80471a6 <trts_ecall(uint32_t, void*)>)
at /root/tee_special/linux-sgx/common/inc/sgx_random_buffers.h:76
#7 0x00007fffe8047a90 in random_stack_advance<2048u, _status_t<unsigned int, void*>, int&, void*&> (f=0x7fffe80471a6 <trts_ecall(uint32_t, void*)>)
at /root/tee_special/linux-sgx/common/inc/sgx_random_buffers.h:95
#8 0x00007fffe804765b in do_ecall (index=-6, ms=0x604550, tcs=0x7fffebe5c000) at trts_ecall.cpp:375
#9 0x00007fffe81abdc6 in enter_enclave (index=-6, ms=0x604550, tcs=0x7fffebe5c000, cssa=0) at trts_nsp.cpp:96
#10 0x00007fffe81abf95 in enclave_entry () at trts_pic.S:164
#11 0x00007ffff7ba3de0 in __morestack () at enter_enclave.S:77
#12 0x00007ffff7bb4976 in do_ecall (fn=-6, ocall_table=0x0, ms=0x604550, trust_thread=0x604f10) at sig_handler.cpp:240
#13 0x00007ffff7bab958 in CEnclave::ecall (this=0x604c10, proc=-6, ocall_table=0x0, ms=0x604550, is_switchless=false) at /root/tee_special/linux-sgx/psw/urts/enclave.cpp:328
#14 0x00007ffff7bab040 in CEnclave::init_uswitchless (this=0x604c10, config=0x7fffffffe200) at /root/tee_special/linux-sgx/psw/urts/enclave.cpp:95
#15 0x00007ffff7bb1c23 in __create_enclave (parser=..., base_addr=0x7ffff5ecf000 "\177ELF\002\001\001", metadata=0x7ffff6118e55, file=..., debug=true, lc=0x607070, prd_css_file=0x0,
enclave_id=0x602210 <global_eid>, misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:473
#16 0x00007ffff7bb21dd in _create_enclave_from_buffer_ex (debug=true, base_addr=0x7ffff5ecf000 "\177ELF\002\001\001", file_size=3397720, file=..., prd_css_file=0x0,
enclave_id=0x602210 <global_eid>, misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:596
#17 0x00007ffff7bb2358 in _create_enclave_ex (debug=true, pfile=7, file=..., prd_css_file=0x0, launch=0x0, launch_updated=0x0, enclave_id=0x602210 <global_eid>, misc_attr=0x0,
ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:637
#18 0x00007ffff7bb269e in __sgx_create_enclave_ex (file_name=0x40155f "enclave.signed.so", debug=1, launch_token=0x0, launch_token_updated=0x0, enclave_id=0x602210 <global_eid>,
misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at urts.cpp:99
#19 0x00007ffff7bb27e2 in sgx_create_enclave_ex (file_name=0x40155f "enclave.signed.so", debug=1, launch_token=0x0, launch_token_updated=0x0, enclave_id=0x602210 <global_eid>,
misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at urts.cpp:134
#20 0x0000000000400f5a in initialize_enclave () at app/app.cpp:136
#21 0x0000000000400fbc in main (argc=1, argv=0x7fffffffe488) at app/app.cpp:167
(gdb)

(gdb) c
Continuing.
[sig_handler sig_handler.cpp:93] signal handler is triggered
[sig_handler sig_handler.cpp:111] exception on ERESUME
[sig_handler sig_handler.cpp:149] NOT enclave signal

Program received signal SIGILL, Illegal instruction.
0x00007ffff799023b in raise () from /lib64/libpthread.so.0
(gdb) bt
#0 0x00007ffff799023b in raise () from /lib64/libpthread.so.0
#1 0x00007ffff7bb451c in sig_handler (signum=4, siginfo=0x7fffffffaf70, priv=0x7fffffffae40) at sig_handler.cpp:155
#2
#3 0x00007ffff7ba3e43 in __morestack () at enter_enclave.S:133
#4 0x00007ffff7bb4976 in do_ecall (fn=-6, ocall_table=0x0, ms=0x604550, trust_thread=0x604f10) at sig_handler.cpp:240
#5 0x00007ffff7bab958 in CEnclave::ecall (this=0x604c10, proc=-6, ocall_table=0x0, ms=0x604550, is_switchless=false) at /root/tee_special/linux-sgx/psw/urts/enclave.cpp:328
#6 0x00007ffff7bab040 in CEnclave::init_uswitchless (this=0x604c10, config=0x7fffffffe200) at /root/tee_special/linux-sgx/psw/urts/enclave.cpp:95
#7 0x00007ffff7bb1c23 in __create_enclave (parser=..., base_addr=0x7ffff5ecf000 "\177ELF\002\001\001", metadata=0x7ffff6118e55, file=..., debug=true, lc=0x607070, prd_css_file=0x0,
enclave_id=0x602210 <global_eid>, misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:473
#8 0x00007ffff7bb21dd in _create_enclave_from_buffer_ex (debug=true, base_addr=0x7ffff5ecf000 "\177ELF\002\001\001", file_size=3397720, file=..., prd_css_file=0x0,
enclave_id=0x602210 <global_eid>, misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:596
#9 0x00007ffff7bb2358 in _create_enclave_ex (debug=true, pfile=7, file=..., prd_css_file=0x0, launch=0x0, launch_updated=0x0, enclave_id=0x602210 <global_eid>, misc_attr=0x0,
ex_features=2, ex_features_p=0x7fffffffe240) at /root/tee_special/linux-sgx/psw/urts/urts_com.h:637
#10 0x00007ffff7bb269e in __sgx_create_enclave_ex (file_name=0x40155f "enclave.signed.so", debug=1, launch_token=0x0, launch_token_updated=0x0, enclave_id=0x602210 <global_eid>,
misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at urts.cpp:99
#11 0x00007ffff7bb27e2 in sgx_create_enclave_ex (file_name=0x40155f "enclave.signed.so", debug=1, launch_token=0x0, launch_token_updated=0x0, enclave_id=0x602210 <global_eid>,
misc_attr=0x0, ex_features=2, ex_features_p=0x7fffffffe240) at urts.cpp:134
#12 0x0000000000400f5a in initialize_enclave () at app/app.cpp:136
#13 0x0000000000400fbc in main (argc=1, argv=0x7fffffffe488) at app/app.cpp:167
`

Is there anything wrong? Does intel-sgx-ssl support sgx swichless mode?

Thanks

@weicz11 weicz11 changed the title illegal instruction error with sgx switchless mode illegal instruction error with sgx switchless mode working with intel-sgx-ssl Jun 26, 2019
@tyler-lee
Copy link

Hi @weicz11 , I also encountered this error too. How do you fix it?

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

No branches or pull requests

2 participants