Skip to content

Runtime doesn't abort after first SIGABRT sent to process #99495

Open
@gbalykov

Description

@gbalykov

When first SIGABRT is sent to .net process (kill -SIGABRT $PID) process continues execution. Process only aborts after the second one.

This happens because currently SIGABRT handler passes signalRestarts=true to invoke_previous_action:

static void sigabrt_handler(int code, siginfo_t *siginfo, void *context)
{
invoke_previous_action(&g_previous_sigabrt, code, siginfo, context);
}

And invoke_previous_action simply resets signal handler to previous one without aborting:

if (signalRestarts)
{
// Shutdown and create the core dump before we restore the signal to the default handler.
PROCNotifyProcessShutdown(IsRunningOnAlternateStack(context));
PROCCreateCrashDumpIfEnabled(code, siginfo, true);
// Restore the original and restart h/w exception.
restore_signal(code, action);
return;
}
else
{
// We can't invoke the original handler because returning from the
// handler doesn't restart the exception.
PROCAbort(code, siginfo);
}

It seems that currently runtime only handles the case of abort(), which raises SIGABRT second time when there's non-default signal handler. However, shouldn't runtime abort on the first SIGABRT received?

This can be achieved with:

 static void sigabrt_handler(int code, siginfo_t *siginfo, void *context) 
 { 
     invoke_previous_action(&g_previous_sigabrt, code, siginfo, context, false); 
 } 

cc @jkotas @HJLeee @clamp03 @wscho77 @t-mustafin @viewizard

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions