Skip to content

detect musl at compile time#94

Merged
jbachorik merged 1 commit into
mainfrom
rgs/avoid-runtime-musl-detection
May 10, 2024
Merged

detect musl at compile time#94
jbachorik merged 1 commit into
mainfrom
rgs/avoid-runtime-musl-detection

Conversation

@richardstartin
Copy link
Copy Markdown
Contributor

What does this PR do?:
If confstr(_CS_GNU_LIBC_VERSION, NULL, 0) stops producing an error for whatever reason at any time in the future on any musl systems, we would not relocate pointers in the dynamic section correctly. We just don't need to detect musl at runtime, and can continue to rely on separate binaries for each libc for a number of reasons:

  1. we have robust infrastructure to load the right dynamic library
  2. each binary is very small (under 0.5MiB)
  3. We have glibc symbol versioning to simplify targeting older glibc systems (which we would have to remove)

Given the above, detecting musl at compile time feels like a safer approach.

Motivation:

Additional Notes:

How to test the change?:

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.

Unsure? Have a question? Request a review!

@richardstartin richardstartin requested a review from jbachorik May 10, 2024 11:58
@github-actions
Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-scanbuild

Scan-Build Report

User:runner@fv-az1020-841
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:Fri May 10 11:59:40 2024

Bug Summary

Bug TypeQuantityDisplay?
All Bugs6
Logic error
Assigned value is garbage or undefined1
Dereference of null pointer2
Result of operation is garbage or undefined1
Unused code
Dead initialization1
Dead nested assignment1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorAssigned value is garbage or undefineddwarf.cppparseInstructions23520
Unused codeDead initializationlivenessTracker.cppcleanup_table451
Unused codeDead nested assignmentvmStructs.cppcheckNativeBinding8181
Logic errorDereference of null pointerflightRecorder.cppflush14108
Logic errorDereference of null pointersafeAccess.hload3518
Logic errorResult of operation is garbage or undefineddwarf.hgetSLeb14225

@github-actions
Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-cppcheck

CppCheck Report

Warnings (5)

Style Violations (161)

@jbachorik jbachorik merged commit d06f7ab into main May 10, 2024
@github-actions github-actions Bot added this to the 1.6.0 milestone May 10, 2024
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.

2 participants