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

Side by Side Diff: chrome/nacl/nacl_helper_linux.cc

Issue 10830009: Redefine the ASan options for nacl_helper so that ASan does not handle SIGSEGV/SIGBUS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A mini-zygote specifically for Native Client. 5 // A mini-zygote specifically for Native Client.
6 6
7 #include "chrome/common/nacl_helper_linux.h" 7 #include "chrome/common/nacl_helper_linux.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <link.h> 10 #include <link.h>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 char *endp; 191 char *endp;
192 prereserved_sandbox_size = 192 prereserved_sandbox_size =
193 strtoul(reserved_at_zero_switch_value.c_str(), &endp, 0); 193 strtoul(reserved_at_zero_switch_value.c_str(), &endp, 0);
194 if (*endp != '\0') 194 if (*endp != '\0')
195 LOG(ERROR) << "Could not parse reserved_at_zero argument value of " 195 LOG(ERROR) << "Could not parse reserved_at_zero argument value of "
196 << reserved_at_zero_switch_value; 196 << reserved_at_zero_switch_value;
197 } 197 }
198 return prereserved_sandbox_size; 198 return prereserved_sandbox_size;
199 } 199 }
200 200
201 #if defined(ADDRESS_SANITIZER)
202 // Do not install the SIGSEGV handler in ASan. This should make the NaCl
203 // platform qualification test pass.
204 static const char kAsanDefaultOptionsNaCl[] = "handle_segv=0";
205
206 // Override the default ASan options for the NaCl helper.
207 // __asan_default_options should not be instrumented, because it is called
208 // before ASan is initialized.
209 extern "C"
210 __attribute__((no_address_safety_analysis))
211 const char *__asan_default_options() {
212 return kAsanDefaultOptionsNaCl;
213 }
214 #endif
215
201 int main(int argc, char *argv[]) { 216 int main(int argc, char *argv[]) {
202 CommandLine::Init(argc, argv); 217 CommandLine::Init(argc, argv);
203 base::AtExitManager exit_manager; 218 base::AtExitManager exit_manager;
204 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised 219 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised
205 #if !defined(CHROMIUM_SELINUX) 220 #if !defined(CHROMIUM_SELINUX)
206 // Allows NSS to fopen() /dev/urandom. 221 // Allows NSS to fopen() /dev/urandom.
207 sandbox::InitLibcUrandomOverrides(); 222 sandbox::InitLibcUrandomOverrides();
208 #endif 223 #endif
209 #if defined(USE_NSS) 224 #if defined(USE_NSS)
210 // Configure NSS for use inside the NaCl process. 225 // Configure NSS for use inside the NaCl process.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 _exit(-1); 274 _exit(-1);
260 } 275 }
261 // if fork fails, send PID=-1 to zygote 276 // if fork fails, send PID=-1 to zygote
262 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, 277 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid,
263 sizeof(badpid), empty)) { 278 sizeof(badpid), empty)) {
264 LOG(ERROR) << "*** send() to zygote failed"; 279 LOG(ERROR) << "*** send() to zygote failed";
265 } 280 }
266 } 281 }
267 CHECK(false); // This routine must not return 282 CHECK(false); // This routine must not return
268 } 283 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698