intel / qemu-sgx

Other
71 stars 29 forks source link

invalid object type: memory-backend-epc #10

Open 512yottabytes opened 3 years ago

512yottabytes commented 3 years ago

Hello, I've compiled sgx-kvm, installed kernel and modules, rebooted, then compiled qemu-sgx. Trying to launch it, like in readme.md I got: qemu-system-x86_64: -object memory-backend-epc,id=mem1,size=28M: invalid object type: memory-backend-epc (I've done it as root, ofcource) Hove to solve it?

yangzhon commented 3 years ago

@512yottabytes, sorry for late response.

Did this issue still exist? If yes, this issue should be caused by different sgx device nodes with kernel and qemu.

(1). kernel/kvm side please check /dev/sgx*

(2) qemu, backends/hostmem-epc.c sgx_epc_backend_memory_alloc() register_types()

Or you can sync the latest code from kvm-sgx and qemu-sgx upstream branch to check again, thanks!

Any issue, please directly contact me.

xjtuwjp commented 2 years ago

I recently saw same issue when run the vm with a different user, with root it works. the problem is /dev/sgx_vepc require root user privilege to access. I chown the device to the user, then I'm able to run the VM with SGX-EPC as expected.

Is there a standard way to run SGX VM?

dimakuv commented 2 years ago

Thanks @xjtuwjp for this hint! I had the same problem.

I guess the more or less standard way to use it is this. /dev/sgx_vepc has a sgx group associated. So I added this group to my user (dimakuv), and everything works nicely (sudo usermod -a -G sgx dimakuv).