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: deadly signal received on foreign threads does not crash the process #10139

Closed
minux opened this issue Mar 11, 2015 · 2 comments
Closed
Milestone

Comments

@minux
Copy link
Member

minux commented Mar 11, 2015

Instead, our sigtramp will simply return without modifying the ucontext, and
then the faulty code will trigger the same fault again, .....

http://play.golang.org/p/L1WXDwUFTf

package main
/*
#include <signal.h>
#include <pthread.h>
#include <stdio.h>

static void *thread1(void *p) {
        (void)p;
        printf("0\n");
        int *q = NULL;
        printf("1\n");
        printf("*nil=%d\n", *q);
        return NULL;
}
void test5337() {
        setbuf(stdout, NULL);
        pthread_t tid;
        pthread_create(&tid, 0, thread1, NULL);
        //pthread_join(tid, 0);
        printf("2\n");
}
*/
import "C"
import "time"

func main() {
        C.test5337()
        time.Sleep(5 * time.Second)
        println("DONE")
}

If you run the program, I'd expect to see something like SIGSEGV received
on foreign thread, and then the process should exit (crash).

However, what you will actually see is that the process will print DONE
after 5 seconds and exit normally. But if you run the program under gdb,
you will see that thread is triggering SIGSEGV again and again.

@rsc
Copy link
Contributor

rsc commented Jul 21, 2015

Looks like maybe we just need to handle SIG_DFL either in sigfwd or before calling sigfwd.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12503 mentions this issue.

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

No branches or pull requests

4 participants