Joe McDonnell has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/23443


Change subject: IMPALA-13472: Patch breakpad to fix minidump stacks for 64KB 
pages
......................................................................

IMPALA-13472: Patch breakpad to fix minidump stacks for 64KB pages

When resolving minidumps from Redhat8 ARM machines, we found
that the stack traces were truncated, with only the top frame
available. The minidump_stackwalk output included this error
message:
minidump.cc:1391: INFO: MinidumpMemoryRegion request out of range: 
0xfffee0aadf30+8/0xfffee0aa0000+0x8000
stackwalker_arm64.cc:dc: ERROR: Unable to read caller_fp from last_fp: 
0xfffee0aadf30
The 0x8000 is 32KB, so the minidump contains 32KB of stack, but
that 32KB doesn't cover the memory pointed to by the stack pointer
register.

This is due to this logic in Breakpad's LinuxDumper::GetStackInfo():
  // Move the stack pointer to the bottom of the page that it's in.
  const uintptr_t page_size = getpagesize();
  uint8_t* const stack_pointer =
      reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));

When Breakpad moves the stack pointer to the bottom of the page,
it is including unused stack memory (as the stack is top to bottom).
With a 64KB page size, since it only copies 32KB of the stack memory,
this memory usually doesn't contain any used stack memory. This
lines up with the observations from trying to process the minidump.

It is unclear why Breakpad moves the stack pointer to the bottom
of the page to include unused stack memory. There is a 128 byte
red zone on x86_64 which leaf functions can use without changing
the stack pointer, but that does not require the whole page (and
the rounding logic would not include it when near the boundary).

This changes the logic to explicitly include the 128 byte red
zone (respecting the boundary of the memory region). It then
rounds off the stack pointer to a 1KB boundary rather than a
whole OS page. This may not be necessary, but it is mostly
harmless and can be optimized more later.

Testing:
 - Linked Impala with the modified Breakpad, sent SIGUSR1 to produce
   a minidump, then resolved the minidump. ARM64 with 64KB pages
   produces stack traces. x86_64 also continues to work.

Change-Id: Iaf19523e69628e78071636292b3cf464a7b626b8
---
M buildall.sh
A 
source/breakpad/breakpad-e09741c609dcd5f5274d40182c5e2cc9a002d5ba-patches/0003-Fix-stack-collection-for-64KB-page-size.patch
2 files changed, 44 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/native-toolchain 
refs/changes/43/23443/1
--
To view, visit http://gerrit.cloudera.org:8080/23443
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: native-toolchain
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf19523e69628e78071636292b3cf464a7b626b8
Gerrit-Change-Number: 23443
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <[email protected]>

Reply via email to