From e841b92e18e85f0d943441f949062b74b2a544b6 Mon Sep 17 00:00:00 2001 From: Francois Rousseau Date: Thu, 13 May 2021 16:31:10 -0700 Subject: [PATCH] fuchsia: clarify stack capture in case of stack overflow Bug: fuchsia:74897 Change-Id: I1a81feaa2e854c51d7dc476d57b5f7d1ffb1d6e7 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2895346 Reviewed-by: Scott Graham Commit-Queue: Francois Rousseau --- snapshot/fuchsia/process_reader_fuchsia.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/snapshot/fuchsia/process_reader_fuchsia.cc b/snapshot/fuchsia/process_reader_fuchsia.cc index 4522e511..1c037d74 100644 --- a/snapshot/fuchsia/process_reader_fuchsia.cc +++ b/snapshot/fuchsia/process_reader_fuchsia.cc @@ -46,6 +46,12 @@ void GetStackRegions( #error Port #endif + // TODO(fxbug.dev/74897): make this work for stack overflows, e.g., by looking + // up using the initial stack pointer (sp) when the thread was created. Right + // now, it gets the stack by getting the mapping that contains the current sp. + // But in the case of stack overflows, the current sp is by definition outside + // of the stack so the mapping returned is not the stack and fails the type + // check, at least on arm64. zx_info_maps_t range_with_sp; if (!memory_map.FindMappingForAddress(sp, &range_with_sp)) { LOG(ERROR) << "stack pointer not found in mapping"; @@ -54,7 +60,7 @@ void GetStackRegions( if (range_with_sp.type != ZX_INFO_MAPS_TYPE_MAPPING) { LOG(ERROR) << "stack range has unexpected type " << range_with_sp.type - << ", aborting"; + << ", stack overflow? Aborting"; return; }