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

Side by Side Diff: sandbox/win/src/policy_target.cc

Issue 937353002: Adding method to create process using LowBox token in sandbox code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to TOT to see if ios_dbg_simulator_ninja errors go away. Created 5 years, 9 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
« no previous file with comments | « sandbox/win/src/nt_internals.h ('k') | sandbox/win/src/sandbox_policy.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/win/src/policy_target.h" 5 #include "sandbox/win/src/policy_target.h"
6 6
7 #include "sandbox/win/src/crosscall_client.h" 7 #include "sandbox/win/src/crosscall_client.h"
8 #include "sandbox/win/src/ipc_tags.h" 8 #include "sandbox/win/src/ipc_tags.h"
9 #include "sandbox/win/src/policy_engine_processor.h" 9 #include "sandbox/win/src/policy_engine_processor.h"
10 #include "sandbox/win/src/policy_low_level.h" 10 #include "sandbox/win/src/policy_low_level.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // called before the actual call to LowerToken. 72 // called before the actual call to LowerToken.
73 NTSTATUS WINAPI TargetNtSetInformationThread( 73 NTSTATUS WINAPI TargetNtSetInformationThread(
74 NtSetInformationThreadFunction orig_SetInformationThread, HANDLE thread, 74 NtSetInformationThreadFunction orig_SetInformationThread, HANDLE thread,
75 NT_THREAD_INFORMATION_CLASS thread_info_class, PVOID thread_information, 75 NT_THREAD_INFORMATION_CLASS thread_info_class, PVOID thread_information,
76 ULONG thread_information_bytes) { 76 ULONG thread_information_bytes) {
77 do { 77 do {
78 if (SandboxFactory::GetTargetServices()->GetState()->RevertedToSelf()) 78 if (SandboxFactory::GetTargetServices()->GetState()->RevertedToSelf())
79 break; 79 break;
80 if (ThreadImpersonationToken != thread_info_class) 80 if (ThreadImpersonationToken != thread_info_class)
81 break; 81 break;
82 if (!thread_information)
83 break;
84 HANDLE token;
85 if (sizeof(token) > thread_information_bytes)
86 break;
87
88 NTSTATUS ret = CopyData(&token, thread_information, sizeof(token));
89 if (!NT_SUCCESS(ret) || NULL != token)
90 break;
91
92 // This is a revert to self. 82 // This is a revert to self.
93 return STATUS_SUCCESS; 83 return STATUS_SUCCESS;
94 } while (false); 84 } while (false);
95 85
96 return orig_SetInformationThread(thread, thread_info_class, 86 return orig_SetInformationThread(thread, thread_info_class,
97 thread_information, 87 thread_information,
98 thread_information_bytes); 88 thread_information_bytes);
99 } 89 }
100 90
101 // Hooks NtOpenThreadToken to force the open_as_self parameter to be set to 91 // Hooks NtOpenThreadToken to force the open_as_self parameter to be set to
(...skipping 16 matching lines...) Expand all
118 ACCESS_MASK desired_access, BOOLEAN open_as_self, ULONG handle_attributes, 108 ACCESS_MASK desired_access, BOOLEAN open_as_self, ULONG handle_attributes,
119 PHANDLE token) { 109 PHANDLE token) {
120 if (!SandboxFactory::GetTargetServices()->GetState()->RevertedToSelf()) 110 if (!SandboxFactory::GetTargetServices()->GetState()->RevertedToSelf())
121 open_as_self = FALSE; 111 open_as_self = FALSE;
122 112
123 return orig_OpenThreadTokenEx(thread, desired_access, open_as_self, 113 return orig_OpenThreadTokenEx(thread, desired_access, open_as_self,
124 handle_attributes, token); 114 handle_attributes, token);
125 } 115 }
126 116
127 } // namespace sandbox 117 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/nt_internals.h ('k') | sandbox/win/src/sandbox_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698