forked from OSchip/llvm-project
tsan: move errno spoiling reporting into a separate function (NFC)
CallUserSignalHandler function is quite large and complex. Move errno spoiling reporting into a separate function. No logical changes. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D110159
This commit is contained in:
parent
20ee72d4cc
commit
cf93f7677d
|
@ -1953,6 +1953,19 @@ TSAN_INTERCEPTOR(int, pthread_sigmask, int how, const __sanitizer_sigset_t *set,
|
|||
|
||||
namespace __tsan {
|
||||
|
||||
static void ReportErrnoSpoiling(ThreadState *thr, uptr pc) {
|
||||
VarSizeStackTrace stack;
|
||||
// StackTrace::GetNestInstructionPc(pc) is used because return address is
|
||||
// expected, OutputReport() will undo this.
|
||||
ObtainCurrentStack(thr, StackTrace::GetNextInstructionPc(pc), &stack);
|
||||
ThreadRegistryLock l(&ctx->thread_registry);
|
||||
ScopedReport rep(ReportTypeErrnoInSignal);
|
||||
if (!IsFiredSuppression(ctx, ReportTypeErrnoInSignal, stack)) {
|
||||
rep.AddStack(stack, true);
|
||||
OutputReport(thr, rep);
|
||||
}
|
||||
}
|
||||
|
||||
static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire,
|
||||
int sig, __sanitizer_siginfo *info,
|
||||
void *uctx) {
|
||||
|
@ -2011,18 +2024,8 @@ static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire,
|
|||
// from rtl_generic_sighandler) we have not yet received the reraised
|
||||
// signal; and it looks too fragile to intercept all ways to reraise a signal.
|
||||
if (ShouldReport(thr, ReportTypeErrnoInSignal) && !sync && sig != SIGTERM &&
|
||||
errno != 99) {
|
||||
VarSizeStackTrace stack;
|
||||
// StackTrace::GetNestInstructionPc(pc) is used because return address is
|
||||
// expected, OutputReport() will undo this.
|
||||
ObtainCurrentStack(thr, StackTrace::GetNextInstructionPc(pc), &stack);
|
||||
ThreadRegistryLock l(&ctx->thread_registry);
|
||||
ScopedReport rep(ReportTypeErrnoInSignal);
|
||||
if (!IsFiredSuppression(ctx, ReportTypeErrnoInSignal, stack)) {
|
||||
rep.AddStack(stack, true);
|
||||
OutputReport(thr, rep);
|
||||
}
|
||||
}
|
||||
errno != 99)
|
||||
ReportErrnoSpoiling(thr, pc);
|
||||
errno = saved_errno;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue