From 5553532e3a5d3b0ee3a1b364debd1224a41f84f3 Mon Sep 17 00:00:00 2001 From: "thestig@google.com" Date: Mon, 1 Jun 2009 21:24:56 +0000 Subject: In Linux Breakpad, point the child stack at the top-most address rather than the bottom-most address before calling clone(). BUG=none TEST=Official builds on Linux should be able to dump/upload reliably when running with --crash-test. Review URL: http://codereview.chromium.org/115955 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17354 0039d316-1c4b-4281-b951-d872f2087c98 --- breakpad/linux/exception_handler.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'breakpad/linux') diff --git a/breakpad/linux/exception_handler.cc b/breakpad/linux/exception_handler.cc index fe72f2f..ad7a11d 100644 --- a/breakpad/linux/exception_handler.cc +++ b/breakpad/linux/exception_handler.cc @@ -79,6 +79,7 @@ #include #include +#include "breakpad/linux/linux_libc_support.h" #include "breakpad/linux/linux_syscall_support.h" #include "breakpad/linux/memory.h" #include "breakpad/linux/minidump_writer.h" @@ -266,8 +267,14 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) { callback_context_)) return true; + static const unsigned kChildStackSize = 8000; PageAllocator allocator; - void* const stack = allocator.Alloc(8000); + uint8_t* stack = (uint8_t*) allocator.Alloc(kChildStackSize); + if (!stack) + return false; + // clone() needs the top-most address. (scrub just to be safe) + stack += kChildStackSize; + my_memset(stack - 16, 0, 16); ThreadArgument thread_arg; thread_arg.handler = this; -- cgit v1.1