| Index: third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h
|
| diff --git a/third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h b/third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h
|
| index 0f8c4de1957768bc6a79c1e678ae3b90002aa264..cba78132fb55d1e851b90c497ec79337642e0c82 100644
|
| --- a/third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h
|
| +++ b/third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h
|
| @@ -65,9 +65,6 @@ typedef ucontext ucontext_t;
|
| #endif
|
|
|
| #include "google/stacktrace.h"
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| -#include "linux_shadow_stacks.h"
|
| -#endif // KEEP_SHADOW_STACKS
|
|
|
| #if defined(__linux__) && defined(__i386__) && defined(__ELF__) && defined(HAVE_MMAP)
|
| // Count "push %reg" instructions in VDSO __kernel_vsyscall(),
|
| @@ -241,9 +238,14 @@ static void **NextStackFrame(void **old_sp, const void *uc) {
|
| // In the non-strict mode, allow discontiguous stack frames.
|
| // (alternate-signal-stacks for example).
|
| if (new_sp == old_sp) return NULL;
|
| - // And allow frames upto about 1MB.
|
| - if ((new_sp > old_sp)
|
| - && ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) return NULL;
|
| + if (new_sp > old_sp) {
|
| + // And allow frames upto about 1MB.
|
| + const uintptr_t delta = (uintptr_t)new_sp - (uintptr_t)old_sp;
|
| + const uintptr_t acceptable_delta = 1000000;
|
| + if (delta > acceptable_delta) {
|
| + return NULL;
|
| + }
|
| + }
|
| }
|
| if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return NULL;
|
| #ifdef __i386__
|
| @@ -319,21 +321,6 @@ int GET_STACK_TRACE_OR_FRAMES {
|
| #endif
|
|
|
| int n = 0;
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| - void **shadow_ip_stack;
|
| - void **shadow_sp_stack;
|
| - int stack_size;
|
| - shadow_ip_stack = (void**) get_shadow_ip_stack(&stack_size);
|
| - shadow_sp_stack = (void**) get_shadow_sp_stack(&stack_size);
|
| - int shadow_index = stack_size - 1;
|
| - for (int i = stack_size - 1; i >= 0; i--) {
|
| - if (sp == shadow_sp_stack[i]) {
|
| - shadow_index = i;
|
| - break;
|
| - }
|
| - }
|
| - void **prev_sp = NULL;
|
| -#endif // KEEP_SHADOW_STACKS
|
| while (sp && n < max_depth) {
|
| if (*(sp+1) == reinterpret_cast<void *>(0)) {
|
| // In 64-bit code, we often see a frame that
|
| @@ -346,17 +333,8 @@ int GET_STACK_TRACE_OR_FRAMES {
|
| void **next_sp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(sp, ucp);
|
| if (skip_count > 0) {
|
| skip_count--;
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| - shadow_index--;
|
| -#endif // KEEP_SHADOW_STACKS
|
| } else {
|
| result[n] = *(sp+1);
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| - if ((shadow_index > 0) && (sp == shadow_sp_stack[shadow_index])) {
|
| - shadow_index--;
|
| - }
|
| -#endif // KEEP_SHADOW_STACKS
|
| -
|
| #if IS_STACK_FRAMES
|
| if (next_sp > sp) {
|
| sizes[n] = (uintptr_t)next_sp - (uintptr_t)sp;
|
| @@ -367,25 +345,7 @@ int GET_STACK_TRACE_OR_FRAMES {
|
| #endif
|
| n++;
|
| }
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| - prev_sp = sp;
|
| -#endif // KEEP_SHADOW_STACKS
|
| sp = next_sp;
|
| }
|
| -
|
| -#if defined(KEEP_SHADOW_STACKS)
|
| - if (shadow_index >= 0) {
|
| - for (int i = shadow_index; i >= 0; i--) {
|
| - if (shadow_sp_stack[i] > prev_sp) {
|
| - result[n] = shadow_ip_stack[i];
|
| - if (n + 1 < max_depth) {
|
| - n++;
|
| - continue;
|
| - }
|
| - }
|
| - break;
|
| - }
|
| - }
|
| -#endif // KEEP_SHADOW_STACKS
|
| return n;
|
| }
|
|
|