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

Doesn't catch SIGSEGV on Android #45

Open
JonasVautherin opened this issue Jun 13, 2022 · 1 comment
Open

Doesn't catch SIGSEGV on Android #45

JonasVautherin opened this issue Jun 13, 2022 · 1 comment

Comments

@JonasVautherin
Copy link

I am trying to use COFFEE_TRY_JNI on Android, but it does not seem to catch the signal. I just copied the coffeecatch source files in my project, and had to remove some of those parts because Android now apparently has them. I only removed what was "duplicated" (keeping the system one and removing the one in coffeecatch.c).

I get the following crash:

Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7969a63cb6 in tid 20990 (DefaultDispatch)

From this code, calling runNative from Java (well, Kotlin actually):

__attribute__ ((noinline))
static void run() {
    char *test = "blah";
    *(test + 1) = 'n';
}

__attribute__ ((noinline))
static void run_protected(JNIEnv *env) {
    COFFEE_TRY_JNI(env, run());
}

JNIEXPORT void JNICALL
Java_com_example_JniApi_00024Companion_runNative(
        JNIEnv *env, jobject thiz) {
    run_protected(env);
}

Am I missing something?

@JonasVautherin
Copy link
Author

JonasVautherin commented Jun 13, 2022

I traced it to this line:

siglongjmp(t->ctx, code);

I get my SIGSEGV right when this is called 🤔.

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

1 participant