No description
Find a file
primiano@chromium.org 69b745aa74 Fix signal propagation logic for Linux/Android exception handler.
The current code is relying on info->si_pid to figure out whether
the exception handler was triggered by a signal coming from the kernel
(that will re-trigger until the cause that triggered the signal has
been cleared) or from user-space e.g., kill -SIGNAL pid, which will NOT
automatically re-trigger in the next signal handler in the chain.
While the intentions are good (manually re-triggering user-space
signals), the current implementation mistakenly looks at the si_pid
field in siginfo_t, assuming that it is coming from the kernel if
si_pid == 0.
This is wrong. siginfo_t, in fact, is a union and si_pid is meaningful
only for userspace signals. For signals originated by the kernel,
instead, si_pid overlaps with si_addr (the faulting address).
As a matter of facts, the current implementation is mistakenly
re-triggering the signal using tgkill for most of the kernel-space
signals (unless the fault address is exactly 0x0).
This is not completelly correct for the case of SIGSEGV/SIGBUS. The
next handler in the chain will stil see the signal, but the |siginfo|
and the |context| arguments of the handler will be meaningless
(retriggering a signal with tgkill doesn't preserve them).
Therefore, if the next handler in the chain expects those arguments
to be set, it will fail.
Concretelly, this is causing problems to WebView. In some rare
circumstances, the next handler in the chain is a user-space runtime
which does SIGSEGV handling to implement speculative null pointer
managed exceptions (see as an example
http://www.mono-project.com/docs/advanced/runtime/docs/exception-handling/)

The fix herein proposed consists in using the si_code (see SI_FROMUSER
macros) to determine whether a signal is coming form the kernel
(and therefore just re-establish the next signal handler) or from
userspace (and use the tgkill logic).

Repro case:
This issue is visible in Chrome for Android with this simple repro case:
- Add a non-null pointer dereference in the codebase:
  *((volatile int*)0xbeef) = 42
Without this change: the next handler (the libc trap) prints:
  F/libc  (  595): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x487
  where 0x487 is actually the PID of the process (which is wrong).
With this change: the next handler prints:
  F/libc  (  595): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbeef
  which is the correct answer.

BUG=chromium:481937
R=mark@chromium.org

Review URL: https://breakpad.appspot.com/6844002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1454 4c0a9323-5329-0410-9bdc-e9ce6186880e
2015-04-30 09:12:54 +00:00
android Misc Android-related fixes. 2013-12-13 16:49:11 +00:00
autotools synx with latest upstream gnuconfig 2015-04-18 03:25:50 +00:00
m4 Issue 378 - Don't compile Linux client libraries on non-Linux systems 2010-08-31 15:09:01 +00:00
src Fix signal propagation logic for Linux/Android exception handler. 2015-04-30 09:12:54 +00:00
.gitignore Move build configuration to root of repository. 2014-04-03 18:34:24 +00:00
aclocal.m4 make "make install" also install headers and pkgconfig files 2014-08-27 02:10:55 +00:00
AUTHORS Make build system less annoying (#8) r=bryner 2006-08-30 20:05:05 +00:00
breakpad-client.pc.in make "make install" also install headers and pkgconfig files 2014-08-27 02:10:55 +00:00
breakpad.pc.in make "make install" also install headers and pkgconfig files 2014-08-27 02:10:55 +00:00
ChangeLog Initial import, which includes the Windows client-side dump_syms tool, and 2006-08-25 21:14:45 +00:00
codereview.settings Add codereview.settings so we can use gcl. 2010-06-19 02:48:54 +00:00
configure make "make install" also install headers and pkgconfig files 2014-08-27 02:10:55 +00:00
configure.ac make "make install" also install headers and pkgconfig files 2014-08-27 02:10:55 +00:00
DEPS Move build configuration to root of repository. 2014-04-03 18:34:24 +00:00
INSTALL autoreconf -f -i 2013-12-10 17:53:50 +00:00
LICENSE Renaming file COPYING to LICENSE and appending the disclaimer from src/common/convert_UTF.h to LICENSE. 2014-02-27 19:23:16 +00:00
Makefile.am Add address and reason for IN_PAGE_ERROR. 2015-04-10 22:05:29 +00:00
Makefile.in Add address and reason for IN_PAGE_ERROR. 2015-04-10 22:05:29 +00:00
NEWS Initial import, which includes the Windows client-side dump_syms tool, and 2006-08-25 21:14:45 +00:00
README Update readme and fix glog properties. 2010-08-13 18:49:03 +00:00
README.ANDROID Update breakpad to support Android NDK r10c 2014-10-21 13:50:27 +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 access to a read-write copy of source.
   Owners at http://code.google.com/p/google-breakpad/ are able to grant
   this access.

1. Check out a read-write copy of source using instructions at
   http://code.google.com/p/google-breakpad/source/checkout

2. 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.

3. Download http://codereview.appspot.com/static/upload.py

4. Run upload.py from the 'src' directory:
   upload.py --server=breakpad.appspot.com

   You will be prompted for credential and a description.

5. At http://breakpad.appspot.com 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

6. When applying code review feedback, specify the '-i' option when running
   upload.py again and pass the issue number so it updates the existing issue,
   rather than creating a new one.
   Be sure to rerun upload.py from the same directory as you did for previous
   uploads to allow for proper diff calculations.