Primiano Tucci 4d06db5a1f Linux ExceptionHandler: don't allocate the CrashContext on the stack
On Android the size of the alternate stack can be very small (8k).
Even if breakpad uses sigaltstack to increase the size of the alternate
stack during initialization, that call affects only the main thread.
On Android, the libc's pthread initializer reset the sigaltstack to 8k.
When entering a signal handler, the kernel typically pushes the context
on the alternate stack. On arm64, sizeof(CrashContext) is ~5k, which
leaves 3k of usable stack for breakpad.
On top of that, breakpad allocates another struct CrashContext on the
stack. In the case of Android arm64, then, breakpad ends up using
5k + 5k > 8k of stack, which causes a stack overflow.
This got unnoticed in Android L, as the alternate stack didn't have
red-zones between them, so breakpad was often happily overflowing onto
the next thread's stack. This is not the case anymore [1].
This CL moves the CrashContext into a global variable. It should be
safe as the ExceptionHandlers are serialized on a mutex.

[1] 595752f623

BUG=374
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1354923002 .
2015-09-22 09:11:24 +01:00
2013-12-13 16:49:11 +00:00
2015-09-11 01:37:29 -04:00
2013-12-10 17:53:50 +00:00

Breakpad is a set of client and server components which implement a
crash-reporting system.


-----
Getting started in 32-bit mode (from trunk)
Configure: CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ./configure
    Build: make
     Test: make check
  Install: make install

If you need to reconfigure your build be sure to run "make distclean" first.


-----
To request change review:
0. Get a copy of depot_tools repo.
   http://dev.chromium.org/developers/how-tos/install-depot-tools

1. Create a new directory for checking out the source code.
   mkdir breakpad && cd breakpad

2. Run the `fetch` tool from depot_tools to download all the source repos.
   fetch breakpad

3. Make changes. Build and test your changes.
   For core code like processor use methods above.
   For linux/mac/windows, there are test targets in each project file.

4. Commit your changes to your local repo and upload them to the server.
   http://dev.chromium.org/developers/contributing-code
   e.g. git commit ... && git cl upload ...
   You will be prompted for credential and a description.

5. At https://codereview.chromium.org/ you'll find your issue listed; click on
   it, and select Publish+Mail, and enter in the code reviewer and CC
   google-breakpad-dev@googlegroups.com
Description
No description provided
Readme 39 MiB
Languages
C++ 68.2%
Makefile 12.8%
C 5.1%
Shell 5%
Objective-C 3.6%
Other 5.3%