| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/sandbox_policy.h" | 5 #include "chrome/common/sandbox_policy.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "app/win_util.h" | 9 #include "app/win_util.h" | 
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" | 
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 166 } | 166 } | 
| 167 | 167 | 
| 168 // Adds policy rules for unloaded the known dlls that cause chrome to crash. | 168 // Adds policy rules for unloaded the known dlls that cause chrome to crash. | 
| 169 // Eviction of injected DLLs is done by the sandbox so that the injected module | 169 // Eviction of injected DLLs is done by the sandbox so that the injected module | 
| 170 // does not get a chance to execute any code. | 170 // does not get a chance to execute any code. | 
| 171 void AddDllEvictionPolicy(sandbox::TargetPolicy* policy) { | 171 void AddDllEvictionPolicy(sandbox::TargetPolicy* policy) { | 
| 172   for (int ix = 0; ix != arraysize(kTroublesomeDlls); ++ix) { | 172   for (int ix = 0; ix != arraysize(kTroublesomeDlls); ++ix) { | 
| 173     // To minimize the list we only add an unload policy if the dll is also | 173     // To minimize the list we only add an unload policy if the dll is also | 
| 174     // loaded in this process. All the injected dlls of interest do this. | 174     // loaded in this process. All the injected dlls of interest do this. | 
| 175     if (::GetModuleHandleW(kTroublesomeDlls[ix])) { | 175     if (::GetModuleHandleW(kTroublesomeDlls[ix])) { | 
| 176       LOG(INFO) << "dll to unload found: " << kTroublesomeDlls[ix]; | 176       VLOG(1) << "dll to unload found: " << kTroublesomeDlls[ix]; | 
| 177       policy->AddDllToUnload(kTroublesomeDlls[ix]); | 177       policy->AddDllToUnload(kTroublesomeDlls[ix]); | 
| 178     } | 178     } | 
| 179   } | 179   } | 
| 180 } | 180 } | 
| 181 | 181 | 
| 182 // Adds the generic policy rules to a sandbox TargetPolicy. | 182 // Adds the generic policy rules to a sandbox TargetPolicy. | 
| 183 bool AddGenericPolicy(sandbox::TargetPolicy* policy) { | 183 bool AddGenericPolicy(sandbox::TargetPolicy* policy) { | 
| 184   sandbox::ResultCode result; | 184   sandbox::ResultCode result; | 
| 185 | 185 | 
| 186   // Add the policy for the pipes | 186   // Add the policy for the pipes | 
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 578 | 578 | 
| 579   // Help the process a little. It can't start the debugger by itself if | 579   // Help the process a little. It can't start the debugger by itself if | 
| 580   // the process is in a sandbox. | 580   // the process is in a sandbox. | 
| 581   if (child_needs_help) | 581   if (child_needs_help) | 
| 582     DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId); | 582     DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId); | 
| 583 | 583 | 
| 584   return process; | 584   return process; | 
| 585 } | 585 } | 
| 586 | 586 | 
| 587 }  // namespace sandbox | 587 }  // namespace sandbox | 
| OLD | NEW | 
|---|