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

Support secure intra-SM function pointers #7

Open
jovanbulck opened this issue Jun 28, 2017 · 1 comment
Open

Support secure intra-SM function pointers #7

jovanbulck opened this issue Jun 28, 2017 · 1 comment
Labels

Comments

@jovanbulck
Copy link
Member

Currently, we only output a warning when dereferencing function pointers in an SM. Compiler should error on dereferencing an unprotected function pointer, and else generate the following pseudo-code:

    if ( fptr < sm_text_start || fptr >= sm_text_end )
    {
      /* target function outside SM */
      goto sm_exit // with function argument meta data according to sm_exit calling conventions
    }
    else
    {
       /* target function inside SM */
       (*fptr)();
    }
@jovanbulck
Copy link
Member Author

We might also consider (inlined) utility functions in sm_support.h to simplify untrusted argument pointer checking. E.g.,

int SM_FUNC(reader) outside_sm(void *p)
{
    return ( (p < (void*) &__PS(reader)) || (p >= (void*) &__PE(reader)) ) &&
           ( (p < (void*) &__SS(reader)) || (p >= (void*) &__SE(reader)) );
}

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

No branches or pull requests

1 participant