Problem trying to implement "Bugprone-signal-handler" check for sigaction

Hello everyone :slight_smile:

I’m trying to implement a Checker for the static analyzer that can find “bugprone-signal-handler” problems in C Code. But I have some troubles in getting some information i need to make this work.

Basically the checker should warn if a non-asynchronous-safe function is being used in a signal handler.

void handler(int signum) {
    printf("Hello from signal handler");
}

int main() {
    struct sigaction new_action;
    new_action.sa_handler = handler;
    sigaction(SIGINT, &new_action, NULL);
    return 0;
}

My current idea is that the checker should check for all non-asynchronous-safe function whether it’s caller function has been set as a signal handler in a sigaction call. In the example above this would be the function handler. Now my problem is that I don’t know how to get the function name (i.e. handler) from the second argument in sigaction(SIGINT, &new_action, NULL); so that I can store it and check against it later on.

Any help would be greatly appreciated!