Skip to content

Commit df8d55c

Browse files
committed
Allow deterministic signals during syscallbuf, but give a loud error
1 parent 618715c commit df8d55c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/record_signal.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ static void handle_desched_event(RecordTask* t) {
651651
leave_syscallbuf(t);
652652
}
653653

654-
static bool is_safe_to_deliver_signal(RecordTask* t, siginfo_t* si) {
654+
static bool is_safe_to_deliver_signal(RecordTask* t, siginfo_t *si, SignalDeterministic deterministic) {
655655
if (!t->is_in_syscallbuf()) {
656656
/* The tracee is outside the syscallbuf code,
657657
* so in most cases can't possibly affect
@@ -662,7 +662,13 @@ static bool is_safe_to_deliver_signal(RecordTask* t, siginfo_t* si) {
662662
<< " because not in syscallbuf";
663663
return true;
664664
}
665-
(void)si;
665+
666+
if (deterministic == DETERMINISTIC_SIG) {
667+
LOG(error) << "Recevied deterministic signal " << signal_name(si->si_signo)
668+
<< " while in syscallbuf code.\n Ordinarily this should never happen.\n"
669+
<< "Recording will proceed, but additional errors or a corrupted trace may follow.";
670+
return true;
671+
}
666672

667673
LOG(debug) << "Not safe to deliver signal at " << t->ip();
668674
return false;
@@ -714,7 +720,7 @@ SignalHandled handle_signal(RecordTask* t, siginfo_t* si,
714720
return SIGNAL_HANDLED;
715721
}
716722

717-
if (!is_safe_to_deliver_signal(t, si)) {
723+
if (!is_safe_to_deliver_signal(t, si, deterministic)) {
718724
return DEFER_SIGNAL;
719725
}
720726

0 commit comments

Comments
 (0)