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

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

Issue 1225183003: CreateThread interception, to use CreateRemoteThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix up casts Created 4 years, 10 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/policy_broker.h ('k') | sandbox/win/src/process_policy_test.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "sandbox/win/src/policy_broker.h" 9 #include "sandbox/win/src/policy_broker.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Verify that the structure is fully initialized. 89 // Verify that the structure is fully initialized.
90 for (size_t i = 0; i < sizeof(g_nt)/sizeof(void*); i++) 90 for (size_t i = 0; i < sizeof(g_nt)/sizeof(void*); i++)
91 DCHECK(reinterpret_cast<char**>(&g_nt)[i]); 91 DCHECK(reinterpret_cast<char**>(&g_nt)[i]);
92 #endif 92 #endif
93 return (SBOX_ALL_OK == child->TransferVariable("g_nt", &g_nt, sizeof(g_nt))); 93 return (SBOX_ALL_OK == child->TransferVariable("g_nt", &g_nt, sizeof(g_nt)));
94 } 94 }
95 95
96 #undef INIT_GLOBAL_NT 96 #undef INIT_GLOBAL_NT
97 #undef INIT_GLOBAL_RTL 97 #undef INIT_GLOBAL_RTL
98 98
99 bool SetupBasicInterceptions(InterceptionManager* manager) { 99 bool SetupBasicInterceptions(InterceptionManager* manager,
100 bool is_csrss_connected) {
100 // Interceptions provided by process_thread_policy, without actual policy. 101 // Interceptions provided by process_thread_policy, without actual policy.
101 if (!INTERCEPT_NT(manager, NtOpenThread, OPEN_THREAD_ID, 20) || 102 if (!INTERCEPT_NT(manager, NtOpenThread, OPEN_THREAD_ID, 20) ||
102 !INTERCEPT_NT(manager, NtOpenProcess, OPEN_PROCESS_ID, 20) || 103 !INTERCEPT_NT(manager, NtOpenProcess, OPEN_PROCESS_ID, 20) ||
103 !INTERCEPT_NT(manager, NtOpenProcessToken, OPEN_PROCESS_TOKEN_ID, 16)) 104 !INTERCEPT_NT(manager, NtOpenProcessToken, OPEN_PROCESS_TOKEN_ID, 16))
104 return false; 105 return false;
105 106
106 // Interceptions with neither policy nor IPC. 107 // Interceptions with neither policy nor IPC.
107 if (!INTERCEPT_NT(manager, NtSetInformationThread, SET_INFORMATION_THREAD_ID, 108 if (!INTERCEPT_NT(manager, NtSetInformationThread, SET_INFORMATION_THREAD_ID,
108 20) || 109 20) ||
109 !INTERCEPT_NT(manager, NtOpenThreadToken, OPEN_THREAD_TOKEN_ID, 20)) 110 !INTERCEPT_NT(manager, NtOpenThreadToken, OPEN_THREAD_TOKEN_ID, 20))
110 return false; 111 return false;
111 112
112 if (base::win::GetVersion() >= base::win::VERSION_XP) { 113 if (base::win::GetVersion() >= base::win::VERSION_XP) {
113 // Bug 27218: We don't have dispatch for some x64 syscalls. 114 // Bug 27218: We don't have dispatch for some x64 syscalls.
114 // This one is also provided by process_thread_policy. 115 // This one is also provided by process_thread_policy.
115 if (!INTERCEPT_NT(manager, NtOpenProcessTokenEx, OPEN_PROCESS_TOKEN_EX_ID, 116 if (!INTERCEPT_NT(manager, NtOpenProcessTokenEx, OPEN_PROCESS_TOKEN_EX_ID,
116 20)) 117 20))
117 return false; 118 return false;
118 119
119 return INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID, 120 if (!INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID,
120 24); 121 24))
122 return false;
123 }
124
125 if (!is_csrss_connected) {
126 if (!INTERCEPT_EAT(manager, kKerneldllName, CreateThread, CREATE_THREAD_ID,
127 28))
128 return false;
121 } 129 }
122 130
123 return true; 131 return true;
124 } 132 }
125 133
126 } // namespace sandbox 134 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_broker.h ('k') | sandbox/win/src/process_policy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698