Open andreaskuster opened 3 years ago
Hello,
12328 pages are equal to about 50 MB of memory. I don't have much information about your machine, but if your Linux cannot allocate this much contiguous memory, it will fail to create an enclave.
Your Linux may have fail to allocate the CMA memory region. Please take a closer look at Linux boot message, it should say something like the following if it was successful (XXX K cma-reserved
):
[ 0.000000] Memory: 931620K/2095104K available (6486K kernel code, 4184K rwdata, 4096K rodata, 235K init, 318K bss, 114908K reserved, 1048576K cma-reserved)
If it says 0 K cma-reserved
, it means that Linux fail to allocate CMA for some reason.
Please let me know how much of CMA-reserved memory your Linux has.
Quick fix for this issue is to reduce the size of enclave to be less than 2MB, because if there's no CMA then Keystone driver will just use buddy allocator (which cannot allocate over 2MB).
Yes, you were exaclty right. Porting from the SiFive HiFive Unleashed dev board
, the CMA value was set to CONFIG_CMA_SIZE_MBYTES=1024
, which was too much for my Xilinx Genesys 2 dev board/FPGA
. Reducing it to 256MiB
successfully mitigated this issue. Thanks!
# insmod keystone-driver.ko
[ 69.725113] keystone_driver: loading out-of-tree module taints kernel.
[ 69.928969] keystone_enclave: keystone enclave v1.0.0
# ./tests.ke
Verifying archive integrity... All good.
Uncompressing Keystone Enclave Package
testing stack
testing loop
testing malloc
testing long-nop
testing fibonacci
testing fib-bench
testing attestation
Attestation report is invalid
testing untrusted
Enclave said: hello world!
Enclave said: 2nd hello world!
Enclave said value: 13
Enclave said value: 20
testing data-sealing
Enclave said: Sealing key derivation successful!
The only remaining example that does not succeed yet is the attestation
example (see above).
I did find your thread discussing the same problem (but for firesim
), but couldn't find an straight-forward solution so far.
Could you give me some pointer on where to start/look at? Alternatively I saw that you are extending the attestation example in the master sdk branch. Is this fundamentally based on the same low-level primitives, or would it make sense to get this running instead of the 'old' one in the test which only checks the signature, see: https://github.com/keystone-enclave/keystone-sdk/blob/24a5ed369ac0606aac486382a0855a459d9362ed/examples/tests/test-runner.cpp#L49 ?
I get a different sort of issue with both 256MB and 512MB CMA:
# ./tests.ke
Verifying archive integrity... All good.
Uncompressing Keystone Enclave Package
testing stack
After this nothing happens but I can still exit the program. Not even 20 minutes after startup.
Any ideas what could go wrong?
Congrats on this great project!
I am currently in the process of deploying Keystone to the CVA6 RISC-V CPU.
The bootup process and kernel module loading process works:
The
hello-native
example as well,however, the
hello
example does not print any output (apart from package extraction).Furthermore, the real trouble comes with the
tests
exampleDo you have any hints or ideas on why this happens?