Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(24)

Issue 481002: Make Linux signal handler more robust. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by digit
Modified:
11 years, 5 months ago
CC:
google-breakpad-dev_googlegroups.com
Base URL:
http://google-breakpad.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Make Linux signal handler more robust.

Breakpad can be used on processes where a mistaken
library saves then restores one of our signal handlers
with 'signal' instead of 'sigaction'.

This loses the SA_SIGINFO flag associated with the 
Breakpad handler, and in some cases (e.g. Android/ARM
kernels), the values of the 'info' and 'uc' parameters
that ExceptionHandler::SignalHandler() receives will
be completely bogus, leading to a crash when the function
is executed (and of course, no minidump generation).

To work-around this, have SignalHandler() check the state
of the flag. If it is incorrectly unset, re-register with
'sigaction' and the correct flag, then return. The signal
will be re-thrown, and this time the function will be
called with the correct values.
Committed: https://code.google.com/p/google-breakpad/source/detail?r=1067

Patch Set 1 #

Total comments: 10

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M src/client/linux/handler/exception_handler.cc View 1 1 chunk +29 lines, -0 lines 0 comments Download
M src/client/linux/handler/exception_handler_unittest.cc View 1 1 chunk +31 lines, -0 lines 0 comments Download

Messages

Total messages: 4
digit
Patch originally from cjhopman for Android, I'm just upstreaming our patch in a tiny cleaner ...
11 years, 5 months ago #1
Mark Mentovai
LGTM http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_handler.cc File src/client/linux/handler/exception_handler.cc (right): http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_handler.cc#newcode260 src/client/linux/handler/exception_handler.cc:260: if (sigaction(kExceptionSignals[i], &sa, NULL) == -1) I don’t ...
11 years, 5 months ago #2
cjhopman
lgtm http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_handler.cc File src/client/linux/handler/exception_handler.cc (right): http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_handler.cc#newcode316 src/client/linux/handler/exception_handler.cc:316: if (sigaction(sig, &cur_handler, NULL) < 0) { Nit: ...
11 years, 5 months ago #3
digit
11 years, 5 months ago #4
http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
File src/client/linux/handler/exception_handler.cc (right):

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
src/client/linux/handler/exception_handler.cc:260: if
(sigaction(kExceptionSignals[i], &sa, NULL) == -1)
Sorry, that wasn't intentional, my git and svn states got mixed up a bit.

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
src/client/linux/handler/exception_handler.cc:304: // This forces the signal to
be throwned again, but this time the kernel
On 2012/10/09 15:56:09, Mark Mentovai wrote:
> throwned -> thrown
Done.

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
src/client/linux/handler/exception_handler.cc:316: if (sigaction(sig,
&cur_handler, NULL) < 0) {
On 2012/10/09 16:12:02, cjhopman wrote:
> Nit: For consistency with the rest of the file, maybe change this to "== -1".
Sure, done.

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
File src/client/linux/handler/exception_handler_unittest.cc (right):

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
src/client/linux/handler/exception_handler_unittest.cc:320: // Check that
On 2012/10/09 16:12:02, cjhopman wrote:
> Finish this comment.
Done.

http://breakpad.appspot.com/481002/diff/1/src/client/linux/handler/exception_...
src/client/linux/handler/exception_handler_unittest.cc:325: // Install the
RaiseSIGKILL handler for SIGSEGV
On 2012/10/09 16:12:02, cjhopman wrote:
> Nit: full stop
Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted