wasmi icon indicating copy to clipboard operation
wasmi copied to clipboard

core dumped when using with SGX

Open brenzi opened this issue 6 years ago • 4 comments

I'm trying to use some of parity substrate in sgx (the srml-contract module). I know that rust-sgx-sdk includes a fork of wasmi below third-party and I successfully ran the respective samplecode. As I saw that @elichai filing PR's over here I thought that payritytech/wasmi is actually catching up to work on SGX. It actually does build, but:

The Problem I get

Illegal instruction (core dumped)

as soon as I try to invoke a call to wasm. To be precise, core gets dumped here.

Reproduce

git clone https://github.com/scs/substraTEE-worker.git
cd substraTee-worker
git checkout brenzi-contract-modular
make
./bin/app getsignkey

brenzi avatar May 18 '19 15:05 brenzi

Try and compile without --release and see if it's the same error as this : https://github.com/baidu/rust-sgx-sdk/issues/105

It probably is. Right now I still use a fork of wasmi with sgx_tstd, but this problem might be fixed in the allocator of baidu

(using sgx_tstd helps because it uses the regular hashmap which unlike hashbrown doesn't rely directly on pointer alignments)

elichai avatar May 18 '19 15:05 elichai

I'm already building without --release. I just modified the Makefile today to try sgx-gdb (sorry, forgot to push my repo when posting before). Can you point me to your branch so I can try?

brenzi avatar May 18 '19 15:05 brenzi

https://github.com/enigmampc/wasmi/tree/sgx-1.0.7

elichai avatar May 18 '19 16:05 elichai

I had to increase heap size in enclave.config.xml

 <HeapMaxSize>0x20000000</HeapMaxSize>

a more graceful failure would be nice, but in this case I'm not sure wasmi could help as it was a failure caused by rust-sgx-sdk config

brenzi avatar May 20 '19 09:05 brenzi

Closing this issue since it is super old and probably equally outdated. Also the legacy wasmi engine for which this bug has been reported is no longer supported by us.

Robbepop avatar Aug 22 '22 18:08 Robbepop