Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/prepare_reports.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash

set -e
mkdir -p test-reports
Expand Down
82 changes: 55 additions & 27 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,39 @@ jobs:
exit 1
fi
- name: Generate Unwinding Report
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
run: |
./gradlew -PCI :ddprof-test:unwindingReport --no-daemon
- name: Add Unwinding Report to Job Summary
if: success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
run: |
echo "## 🔧 Unwinding Quality Report - ${{ matrix.java_version }} (amd64)" >> $GITHUB_STEP_SUMMARY
cat ddprof-test/build/reports/unwinding-summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
if: steps.set_enabled.outputs.enabled == 'true' && success()
with:
name: (build) test-linux-glibc-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: build/
- name: Upload failures
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: failures-glibc-${{ matrix.java_version }}-${{ matrix.config }}-amd64
path: failures_glibc-${{ matrix.java_version }}-${{ matrix.config }}-amd64.txt
- name: Prepare reports
if: always()
if: steps.set_enabled.outputs.enabled == 'true' && always()
run: |
.github/scripts/prepare_reports.sh
- name: Upload unwinding reports
uses: actions/upload-artifact@v4
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
with:
name: (unwinding-reports) unwinding-linux-glibc-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: unwinding-reports
- name: Upload test reports
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: (test-reports) test-linux-glibc-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: test-reports
Expand All @@ -153,20 +153,31 @@ jobs:
options: --cpus 4 --workdir /github/workspace -v /home/runner/work/_temp:/home/runner/work/_temp
timeout-minutes: 180
steps:
- name: Set enabled flag
id: set_enabled
run: |
echo "enabled=true" >> $GITHUB_OUTPUT
if [[ "${{ matrix.java_version }}" =~ -zing ]]; then
if [[ "${{ matrix.config }}" != "release" ]] && [[ "${{ matrix.config }}" != "debug" ]]; then
echo "enabled=false" >> $GITHUB_OUTPUT
fi
fi
- name: Setup OS
run: |
apk update && apk add curl moreutils wget hexdump linux-headers bash make g++ clang git cppcheck jq cmake gtest-dev gmock tar binutils >/dev/null
# Install debug symbols for musl libc
apk add musl-dbg
- uses: actions/checkout@v3
- name: Cache Gradle Wrapper Binaries
if: steps.set_enabled.outputs.enabled == 'true'
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper/dists
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-wrapper-${{ runner.os }}-
- name: Cache Gradle User Home
if: steps.set_enabled.outputs.enabled == 'true'
uses: actions/cache@v4
with:
path: ~/.gradle/caches
Expand All @@ -184,13 +195,16 @@ jobs:
async-profiler-${{ runner.os }}-
- name: Setup cached JDK
id: cache-jdk
if: steps.set_enabled.outputs.enabled == 'true'
uses: ./.github/actions/setup_cached_java
with:
version: ${{ matrix.java_version }}
arch: 'amd64-musl'
- name: Extract Versions
if: steps.set_enabled.outputs.enabled == 'true'
uses: ./.github/actions/extract_versions
- name: Test
if: steps.set_enabled.outputs.enabled == 'true'
run: |
set +e

Expand Down Expand Up @@ -226,39 +240,39 @@ jobs:
exit 1
fi
- name: Generate Unwinding Report
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
run: |
./gradlew -PCI :ddprof-test:unwindingReport --no-daemon
- name: Add Unwinding Report to Job Summary
if: success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
run: |
echo "## 🔧 Unwinding Quality Report - ${{ matrix.java_version }} (amd64-musl)" >> $GITHUB_STEP_SUMMARY
cat ddprof-test/build/reports/unwinding-summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
if: steps.set_enabled.outputs.enabled == 'true' && success()
with:
name: (build) test-linux-musl-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: build/
- name: Upload failures
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: failures-musl-${{ matrix.java_version }}-${{ matrix.config }}-amd64
path: failures_musl-${{ matrix.java_version }}-${{ matrix.config }}-amd64.txt
- name: Prepare reports
if: always()
if: steps.set_enabled.outputs.enabled == 'true' && always()
run: |
.github/scripts/prepare_reports.sh
- name: Upload unwinding reports
uses: actions/upload-artifact@v4
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
with:
name: (unwinding-reports) unwinding-linux-musl-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: unwinding-reports
- name: Upload test reports
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: (test-reports) test-linux-musl-amd64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: test-reports
Expand Down Expand Up @@ -357,17 +371,17 @@ jobs:
exit 1
fi
- name: Generate Unwinding Report
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
run: |
./gradlew -PCI :ddprof-test:unwindingReport --no-daemon
- name: Add Unwinding Report to Job Summary
if: success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
run: |
echo "## 🔧 Unwinding Quality Report - ${{ matrix.java_version }} (aarch64)" >> $GITHUB_STEP_SUMMARY
cat ddprof-test/build/reports/unwinding-summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
if: steps.set_enabled.outputs.enabled == 'true' && success()
with:
name: (build) test-linux-glibc-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: build/
Expand All @@ -378,18 +392,18 @@ jobs:
name: failures-glibc-${{ matrix.java_version }}-${{ matrix.config }}-aarch64
path: failures_glibc-${{ matrix.java_version }}-${{ matrix.config }}-aarch64.txt
- name: Prepare reports
if: always()
if: steps.set_enabled.outputs.enabled == 'true' && always()
run: |
.github/scripts/prepare_reports.sh
- name: Upload unwinding reports
uses: actions/upload-artifact@v4
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
with:
name: (unwinding-reports) unwinding-linux-glibc-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: unwinding-reports
- name: Upload test reports
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: (test-reports) test-linux-glibc-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: test-reports
Expand All @@ -406,15 +420,26 @@ jobs:
labels: arm-4core-linux-ubuntu24.04
timeout-minutes: 180
steps:
- name: Set enabled flag
id: set_enabled
run: |
echo "enabled=true" >> $GITHUB_OUTPUT
if [[ "${{ matrix.java_version }}" =~ -zing ]]; then
if [[ "${{ matrix.config }}" != "release" ]] && [[ "${{ matrix.config }}" != "debug" ]]; then
echo "enabled=false" >> $GITHUB_OUTPUT
fi
fi
- uses: actions/checkout@v3
- name: Cache Gradle Wrapper Binaries
if: steps.set_enabled.outputs.enabled == 'true'
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper/dists
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-wrapper-${{ runner.os }}-
- name: Cache Gradle User Home
if: steps.set_enabled.outputs.enabled == 'true'
uses: actions/cache@v4
with:
path: ~/.gradle/caches
Expand All @@ -423,6 +448,7 @@ jobs:
gradle-caches-${{ runner.os }}-
- name: Setup cached JDK
id: cache-jdk
if: steps.set_enabled.outputs.enabled == 'true'
uses: ./.github/actions/setup_cached_java
with:
version: ${{ matrix.java_version }}
Expand All @@ -437,8 +463,10 @@ jobs:
restore-keys: |
async-profiler-${{ runner.os }}-
- name: Extract Versions
if: steps.set_enabled.outputs.enabled == 'true'
uses: ./.github/actions/extract_versions
- name: Test
if: steps.set_enabled.outputs.enabled == 'true'
run: |
set +e
# the effective JAVA_VERSION is computed in the test_alpine_aarch64.sh script
Expand All @@ -455,43 +483,43 @@ jobs:
exit 1
fi
- name: Generate Unwinding Report
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
run: |
docker run --cpus 4 --rm -v /tmp:/tmp -v "${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" alpine:3.21 /bin/sh -c "
\"$GITHUB_WORKSPACE/.github/scripts/unwinding_report_alpine_aarch64.sh\" \
\"${{ github.sha }}\" \"musl/${{ matrix.java_version }}-${{ matrix.config }}-aarch64\" \
\"${{ matrix.config }}\" \"${{ env.JAVA_HOME }}\" \"${{ env.JAVA_TEST_HOME }}\"
"
- name: Add Unwinding Report to Job Summary
if: success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug' && hashFiles('ddprof-test/build/reports/unwinding-summary.md') != ''
run: |
echo "## 🔧 Unwinding Quality Report - ${{ matrix.java_version }} (aarch64-musl)" >> $GITHUB_STEP_SUMMARY
cat ddprof-test/build/reports/unwinding-summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
if: steps.set_enabled.outputs.enabled == 'true' && success()
with:
name: (build) test-linux-musl-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: build/
- name: Upload failures
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: failures-musl-${{ matrix.java_version }}-${{ matrix.config }}-aarch64
path: failures_musl-${{ matrix.java_version }}-${{ matrix.config }}-aarch64.txt
- name: Prepare reports
if: always()
if: steps.set_enabled.outputs.enabled == 'true' && always()
run: |
.github/scripts/prepare_reports.sh
- name: Upload unwinding reports
uses: actions/upload-artifact@v4
if: success() && matrix.config == 'debug'
if: steps.set_enabled.outputs.enabled == 'true' && success() && matrix.config == 'debug'
with:
name: (unwinding-reports) unwinding-linux-musl-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: unwinding-reports
- name: Upload test reports
uses: actions/upload-artifact@v4
if: failure()
if: steps.set_enabled.outputs.enabled == 'true' && failure()
with:
name: (test-reports) test-linux-musl-aarch64 (${{ matrix.java_version }}, ${{ matrix.config }})
path: test-reports
25 changes: 24 additions & 1 deletion gradle/patching.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,16 @@ ext.upstreamPatches = [

// Symbol implementation patches for DataDog-specific API extensions
"symbols_linux.cpp": [
validations: [[contains: "#ifdef __linux__"], [contains: "_parsed_inodes"]],
validations: [[contains: "#ifdef __linux__"], [contains: "_parsed_inodes"], [contains: "loadSymbolTable"]],
operations: [
[
type: "expression_replace",
name: "Fix pointer overflow in loadSymbolTable",
description: "Replace unsafe pointer arithmetic with overflow-safe version to prevent ASAN failures while preserving original semantics",
find: "const char\\* addr = base != NULL \\? base \\+ sym->st_value : \\(const char\\*\\)sym->st_value;",
replace: "// Use safe pointer arithmetic to avoid ASAN overflow while preserving original NULL base semantics\n const char* addr = base != NULL ? (const char*)((uintptr_t)base + (uintptr_t)sym->st_value) : (const char*)sym->st_value;",
idempotent_check: "// Use safe pointer arithmetic to avoid ASAN overflow while preserving original NULL base semantics"
],
[
type: "method_implementation",
name: "Add clearParsingCaches method implementation",
Expand All @@ -233,6 +241,21 @@ ext.upstreamPatches = [
]
],

// Symbol implementation patches for macOS (DataDog-specific API extensions and ASan compatibility)
"symbols_macos.cpp": [
validations: [[contains: "#ifdef __APPLE__"], [contains: "loadSymbols"], [contains: "n_value"]],
operations: [
[
type: "expression_replace",
name: "Fix pointer overflow in loadSymbols for macOS",
description: "Replace unsafe pointer arithmetic with overflow-safe version to prevent ASAN failures on macOS",
find: "const char\\* addr = _vmaddr_slide \\+ sym->n_value;",
replace: "// Use safer arithmetic to avoid ASAN overflow while preserving all symbols\n const char* addr = (const char*)((uintptr_t)_vmaddr_slide + (uintptr_t)sym->n_value);",
idempotent_check: "// Use safer arithmetic to avoid ASAN overflow while preserving all symbols"
]
]
],

// Stack frame header patches for DataDog-specific API extensions
"stackFrame.h": [
validations: [
Expand Down
3 changes: 3 additions & 0 deletions gradle/sanitizers/asan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Suppress all AddressSanitizer errors in libjvm
# This is JVM internal code that we cannot fix
interceptor_via_lib:libjvm
Loading