zhangyancoder / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

Breakpad's use of sigaltstack() only applies to the first thread #374

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Breakpad's src/client/linux/handler/exception_handler.cc sets up a
signal stack using sigaltstack() and has the comment:
  // We run the signal handlers on an alternative stack because we might have
  // crashed because of a stack overflow.

However, signal stacks are per-thread, and there is nothing to set a
signal stack in any new threads.  This is probably not critical: the
signal handler will probably not go wrong unless the crash was caused
by running out of stack or (less likely) thread A is in the process of
underrunning a buffer on thread B's stack while thread B crashes.

However, it seems misleading to set up a signal stack if it's not
always used.

Original issue reported on code.google.com by mseaborn@chromium.org on 24 Mar 2010 at 4:19

GoogleCodeExporter commented 9 years ago
BTW the context is that, in Native Client, we must set up a signal stack in any 
thread 
that runs untrusted code, because we can't trust the contents of %esp/%rsp (see 
http://code.google.com/p/nativeclient/issues/detail?id=206).

Original comment by mseaborn@chromium.org on 24 Mar 2010 at 4:21