Skip to content

Conversation

@bryancall
Copy link
Contributor

@bryancall bryancall commented Dec 11, 2025

Summary

  • Fix ASAN SEGV in crashlog_write_backtrace() when ServerBacktrace() returns 0 but leaves trace pointer null
  • This occurs when the target process has already exited before crashlog can retrieve the backtrace
  • Added null check before calling fprintf() with the trace pointer

Root Cause

Introduced in PR #10811 which moved backtrace logging from traffic_manager to traffic_crashlog but didn't account for trace being null.

Test plan

  • Build with ASAN (cmake --preset dev-asan)
  • Create invalid remap.config to trigger crash
  • Verify traffic_crashlog no longer crashes with ASAN SEGV
  • Verify crash log contains "Unable to retrieve backtrace: trace is null" message

ServerBacktrace() can return 0 (success) but leave the trace pointer
null when the target process has already exited. This caused a SEGV
when fprintf() was called with the null trace pointer.

Add a null check before using the trace pointer.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a null pointer dereference bug in traffic_crashlog that occurs when attempting to retrieve a backtrace from a process that has already exited. The fix adds a null check after the ServerBacktrace() call to prevent dereferencing a null pointer before writing to the crash log file.

Key changes:

  • Added null pointer check for the trace variable after ServerBacktrace() returns successfully
  • Added informative error message when backtrace retrieval fails due to null trace

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bryancall bryancall merged commit 7f6f697 into apache:master Dec 15, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants