Skip to content
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

Resolve native thread ID through SafeAccess #167

Closed
wants to merge 1 commit into from

Conversation

jbachorik
Copy link
Collaborator

@jbachorik jbachorik commented Jan 9, 2025

What does this PR do?:
It changes the way the native thread id is resolved in the JVMTI based wallclock sampler.

Motivation:
The thread may disappear between having been selected and sampled, or even during preparation to sample.
Since we need to access internal VM structure to retrieve the native thread ID, it may lead to segfault.
Hence, wrapping in SafeAccess will make this, well, safe.

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-11103

Unsure? Have a question? Request a review!

Copy link

github-actions bot commented Jan 9, 2025

🔧 Report generated by pr-comment-scanbuild

Scan-Build Report

User:runner@fv-az1440-974
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 18.1.3 (1ubuntu1)
Date:Thu Jan 9 20:34:31 2025

Bug Summary

Bug TypeQuantityDisplay?
All Bugs5
Logic error
Dereference of null pointer3
Suspicious operation
Bitwise shift1
Unused code
Dead nested assignment1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Suspicious operationBitwise shiftvmStructs.cppfind87216
Unused codeDead nested assignmentvmStructs.cppcheckNativeBinding9771
Logic errorDereference of null pointersafeAccess.hload3318
Logic errorDereference of null pointersymbols_linux.hElfParser12928
Logic errorDereference of null pointerflightRecorder.cppflush15118

Copy link

github-actions bot commented Jan 9, 2025

🔧 Report generated by pr-comment-cppcheck

CppCheck Report

Warnings (6)

Style Violations (405)

@jbachorik jbachorik marked this pull request as ready for review January 9, 2025 20:34
@jbachorik
Copy link
Collaborator Author

Closed in favour of #168

@jbachorik jbachorik closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant