-
Notifications
You must be signed in to change notification settings - Fork 11
Fix stack walking alignment issues causing ASAN violations #362
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
base: main
Are you sure you want to change the base?
Conversation
- Add frame size validation and alignment checks in stackWalker - Replace raw pointer dereferences with SafeAccess::load in signal-critical paths - Add deoptimization check before walking compiled frames - Enable ASAN/TSAN configs in Docker test script - Document Docker-based testing workflow in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
CI Test ResultsRun: #21863805109 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary
Updated: 2026-02-10 12:22:23 UTC |
- Use pattern matching to download all failures-* artifacts - Add merge-multiple flag to combine artifacts - Add graceful handling for missing failure files - Fix JSON format in Slack webhook payload - Add webhook existence check before posting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
MAX_FRAME_SIZE is in StackWalkValidation namespace, need explicit qualification before using declarations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Scan-Build Report
Bug Summary
Reports
|
||||||||||||||||||||||||||||||||||||
Benchmarks [aarch64 memleak,alloc]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 19 metrics, 0 unstable metrics. |
Benchmarks [x86_64 alloc]Parameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 22 unstable metrics.
|
Benchmarks [aarch64 wall]Parameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 17 metrics, 20 unstable metrics.
|
Benchmarks [x86_64 cpu,wall,alloc,memleak]Parameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 23 unstable metrics.
|
Benchmarks [aarch64 cpu]Parameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 16 metrics, 21 unstable metrics.
|
Benchmarks [x86_64 memleak,alloc]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 23 unstable metrics. |
Benchmarks [x86_64 cpu]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 23 unstable metrics. |
Benchmarks [aarch64 cpu,wall]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 17 metrics, 21 unstable metrics. |
Benchmarks [aarch64 memleak]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 23 unstable metrics. |
Benchmarks [aarch64 cpu,wall,alloc,memleak]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 23 unstable metrics. |
Benchmarks [aarch64 alloc]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 16 metrics, 22 unstable metrics. |
Benchmarks [x86_64 wall]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 24 unstable metrics. |
Benchmarks [x86_64 memleak]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 24 unstable metrics. |
Benchmarks [x86_64 cpu,wall]Parameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 24 unstable metrics. |
What does this PR do?:
Fixes critical alignment issues in stack walking that were causing ASAN violations during nightly runs.
Primary fixes:
Supporting improvements:
Motivation:
A recent nightly ASAN run identified alignment violations in stack walking - https://github.com/DataDog/java-profiler/actions/runs/21851118212/job/63057859995#step:9:363
The issue occurred when sp (stack pointer) was not properly aligned before being dereferenced as a pointer. Without alignment checks, the profiler could attempt to read from misaligned addresses, causing:
This PR systematically adds alignment validation at all pointer dereference sites in the stack walking code paths (walkVM, walkDwarf), ensuring memory is only accessed at properly aligned boundaries.
Additional Notes:
The alignment checks follow the pattern already established in the codebase but weren't consistently applied across all unwinding paths. Frame size validation prevents walking beyond reasonable frame boundaries (MAX_FRAME_SIZE_WORDS = 32768 words).
How to test the change?:
./gradlew testAsan./utils/run-docker-tests.sh --config=asan --jdk=21For Datadog employees:
@DataDog/security-design-and-guidance.