Skip to content

Add a fail-safe when we encounter double-exit from crash handler - #138

Merged
r1viollet merged 1 commit into
mainfrom
jb/sigseg_test
Oct 15, 2024
Merged

r1viollet merged 1 commit into
mainfrom
jb/sigseg_test

Conversation

@jbachorik

@jbachorik jbachorik commented Oct 14, 2024 •

Copy link
Copy Markdown
Collaborator

What does this PR do?:
Adds a fail-safe when we encounter double-exit from crash handler.

Motivation:
This seems to happen sometimes in relation to longjmp. Since the crash signal handler is using depth tracking to avoid stack overflow, having this depth corrupted by double-exit may cause not intercepting and sigsegs at all.
This was witnessed in CI when cca. 1 in 4 runs quite reliable crashed in SafeAccess::load call.

With this particular patch applied no crash is observed in a series of 7 subsequent runs so this all looks like a valid hypothesis.

Additional Notes:
If a crash in SafeAccess::load is observed even with this patch applied then the safest course of action is to revert this PR and then #134

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: PROF-10605

Unsure? Have a question? Request a review!

@jbachorik
jbachorik marked this pull request as ready for review October 14, 2024 16:33
@github-actions

Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-cppcheck

CppCheck Report

Warnings (6)

Style Violations (161)

@github-actions

Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-scanbuild

Scan-Build Report

User:runner@fv-az1251-122
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 clean all
Clang Version:Ubuntu clang version 14.0.0-1ubuntu1.1
Date:Mon Oct 14 16:33:54 2024

Bug Summary

Bug TypeQuantityDisplay?
All Bugs5
Logic error
Assigned value is garbage or undefined1
Dereference of null pointer3
Unused code
Dead nested assignment1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorAssigned value is garbage or undefineddwarf.cppparseInstructions24420
Unused codeDead nested assignmentvmStructs.cppcheckNativeBinding8791
Logic errorDereference of null pointersafeAccess.hload3318
Logic errorDereference of null pointersymbols_linux.hElfParser12932
Logic errorDereference of null pointerflightRecorder.cppflush15048

@r1viollet r1viollet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK to try this. LGTM
However I am not sure why this would be occurring.
I did add a note in previous PR on possible extra thread fencing.

@r1viollet
r1viollet merged commit 93f9b04 into main Oct 15, 2024
@github-actions github-actions Bot added this to the 1.16.0 milestone Oct 15, 2024
@jbachorik jbachorik mentioned this pull request Nov 1, 2024
4 of 5 tasks
@jbachorik
jbachorik deleted the jb/sigseg_test branch May 28, 2025 08:21
@zhengyu123 zhengyu123 added the fixed_version: v_1.16.0 Version this PR's fix shipped in label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixed_version: v_1.16.0 Version this PR's fix shipped in

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants