OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <unistd.h> | 5 #include <unistd.h> |
6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
9 #include <sys/signal.h> | 9 #include <sys/signal.h> |
10 #include <sys/prctl.h> | 10 #include <sys/prctl.h> |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 base::RandUint64(); | 311 base::RandUint64(); |
312 | 312 |
313 // To make wcstombs/mbstowcs work in a renderer, setlocale() has to be | 313 // To make wcstombs/mbstowcs work in a renderer, setlocale() has to be |
314 // called before the sandbox is triggered. It's possible to avoid calling | 314 // called before the sandbox is triggered. It's possible to avoid calling |
315 // setlocale() by pulling out the conversion between FilePath and | 315 // setlocale() by pulling out the conversion between FilePath and |
316 // WebCore String out of the renderer and using string16 in place of | 316 // WebCore String out of the renderer and using string16 in place of |
317 // FilePath for IPC. | 317 // FilePath for IPC. |
318 const char* locale = setlocale(LC_ALL, ""); | 318 const char* locale = setlocale(LC_ALL, ""); |
319 LOG_IF(WARNING, locale == NULL) << "setlocale failed."; | 319 LOG_IF(WARNING, locale == NULL) << "setlocale failed."; |
320 | 320 |
321 #if defined(ARCH_CPU_X86_FAMILY) | 321 #if defined(ARCH_CPU_X86) |
322 PATCH_GLOBAL_OFFSET_TABLE(localtime, sandbox_wrapper::localtime); | 322 PATCH_GLOBAL_OFFSET_TABLE(localtime, sandbox_wrapper::localtime); |
323 PATCH_GLOBAL_OFFSET_TABLE(localtime_r, sandbox_wrapper::localtime_r); | 323 PATCH_GLOBAL_OFFSET_TABLE(localtime_r, sandbox_wrapper::localtime_r); |
324 #endif | 324 #endif |
325 | 325 |
326 static const char kChrootMe = 'C'; | 326 static const char kChrootMe = 'C'; |
327 static const char kChrootMeSuccess = 'O'; | 327 static const char kChrootMeSuccess = 'O'; |
328 | 328 |
329 if (HANDLE_EINTR(write(fd, &kChrootMe, 1)) != 1) { | 329 if (HANDLE_EINTR(write(fd, &kChrootMe, 1)) != 1) { |
330 LOG(ERROR) << "Failed to write to chroot pipe: " << errno; | 330 LOG(ERROR) << "Failed to write to chroot pipe: " << errno; |
331 return false; | 331 return false; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 bool ZygoteMain(const MainFunctionParams& params) { | 382 bool ZygoteMain(const MainFunctionParams& params) { |
383 if (!MaybeEnterChroot()) { | 383 if (!MaybeEnterChroot()) { |
384 LOG(FATAL) << "Failed to enter sandbox. Fail safe abort. (errno: " | 384 LOG(FATAL) << "Failed to enter sandbox. Fail safe abort. (errno: " |
385 << errno << ")"; | 385 << errno << ")"; |
386 return false; | 386 return false; |
387 } | 387 } |
388 | 388 |
389 Zygote zygote; | 389 Zygote zygote; |
390 return zygote.ProcessRequests(); | 390 return zygote.ProcessRequests(); |
391 } | 391 } |
OLD | NEW |