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

Side by Side Diff: sandbox/src/target_services.cc

Issue 7988006: Revert 100328 - Prevent the renderer from dying if launched under App-V/SoftGrid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "sandbox/src/target_services.h" 5 #include "sandbox/src/target_services.h"
6 6
7 #include <process.h> 7 #include <process.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "sandbox/src/crosscall_client.h" 10 #include "sandbox/src/crosscall_client.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 TargetServicesBase::TargetServicesBase() { 64 TargetServicesBase::TargetServicesBase() {
65 } 65 }
66 66
67 ResultCode TargetServicesBase::Init() { 67 ResultCode TargetServicesBase::Init() {
68 process_state_.SetInitCalled(); 68 process_state_.SetInitCalled();
69 return SBOX_ALL_OK; 69 return SBOX_ALL_OK;
70 } 70 }
71 71
72 // Failure here is a breach of security so the process is terminated. 72 // Failure here is a breach of security so the process is terminated.
73 void TargetServicesBase::LowerToken() { 73 void TargetServicesBase::LowerToken() {
74 DWORD error_code = SetProcessIntegrityLevel(g_shared_delayed_integrity_level); 74 if (ERROR_SUCCESS !=
75 // Here we don't terminate the process if the error is ERROR_INVALID_HANDLE, 75 SetProcessIntegrityLevel(g_shared_delayed_integrity_level))
76 // this is because this error is not possible in normal circumstances, unless
77 // it is hooked by sftldr_wow64.dll, in which case we prefer to keep running.
78 // See http://crbug.com/95888.
79 if (ERROR_SUCCESS != error_code && ERROR_INVALID_HANDLE != error_code)
80 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_INTEGRITY); 76 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_INTEGRITY);
81 process_state_.SetRevertedToSelf(); 77 process_state_.SetRevertedToSelf();
82 // If the client code as called RegOpenKey, advapi32.dll has cached some 78 // If the client code as called RegOpenKey, advapi32.dll has cached some
83 // handles. The following code gets rid of them. 79 // handles. The following code gets rid of them.
84 if (!::RevertToSelf()) 80 if (!::RevertToSelf())
85 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_DROPTOKEN); 81 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_DROPTOKEN);
86 if (!FlushCachedRegHandles()) 82 if (!FlushCachedRegHandles())
87 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_FLUSHANDLES); 83 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_FLUSHANDLES);
88 if (ERROR_SUCCESS != ::RegDisablePredefinedCache()) 84 if (ERROR_SUCCESS != ::RegDisablePredefinedCache())
89 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_CACHEDISABLE); 85 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_CACHEDISABLE);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (process_state_ < 2) 169 if (process_state_ < 2)
174 process_state_ = 2; 170 process_state_ = 2;
175 } 171 }
176 172
177 void ProcessState::SetRevertedToSelf() { 173 void ProcessState::SetRevertedToSelf() {
178 if (process_state_ < 3) 174 if (process_state_ < 3)
179 process_state_ = 3; 175 process_state_ = 3;
180 } 176 }
181 177
182 } // namespace sandbox 178 } // namespace sandbox
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