Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client/crash_handler/crash_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ int crash_handler_install(int global_rank, int ldcsid_in)
sigaddset(&sa.sa_mask, SIGABRT);

const int sigs[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT };
crash_sigchain_activate();
for (size_t i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++) {
/* If a signal handler was already installed by the time Spindle
registers its signal handler, we save it to use in
Expand Down
10 changes: 10 additions & 0 deletions src/client/crash_handler/crash_sigchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,18 @@ struct app_disposition {

static const int OWNED_SIGS[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT };

/* Set once the crash handler has installed its handlers. */
static int sigchain_active = 0;

void crash_sigchain_activate(void)
{
sigchain_active = 1;
}

int crash_sigchain_is_owned(int sig)
{
if (!sigchain_active)
return 0;
for (size_t i = 0; i < sizeof(OWNED_SIGS) / sizeof(OWNED_SIGS[0]); i++) {
if (OWNED_SIGS[i] == sig)
return 1;
Expand Down
1 change: 1 addition & 0 deletions src/client/crash_handler/crash_sigchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#define CRASH_CHAIN_HANDLED 1 /* application handler ran and returned */
#define CRASH_CHAIN_IGNORED 2 /* application disposition is SIG_IGN */

void crash_sigchain_activate(void);
int crash_sigchain_is_owned(int sig);
void crash_sigchain_register_existing_handler(int sig, const struct sigaction *handler_old);
int crash_sigchain_chain_to_app(int sig, siginfo_t *info, void *ucontext);
Expand Down
9 changes: 8 additions & 1 deletion testsuite/run_crash_tests_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ die() { echo "FAIL: $*" >&2; exit 1; }
# flags (comma-separated): "multi-rank" skips the mode on a single rank;
# "clean" expects the test to NOT crash; "altstack" runs the mode with
# --crash-altstack; "nofollowfork" runs it with --follow-fork=false;
# "nocrashhandler" runs it without the crash handler;
# "forkchild" means rows may come from fork or exec children of a rank.
# top_frame_regex: regex that should match the top frame in produced coredumps.
# Note that all threads will be checked, so in multithreaded examples the regex should
Expand Down Expand Up @@ -70,6 +71,7 @@ CRASH_TESTS=(
'safepoint-fix-write ; 0 ; 0 ; clean ; -'
'safepoint-fix-write-altstack ; 0 ; 0 ; clean,altstack ; - ; ; ; safepoint-fix-write'
'safepoint-longjmp ; 0 ; 0 ; clean ; -'
'safepoint-nocrashhandler ; 0 ; 0 ; clean,nocrashhandler ; - ; ; ; safepoint'
'safepoint-span-read ; 0 ; 0 ; clean ; -'
'safepoint-span-write ; 0 ; 0 ; clean ; -'
'safepoint-span-bad-read ; 1 ; N ; ; do_safepoint_span_bad_read'
Expand Down Expand Up @@ -266,6 +268,11 @@ launch() {
cmdline_opts="$cmdline_opts --follow-fork=false"
flux_opts+=(-o spindle.follow-fork=no)
fi
if has_flag "$mode" nocrashhandler; then
cmdline_opts=""
flux_opts=(-o spindle)
export SPINDLE_NO_CRASH_DEDUP=1
fi
ulimit -c unlimited
# Make libcrashfuncs.so visible to dlopen() from the mode's scratch dir.
export LD_LIBRARY_PATH="$TESTDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
Expand All @@ -290,7 +297,7 @@ launch() {
;;
slurm-plugin)
salloc -N"$NODES" -n"$NODES" \
srun --spindle="$cmdline_opts" \
srun "--spindle${cmdline_opts:+=$cmdline_opts}" \
"$binary" --crash-mode "$crash_mode"
;;
esac
Expand Down
Loading