sslab-gatech / opensgx

OpenSGX
Other
291 stars 80 forks source link

Hardware conformance #7

Open jethrogb opened 8 years ago

jethrogb commented 8 years ago

I was able to test SGX on real hardware. There are some differences in how instructions work compared to OpenSGX.

johnmwshih commented 8 years ago

Thanks for your report, it was really helpful. We will work on these inconsistent parts. Please let us know if there are more such issues.

dongsuh commented 8 years ago

Thanks jethrogb. Can you tell us how you are running SGX on real hardware? We're also trying to make OpenSGX compatible with Intel SGX as much as possible and would like to configure the hardware. Can you tell us about how you are using the SGX hardware? Do you have any pointers?

jethrogb commented 8 years ago

See this blog post for details on the hardware -- https://jbeekman.nl/blog/2015/10/sgx-hardware-first-look/

I've written a very sketchy linux kernel driver to run ENCLS, which I can share with you privately if you want. I'm currently working on figuring out the Launching Enclave (needed for EINIT) situation.

jonhoo commented 8 years ago

@jethrogb: oh, that sounds very interesting! Any chance you're considering open-sourcing it at some point?

jethrogb commented 8 years ago

@jonhoo I decided to release it publicly today https://github.com/jethrogb/sgx-utils/tree/master/linux-driver . There's also a patch for the OpenSGX "kernel" interface.

dongsuh commented 8 years ago

@jethrogb Nice! Thanks a lot for the code. I'd be interested to see if you can run an enclave on real SGX hardware. One question on the machine. Are you using one of the Dell laptops? Do you know of any rack mount server boards with SGX support enabled in their BIOS? Thanks!

jonhoo commented 8 years ago

@jethrogb: that's great news! Will investigate.

jethrogb commented 8 years ago

@dongsuh

Are you using one of the Dell laptops? Do you know of any rack mount server boards with SGX support enabled in their BIOS?

Yes and no.

ayeks commented 8 years ago

Just to inform others who are trying to use SGX on the Skylake CPUs. Intel released a Product Change Notification that only certain upcoming (available 26. October) versions of Skylake processors will have SGX capabilities enabled. The new CPUs will differentiate only in the S-Spec Number from the current ones. I tested a current CPU for its SGX support before that announcement. CPUID.(EAX=07H, ECX=0H):EBX.SGX is 1. It is not possible to differentiate the CPUs by its CPUID. I am still looking for an updated BIOS which allows the modification of the IA32_FEATURE_CONTROL to globally enable SGX on the new CPUs.. It would be great if someone can provide an updated BIOS with SGX support for the desktop Skylake CPUs.

@jethrogb I have read about the EINIT - launch key problems. Did you manage to obtain such key from Intel?

dongsuh commented 8 years ago

@ayeks Thanks a lot for the information. Does this mean it's better to wait for a week to buy the hardware?

ayeks commented 8 years ago

@dongsuh For the desktop CPUs yes. But you have to pay attention to the S-Spec Numbers. Only the "Post-Conversion" CPUs are able to use SGX. For example, i got the i5-6600K S-SPec: SR2BV but i need the one with S-Spec SR2L4.. The officially Product Change Notification: http://qdms.intel.com/dm/i.aspx/5A160770-FC47-47A0-BF8A-062540456F0A/PCN114074-00.pdf

Even with the right CPU, the BIOS must be able to set the SGX enable Bits in the MSR. So you need a BIOS with SGX support. Sadly I wasn't able to find a SGX supporting BIOS for desktops mainboards yet.

johnmwshih commented 8 years ago

@ayeks Did you also try CPUID(EAX=12H, ECX=00H), CPUID(EAX=12H, ECX=01H), CPUID(EAX=12H, ECX=02H)?

ayeks commented 8 years ago

@johnmwshih Jep. I wrote a small script for that: https://gist.github.com/ayeks/5ebefd33321cfd245a17 Have look at my comment in the gist to see the output. SGX can't be enabled on the current version of the i5-6600K CPU with S-Spec SR2BV. I am waiting for the new Skylake CPUs and a new BIOS for my mainboard which hopefully supports SGX.

ayeks commented 8 years ago

Just for your information. I started a list to keep track on the hardware that supports SGX. I'll try to keep it as up to date as possible. Feel free to contribute to the list if you see some new drivers which enable SGX. The repo: https://github.com/ayeks/SGX-hardware