This is an archive of the discontinued LLVM Phabricator instance.

tsan: print signal num in errno spoiling reports
ClosedPublic

Authored by dvyukov on Mar 17 2022, 11:28 PM.

Details

Summary

For errno spoiling reports we only print the stack
where the signal handler is invoked. And the top
frame is the signal handler function, which is supposed
to give the info for debugging.
But in same cases the top frame can be some common thunk,
which does not give much info. E.g. for Go/cgo it's always
runtime.cgoSigtramp.

Print the signal number.
This is what we can easily gather and it may give at least
some hints regarding the issue.

Diff Detail

Event Timeline

dvyukov created this revision.Mar 17 2022, 11:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 11:28 PM
dvyukov requested review of this revision.Mar 17 2022, 11:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 11:28 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
dvyukov updated this revision to Diff 416400.Mar 17 2022, 11:30 PM

fixed code style

vitalybuka accepted this revision.Mar 18 2022, 1:46 AM
This revision is now accepted and ready to land.Mar 18 2022, 1:46 AM
melver accepted this revision.Mar 18 2022, 2:18 AM
melver added inline comments.
compiler-rt/lib/tsan/rtl/tsan_report.cpp
310

Is strsignal() available here?

dvyukov added inline comments.Mar 18 2022, 2:23 AM
compiler-rt/lib/tsan/rtl/tsan_report.cpp
310

We try to not call libc functions, maybe we could call this one, but it says:
"The string can be used only until the next call to strsignal()"
We can't call this in runtime or we may break the program behavior.

melver added inline comments.Mar 18 2022, 2:28 AM
compiler-rt/lib/tsan/rtl/tsan_report.cpp
310

Right. One option is to build a lookup-table at startup and copy strsignal() strings into that lookup table.

But it might not be worth it.

dvyukov marked 2 inline comments as done.Mar 18 2022, 2:32 AM
dvyukov added inline comments.
compiler-rt/lib/tsan/rtl/tsan_report.cpp
310

I've seen this report very few times, I don't even remember if I saw it before the current time. I think the number sufficient to debug (there is man 7 signal).

melver added inline comments.Mar 18 2022, 2:34 AM
compiler-rt/lib/tsan/rtl/tsan_report.cpp
310

LGTM

This revision was automatically updated to reflect the committed changes.
dvyukov marked an inline comment as done.