Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3067)

Unified Diff: components/nacl/loader/nonsfi/irt_thread.cc

Issue 230413002: NonSFI NaCl: Plumb Exception IRT enough for breakpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/nacl/loader/nonsfi/irt_thread.cc
diff --git a/components/nacl/loader/nonsfi/irt_thread.cc b/components/nacl/loader/nonsfi/irt_thread.cc
index 3351bdc48b1dbbfee29eb063a668f6f1c7e102b6..b7f5c9a7e03c7dd708f630acc3f652260c4c13f4 100644
--- a/components/nacl/loader/nonsfi/irt_thread.cc
+++ b/components/nacl/loader/nonsfi/irt_thread.cc
@@ -6,9 +6,11 @@
#include <pthread.h>
#include <stdlib.h>
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/nacl/loader/nonsfi/irt_interfaces.h"
+#include "native_client/src/trusted/service_runtime/nacl_signal.h"
namespace nacl {
namespace nonsfi {
@@ -33,6 +35,7 @@ class ScopedPthreadAttrPtr {
struct ThreadContext {
void (*start_func)();
void* thread_ptr;
+ void* signal_stack;
};
// A thread local pointer to support nacl_irt_tls.
@@ -45,6 +48,9 @@ void* ThreadMain(void *arg) {
::scoped_ptr<ThreadContext> context(static_cast<ThreadContext*>(arg));
g_thread_ptr = context->thread_ptr;
+ DVLOG(4) << "Registering alternate signal stack: " << context->signal_stack;
+ NaClSignalStackRegister(context->signal_stack);
Mark Seaborn 2014/04/23 03:49:50 This probably doesn't work: the seccomp sandbox wi
Junichi Uekawa 2014/04/23 07:56:15 I was wondering why my tests are succeeding and I
+
// Release the memory of context before running start_func.
void (*start_func)() = context->start_func;
context.reset();
@@ -72,6 +78,10 @@ int IrtThreadCreate(void (*start_func)(), void* stack, void* thread_ptr) {
::scoped_ptr<ThreadContext> context(new ThreadContext);
context->start_func = start_func;
context->thread_ptr = thread_ptr;
+ if (!NaClSignalStackAllocate(&context->signal_stack)) {
+ DVLOG(1) << "Failed to allocate alternate stack\n";
+ return error;
+ }
pthread_t tid;
error = pthread_create(&tid, &attr, ThreadMain, context.get());

Powered by Google App Engine
This is Rietveld 408576698