intel / intel/confidential-computing.sgx.sdk

SampleDNNL throws error "Illegal instruction"

Open
#107 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I am running Ubuntu 20.04. I was able to build and run `SampleDNNL` code using SIM and HW mode. The code runs without errors in SIM mode, but gives an error in HW mode. I'm able to run other SampleCodes with HW mode perfectly.

```
~/linux-sgx/SampleCode/SampleDNNL$ ./app
Intel(R) Deep Neural Network Library (DNNL)
Illegal instruction (core dumped)
~/linux-sgx/SampleCode/SampleDNNL$

```
How to debug this?
I didnt get much help using `sgx-gdb `as well except that error occurs after ecall.

```
~/linux-sgx/SampleCode/SampleDNNL$ sgx-gdb ./app
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Source directories searched: ~/linux-sgx/linux/installer/bin/sgxsdk/lib64/gdb-sgx-plugin:$cdir:$cwd
Setting environment variable "LD_PRELOAD" to null value.
Reading symbols from ./app...
Loading libc++ pretty-printers.
(gdb) r
Starting program: ~/linux-sgx/SampleCode/SampleDNNL/app
detect urts is loaded, initializing
Function "notify_gdb_to_update" not defined.
Function "sgx_debug_load_state_add_element" not defined.
Function "sgx_debug_unload_state_remove_element" not defined.
Function "urts_add_tcs" not defined.
Python Exception No symbol "g_debug_enclave_info_list" in current context.:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Intel(R) Deep Neural Network Library (DNNL)
[New Thread 0x7ffff7a03700 (LWP 220165)]
[New Thread 0x7ffff7202700 (LWP 220166)]
[New Thread 0x7ffff6a01700 (LWP 220167)]
[New Thread 0x7ffff6200700 (LWP 220168)]
[New Thread 0x7ffff59ff700 (LWP 220169)]

Thread 1 "app" received signal SIGILL, Illegal instruction.
0x00007ffe0102543e in ?? ()
(gdb) bt
#0 0x00007ffe0102543e in ?? ()
intel/confidential-computing.sgx#1 0x00007ffe00fe214f in ?? ()
intel/confidential-computing.sgx#2 0x00007ffe9148cc80 in ?? ()
intel/confidential-computing.sgx#3 0x00007ffe00fe12e1 in ?? ()
intel/confidential-computing.sgx#4 0x00007ffe020adaa0 in ?? ()
intel/confidential-computing.sgx#5 0x00007ffe9148ca10 in ?? ()
intel/confidential-computing.sgx#6 0x0000000000000000 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb)

```

```
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=21845, argv=0x7ffff7d992e8 <__exit_funcs_lock>) at App/App.cpp:168
168 {
(gdb) n
171 sgx_status_t ret = SGX_SUCCESS;
(gdb)
172 int retval = 0;
(gdb)
173 sgx_enclave_id_t eid = 0;
(gdb)
177 ret = sgx_create_enclave(ENCLAVE_NAME, SGX_DEBUG_FLAG, NULL, NULL, &eid, NULL);
(gdb)
178 if(ret != SGX_SUCCESS)
(gdb)
184 cout<<"Intel(R) Deep Neural Network Library (DNNL)" <) at App/Enclave_u.c:263
263 {
(gdb)
266 status = sgx_ecall(eid, 9, &ocall_table_Enclave, &ms);
(gdb)
[New Thread 0x7ffff7a03700 (LWP 220829)]
[New Thread 0x7ffff7202700 (LWP 220830)]
[New Thread 0x7ffff6a01700 (LWP 220831)]
[New Thread 0x7ffff6200700 (LWP 220832)]
[New Thread 0x7ffff59ff700 (LWP 220833)]

Thread 1 "app" received signal SIGILL, Illegal instruction.
0x00007ffe0102543e in ?? ()
(gdb)

```

SGX_SDK version: 2.15.101.1

Contributor guide

Open the contributing guide

Research direction

Start with SampleCode/SampleDNNL/App/App.cpp and the generated App/Enclave_u.c entry point for getting_started, then reproduce the failure in HW mode with sgx-gdb and compare it with SIM mode. Done means identifying the source of the SIGILL after the ecall and documenting a concrete fix or supported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
machine-learning, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.