Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runtime] page fault at 0x1650 on 0x3ffdfff0 (scause: 0xf) #472

Open
shirinebadi opened this issue Oct 9, 2024 · 5 comments
Open

[runtime] page fault at 0x1650 on 0x3ffdfff0 (scause: 0xf) #472

shirinebadi opened this issue Oct 9, 2024 · 5 comments

Comments

@shirinebadi
Copy link

I'm trying to generate the session key inside enclave. Following is the code.

  unsigned char server_pk[crypto_kx_PUBLICKEYBYTES], server_sk[crypto_kx_SECRETKEYBYTES];
  unsigned char client_pk[crypto_kx_PUBLICKEYBYTES], client_sk[crypto_kx_PUBLICKEYBYTES];
  unsigned char rx[crypto_kx_SESSIONKEYBYTES];
  unsigned char tx[crypto_kx_SESSIONKEYBYTES];
if(crypto_kx_keypair(server_pk, server_sk) != 0){
    ocall_print_string("[C] Unable to generate keypair, exiting\n");
    EAPP_RETURN(1);
  }
  if(crypto_kx_keypair(client_pk, client_sk) != 0){
    ocall_print_string("[C] Unable to generate keypair, exiting\n");
    EAPP_RETURN(1);
  }
  if(crypto_kx_server_session_keys(rx, tx, server_pk, server_sk, client_pk) != 0) {
    ocall_print_string("[C] Unable to generate session keys, exiting\n");
    EAPP_RETURN(1);
  }

However, the function crypto_kx_server_session_keys raises [runtime] page fault at 0x1650 on 0x3ffdfff0 (scause: 0xf)`. Any thoughts what might cause this?

@grg-haas
Copy link
Collaborator

grg-haas commented Oct 9, 2024

It looks like you probably ran out of stack, which begins at 0x40000000 and ends at 0x3ffe0000 by default. Try bumping EYRIE_USER_STACK_SIZE.

@shirinebadi
Copy link
Author

I tried #define EYRIE_USER_STACK_SIZE 0x80000, and the problem still exists. Should I clean the make directory for runtime and try again? or any other thoughts?

@grg-haas
Copy link
Collaborator

grg-haas commented Oct 9, 2024

Yep, you'll need to clean both the runtime and examples subdirectories: BUILDROOT_TARGET="keystone-runtime-dirclean keystone-examples-dirclean" make

@shirinebadi
Copy link
Author

I cleaned both directories and raised stack size up to 16, but the problem still exists.

@shirinebadi
Copy link
Author

I also tried initializing rx and tx using malloc unsigned char *rx = malloc(crypto_kx_SESSIONKEYBYTES); unsigned char *tx = malloc(crypto_kx_SESSIONKEYBYTES);, but the errors is not gone. Do you have any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants