mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-23 03:53:47 +00:00
Fix stack collection with size limit
src/client/linux/minidump_writer/minidump_writer.cc:273 obtains the stack info by calling GetStackInfo(). That method will return the stack base address, aligned to the bottom of the memory page that 'stack_pointer' is in. After that it will cap the size of the memory area to be copied into the minidump to 'max_stack_len', starting from the base address, if the caller requested so. This will be the case when collecting reduced stacks, as introduced by this change: https://breakpad.appspot.com/487002/ In such cases the caller will request 2048 bytes of memory. However GetStackInfo() will have aligned the base address to the page boundary, by default 4096 bytes. If the stack, which grows towards the base address from the top ends before the 2048 bytes of the first block, then we will not collect any useful part of the stack. As a fix we skip chunks of 'max_stack_len' bytes starting from the base address until the stack_pointer is actually contained in the chunk, which we will add to the minidump file. BUG=https://bugs.chromium.org/p/google-breakpad/issues/detail?id=695 R=ivanpe@chromium.org Review URL: https://codereview.chromium.org/1959643004 . Patch from Lars Volker <lv@cloudera.com>.
This commit is contained in:
parent
faeb1f9b2b
commit
f25a411200
1 changed files with 8 additions and 0 deletions
|
@ -275,6 +275,14 @@ class MinidumpWriter {
|
||||||
if (max_stack_len >= 0 &&
|
if (max_stack_len >= 0 &&
|
||||||
stack_len > static_cast<unsigned int>(max_stack_len)) {
|
stack_len > static_cast<unsigned int>(max_stack_len)) {
|
||||||
stack_len = max_stack_len;
|
stack_len = max_stack_len;
|
||||||
|
// Skip empty chunks of length max_stack_len.
|
||||||
|
uintptr_t int_stack = reinterpret_cast<uintptr_t>(stack);
|
||||||
|
if (max_stack_len > 0) {
|
||||||
|
while (int_stack + max_stack_len < stack_pointer) {
|
||||||
|
int_stack += max_stack_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stack = reinterpret_cast<const void*>(int_stack);
|
||||||
}
|
}
|
||||||
if (!memory.Allocate(stack_len))
|
if (!memory.Allocate(stack_len))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue