intel / intel/confidential-computing.sgx.sdk
The intel sgx running process program skips ecall execution, and Illegal instruction (core dumped) occurs
- Dominant language
- C++
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
The intel sgx running process program skips ecall execution, and Illegal instruction (core dumped) occurs
I Edit program by Multithreading accesssing ecall
sometimes ,I test Program ,the program will jump over "ecall function " without running finished ,and report “ Illegal instruction (core dumped)”
How ever a cannot find errror
In a multi-threaded environment,one /two thread do
ecall_commit_message(global_eid, Messages, Encry, shareTwo, Active_node_serial_number);
```
void ecall_commit_message(char* Msg, char* Encry, char* shareTwo, int Number_active_nodes) {
printf("%d%s\n",Number_active_nodes,"gett ecalling " );
char Messages[963 + 1] = {0};
Messages[963] = '\0';
char delims[] = ",";
strncpy(Messages, Msg, 963);
string share = strtok(Messages, delims);
printf("%d%s\n",Number_active_nodes,share.c_str());
string str_hash_c_v = strtok(NULL, delims);
string str_hash_c_v_signature_gx = strtok(NULL, delims);
string str_hash_c_v_signature_gy = strtok(NULL, delims);
printf("%d%s\n",Number_active_nodes,"处理跳入的ecall 数据和内容" );
printf("%d %s %d\n",Number_active_nodes,str_hash_c_v.c_str() ,str_hash_c_v.size());
uint8_t * p_data = str_To_uint8_t(str_hash_c_v, str_hash_c_v.size());
printf("%d%s\n",Number_active_nodes,"找到错误的节点1" );
sgx_ec256_signature_t signature = {0};
uint8_t * signature_gx = str_To_uint8_t(str_hash_c_v_signature_gx, str_hash_c_v_signature_gx.size());
printf("%d%s\n",Number_active_nodes,"找到错误的节点2" );
for (int i = 0; i < 8; ++i) {
signature.x[i] = (signature_gx[i * 4] << 24) | (signature_gx[i * 4 + 1] << 16) | (signature_gx[i * 4 + 2] << 8) | (signature_gx[i * 4 + 3]);
}
printf("%d%s\n",Number_active_nodes,"找到错误的节点3" );
uint8_t * signature_gy = str_To_uint8_t(str_hash_c_v_signature_gy, str_hash_c_v_signature_gy.size());
for (int i = 0; i < 8; i++) {
signature.y[i] = (signature_gy[i * 4] << 24) | (signature_gy[i * 4 + 1] << 16) | (signature_gy[i * 4 + 2] << 8) | (signature_gy[i * 4 + 3]);
}
printf("%d%s\n", Number_active_nodes,"找到错误的节点4");
uint8_t * share_value = str_To_uint8_t(share, 128);
printf("%d%s\n",Number_active_nodes,"找到错误的消息点5" );
uint8_t c[4] = {0};
uint8_t v[4] = {0};
uint32ToUint8(&Clatest[Number_active_nodes], c);
uint32ToUint8(&V[Number_active_nodes], v);
sgx_sha256_hash_t hash = {0};
sgx_sha_state_handle_t p_sha_handle;
sgx_sha256_init(&p_sha_handle);
sgx_sha256_update(share_value, 16, p_sha_handle);
sgx_sha256_update(c, 4, p_sha_handle);
sgx_sha256_update(v, 4, p_sha_handle);
sgx_sha256_get_hash(p_sha_handle, &hash);
sgx_sha256_close(p_sha_handle);
for (int i = 0; i < 32; i++) {
if (shareHash[Number_active_nodes][i] == hash[i]) {
} else {
printf("%s\n", "share_counter_view_hash fail");
abort();
}
}
unsigned char* tag = NULL;
uint8_t* p_src = str_To_uint8_t(Encry + 448, 448);
uint8_t * p_dst = (uint8_t*)malloc(56 * sizeof(uint8_t));
memset_s(p_dst, 56, 0, 56);
if (strncmp(verify_counter(p_data, &signature, &Leader_node_public_key, p_src, &key[Number_active_nodes], tag, p_dst, Number_active_nodes), "COUNTER OK", 10) != 0) {
abort();
}
string res = "" ;
for (int i = 0; i < 16; ++i) {
res += change((char)p_dst[i]);
}
strncpy(shareTwo, res.c_str(), 128);
printf("%d%s\n",Number_active_nodes ,"完成 commit 确认");
return ;
}
```
The program always skips ecall “ecall_commit_message” with finishing function ,and
report:
2跳入ecall 发生错误
1跳入ecall 发生错误
210011011111011010011000100111000001001100100010111010111001010110000011100001110001001100011001100111001101000010101101101000100
110011011111011010011000100111000001001100100010111010111001010110000011100001110001001100011001100111001101000010101101101000100
2处理跳入的ecall 数据和内容
2ecall 处理完成
2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
处理完子节点 share
节点编号:2发送父节点完成,时间戳:1615707009018624
发送给父节点的shareTWOxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
接收加密数据,处理一轮数据!
Illegal instruction (core dumped)
any suggestion will help me ,3Q
Contributor guide
Assessment
This issue has not been assessed yet.