Closed BergemannFortiss closed 2 months ago
In the error message, it is said that my manifest requires CPU features (e.g.
sgx.require_avx512
) that are not available on this platform. However, no special CPU features are required for this demo, right?
There are, see: https://github.com/gramineproject/examples/blob/ceba8e9da926a3cf83d821ea78fb131a5b43ea9d/openjdk/java.manifest.template#L27-L28
And is-sgx-available
says that your CPU is missing this feature:
#CP information in EXINFO in MISC region of SSA supported: false
So, I'm closing this issue, because everything works as expected, but feel free to ask any more questions (related to this problem) if you have any.
// btw. thank you for taking time to report this in a clear and high-quality way, I appreciate :)
@mkow Thanks for pointing this out. I missed that "use_exinfo" refers to another feature for which I have to check the CPU support.
In the docs, I found "sgx.insecureallow_memfaults_without_exinfo" (https://gramine.readthedocs.io/en/latest/manifest-syntax.html#sgx-exinfo, discussed here: https://github.com/gramineproject/gramine/pull/1744) of which a note says that it "is provided only to allow debugging/testing on old CPUs that do not support the EXINFO feature". This is exactly my situation, since I just want to quickly try out Java with SGX before getting suitable hardware. Therefore, I replaced sgx.use_exinfo with sgx.insecureallow_memfaults_without_exinfo. Now, the enclave is built and the pages are added, but after that everything freezes and the program is killed (probably a memory issue).
Is it therefore right, when I assume that sgx.insecure__allow_memfaults_without_exinfo cannot solve/cover the missing EXINFO support in case of Java applications (with the trade-of of reduced security) and you can definitely only run Java application with a correctly supported sgx.use_exinfo? Or is there another workaround to test a small Java application with a CPU that does not support EXINFO? Thanks in advance.
I missed that "use_exinfo" refers to another feature for which I have to check the CPU support.
Yeah, it doesn't have "require" in the name because of a slightly different semantics - false
means that this feature won't be used at all, even if it's actually available.
This is exactly my situation, since I just want to quickly try out Java with SGX before getting suitable hardware.
Ah, then it's ok to use it, just ensure you won't accidentally ship something with this configuration to production. I actually forgot that we left that switch for debugging/development purposes, sorry.
Now, the enclave is built and the pages are added, but after that everything freezes and the program is killed (probably a memory issue).
It's probably running out of memory, Java likes to preallocate gigabytes of memory relying on lazy allocation, which isn't supported yet by Gramine. Lazy allocation requires EDMM support which your CPU doesn't have and https://github.com/gramineproject/gramine/pull/1513, which is currently blocked on bugs in the SGX Linux driver. Without that you'll need to have enough RAM+swap to store the whole preallocated buffer.
Also, remember that even if you free some RAM/add swap it will be quite slow. You only have 93 MB of EPC, which means a lot of swapping to non-SGX RAM (this isn't an issue on newer server CPUs which practically don't have a limit on EPC size).
Is it therefore right, when I assume that sgx.insecure__allow_memfaults_without_exinfo cannot solve/cover the missing EXINFO support in case of Java applications
No, as far as I remember it should work. I think you just don't have enough RAM+swap (see above).
Description of the problem
I have set up SGX and Gramine, and tested several examples/demos like:
All of them have worked. Then, I wanted to test the Java example (https://github.com/gramineproject/examples/tree/master/openjdk), but this always fails with an IO error when creating the enclave (see below). It is definitely linked with SGX, because when executing it without SGX, it works as expected.
I will outline what I already did (/installed) and how the context looks like below, but since the other SGX demos work, it surprises me that the simple Java one does not. Nevertheless, I assume it is my fault and a setting is wrong. Therefore, I hope that you can lead me to the problem source.
Steps to reproduce
Or rather my setup (you might not be able to reproduce it):
Platform:
(Therefore, I should have the in-built SGX driver and does not need to install one myself, right?)
SGX support (SDK and PSW installed):
Important SGX files existing (not sure if also /dev/sgx_vepc must be present?):
Installed DCAP:
Gramine installed:
The make step for the Java example works:
In the error message, it is said that my manifest requires CPU features (e.g.
sgx.require_avx512
) that are not available on this platform. However, no special CPU features are required for this demo, right? Therefore, this should not break anything:Expected results
Terminal output:
Actual results
Terminal output:
Gramine Examples commit hash
https://github.com/gramineproject/examples/commit/ceba8e9da926a3cf83d821ea78fb131a5b43ea9d