Open ChuanDou2021 opened 2 years ago
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
tosgx
dose work, but in some crates that depend onlibc
, it may cause the detectiontarget_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. https://github.com/gramineproject/graphene/issues/966
but in some crates that depend on libc, it may cause the detection target_env to fail.
I see, seems no perfect solution for the problem, thanks for you reply
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.