| 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 "chrome/browser/zygote_host_linux.h" | 5 #include "chrome/browser/zygote_host_linux.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix); | 46 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix); |
| 47 cmd_line.PrependWrapper(prefix); | 47 cmd_line.PrependWrapper(prefix); |
| 48 } | 48 } |
| 49 | 49 |
| 50 struct stat st; | 50 struct stat st; |
| 51 if (stat(kSandboxBinary, &st) == 0) { | 51 if (stat(kSandboxBinary, &st) == 0) { |
| 52 if (access(kSandboxBinary, X_OK) == 0 && | 52 if (access(kSandboxBinary, X_OK) == 0 && |
| 53 (st.st_mode & S_ISUID) && | 53 (st.st_mode & S_ISUID) && |
| 54 (st.st_mode & S_IXOTH)) { | 54 (st.st_mode & S_IXOTH)) { |
| 55 cmd_line.PrependWrapper(ASCIIToWide(kSandboxBinary)); | 55 cmd_line.PrependWrapper(ASCIIToWide(kSandboxBinary)); |
| 56 |
| 57 // SUID binaries clear LD_LIBRARY_PATH. However, the sandbox binary needs |
| 58 // to run its child processes with the correct LD_LIBRARY_PATH so we save |
| 59 // a copy here: |
| 60 const char* ld_library_path = getenv("LD_LIBRARY_PATH"); |
| 61 if (ld_library_path) |
| 62 setenv("SANDBOX_LD_LIBRARY_PATH", ld_library_path, 1 /* overwrite */); |
| 56 } else { | 63 } else { |
| 57 LOG(FATAL) << "The SUID sandbox helper binary was found, but is not " | 64 LOG(FATAL) << "The SUID sandbox helper binary was found, but is not " |
| 58 "configured correctly. Rather than run without sandboxing " | 65 "configured correctly. Rather than run without sandboxing " |
| 59 "I'm aborting now. You need to make sure that " | 66 "I'm aborting now. You need to make sure that " |
| 60 << kSandboxBinary << " is mode 4755."; | 67 << kSandboxBinary << " is mode 4755."; |
| 61 } | 68 } |
| 62 } | 69 } |
| 63 | 70 |
| 64 // Start up the sandbox host process and get the file descriptor for the | 71 // Start up the sandbox host process and get the file descriptor for the |
| 65 // renderers to talk to it. | 72 // renderers to talk to it. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { | 151 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { |
| 145 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; | 152 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; |
| 146 return false; | 153 return false; |
| 147 } | 154 } |
| 148 | 155 |
| 149 if (child_exited) | 156 if (child_exited) |
| 150 *child_exited = tmp_child_exited; | 157 *child_exited = tmp_child_exited; |
| 151 | 158 |
| 152 return did_crash; | 159 return did_crash; |
| 153 } | 160 } |
| OLD | NEW |