forked from OSchip/llvm-project
[MSan] Fixup for r206983: MsanThread may be unavailable in signal handler: signals may be raised while thread is being destroyed
llvm-svn: 208250
This commit is contained in:
parent
df6860279e
commit
2fccdfbe70
|
@ -237,7 +237,8 @@ const char *GetOriginDescrIfStack(u32 id, uptr *pc) {
|
|||
}
|
||||
|
||||
u32 ChainOrigin(u32 id, StackTrace *stack) {
|
||||
if (GetCurrentThread()->InSignalHandler())
|
||||
MsanThread *t = GetCurrentThread();
|
||||
if (t && t->InSignalHandler())
|
||||
return id;
|
||||
uptr idx = Min(stack->size, kStackTraceMax - 1);
|
||||
stack->trace[idx] = TRACE_MAKE_CHAINED(id);
|
||||
|
|
|
@ -982,8 +982,14 @@ INTERCEPTOR(int, getrusage, int who, void *usage) {
|
|||
|
||||
class SignalHandlerScope {
|
||||
public:
|
||||
SignalHandlerScope() { GetCurrentThread()->EnterSignalHandler(); }
|
||||
~SignalHandlerScope() { GetCurrentThread()->LeaveSignalHandler(); }
|
||||
SignalHandlerScope() {
|
||||
if (MsanThread *t = GetCurrentThread())
|
||||
t->EnterSignalHandler();
|
||||
}
|
||||
~SignalHandlerScope() {
|
||||
if (MsanThread *t = GetCurrentThread())
|
||||
t->LeaveSignalHandler();
|
||||
}
|
||||
};
|
||||
|
||||
// sigactions_mu guarantees atomicity of sigaction() and signal() calls.
|
||||
|
|
Loading…
Reference in New Issue