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

Side by Side Diff: components/nacl/loader/nonsfi/irt_exception_handling.cc

Issue 1158793003: Enable one PID namespace per process for NaCl processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable PID namespace per process for nonsfi newlib NaCl as well. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <pthread.h> 6 #include <pthread.h>
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include "components/nacl/loader/nonsfi/irt_interfaces.h" 9 #include "components/nacl/loader/nonsfi/irt_interfaces.h"
10 #include "native_client/src/include/nacl_macros.h" 10 #include "native_client/src/include/nacl_macros.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (signal_handler_function_pointer) { 42 if (signal_handler_function_pointer) {
43 NaClSignalContext signal_context; 43 NaClSignalContext signal_context;
44 NaClSignalContextFromHandler(&signal_context, uc); 44 NaClSignalContextFromHandler(&signal_context, uc);
45 NaClExceptionFrame exception_frame; 45 NaClExceptionFrame exception_frame;
46 NaClSignalSetUpExceptionFrame(&exception_frame, 46 NaClSignalSetUpExceptionFrame(&exception_frame,
47 &signal_context, 47 &signal_context,
48 0 /* context_user_addr, 48 0 /* context_user_addr,
49 not useful for NonSFI NaCl. */); 49 not useful for NonSFI NaCl. */);
50 signal_handler_function_pointer(&exception_frame.context); 50 signal_handler_function_pointer(&exception_frame.context);
51 } 51 }
52 _exit(-1); 52 _exit(-sig);
53 } 53 }
54 54
55 int IrtExceptionHandler(NaClExceptionHandler handler, 55 int IrtExceptionHandler(NaClExceptionHandler handler,
56 NaClExceptionHandler* old_handler) { 56 NaClExceptionHandler* old_handler) {
57 pthread_mutex_lock(&mutex); 57 pthread_mutex_lock(&mutex);
58 if (old_handler) 58 if (old_handler)
59 *old_handler = signal_handler_function_pointer; 59 *old_handler = signal_handler_function_pointer;
60 signal_handler_function_pointer = handler; 60 signal_handler_function_pointer = handler;
61 pthread_mutex_unlock(&mutex); 61 pthread_mutex_unlock(&mutex);
62 return 0; 62 return 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Install all handlers. 102 // Install all handlers.
103 for (a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) { 103 for (a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) {
104 if (sigaction(kSignals[a], &sa, NULL) != 0) 104 if (sigaction(kSignals[a], &sa, NULL) != 0)
105 NaClLog(LOG_FATAL, "sigaction to register signals failed.\n"); 105 NaClLog(LOG_FATAL, "sigaction to register signals failed.\n");
106 } 106 }
107 } 107 }
108 108
109 } // namespace nonsfi 109 } // namespace nonsfi
110 } // namespace nacl 110 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_helper_linux.cc ('k') | components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698