-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve robustness of the crash signal handler #134
Conversation
🔧 Report generated by pr-comment-scanbuild Scan-Build Report
Bug Summary
Reports
|
81680ef
to
eb090dc
Compare
eb090dc
to
b1052b3
Compare
573e392
to
e5a8012
Compare
e5a8012
to
3b78d42
Compare
619c8fb
to
5771133
Compare
This reverts commit 44c2f8e.
@@ -906,14 +897,30 @@ void Profiler::busHandler(int signo, siginfo_t *siginfo, void *ucontext) { | |||
} | |||
|
|||
bool Profiler::crashHandler(int signo, siginfo_t *siginfo, void *ucontext) { | |||
ProfiledThread* thrd = ProfiledThread::current(); | |||
if (thrd != nullptr && !thrd->enterCrashHandler()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this puts some weight on the thread object to be always valid or null
VMThread *vm_thread = VMThread::current(); | ||
if (vm_thread != NULL && sameStack(vm_thread->exception(), &vm_thread)) { | ||
if (thrd) { | ||
thrd->exitCrashHandler(); | ||
} | ||
longjmp(*(jmp_buf *)vm_thread->exception(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we std::atomic_thread_fence
?
VMThread *vm_thread = VMThread::current(); | ||
if (vm_thread != NULL && sameStack(vm_thread->exception(), &vm_thread)) { | ||
if (thrd) { | ||
thrd->exitCrashHandler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work, we are doing a longjmp, so we should reset before exiting. Here the increments will build up.
What does this PR do?:
This is an attempt to increase the robustness of the crash signal handler by
Motivation:
Additional Notes:
How to test the change?:
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!