You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I built a demo to calc Sha256,but got Illegal instruction (core dumped).
The Sha256 comes from crate sha2.
cd samplecode/helloworld
BUILD_STD=cargo make
cd bin
./app
[+] Init Enclave Successful 2!
This is a normal world string passed into Enclave!
target_env = not sgx
Illegal instruction (core dumped)
After some research,I found crate cpufeatures which sha2's dependent library failed detect target_env = "sgx", cpufeatures uses cpuid to check cpu features, then crash.
And I found the file x86_64-unknown-linux-sgx.json, assign env the value gnu , than's the problem, if I change env value from gnu to sgx, it's ok.
[+] Init Enclave Successful 2!
This is a normal world string passed into Enclave!
target_env = sgx
This is a in-Enclave Rust string!
[+] ECall Success...
My question is: should I keep sgx value in x86_64-unknown-linux-sgx.json?
In your example, assigning the value of env to sgx dose work, but in some crates that depend on libc, it may cause the detection target_env to fail.
For the processing of the CPUID instruction, you can refer to the example code httpreq.
In your example, assigning the value of env to sgx dose work, but in some crates that depend on libc, it may cause the detection target_env to fail. For the processing of the CPUID instruction, you can refer to the example code httpreq.
Retrieving "CPUID" information through ocalls without sanitizing checking could be dangerous, especially for crypto libraries. gramineproject/graphene#966
I built a demo to calc Sha256,but got
Illegal instruction (core dumped)
.The Sha256 comes from crate sha2.
After some research,I found crate
cpufeatures
whichsha2
's dependent library failed detecttarget_env = "sgx"
,cpufeatures
usescpuid
to check cpu features, then crash.And I found the file x86_64-unknown-linux-sgx.json, assign
env
the valuegnu
, than's the problem, if I changeenv
value fromgnu
tosgx
, it's ok.My question is
: should I keepsgx
value inx86_64-unknown-linux-sgx.json
?This is my demo codes:
Thanks.
The text was updated successfully, but these errors were encountered: