summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 22:13:48 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 22:13:48 +0000
commit27f3bb97c84c906238ca0ec8422d143f1f765c19 (patch)
tree1606cfc08897bae1df83a1b92d7882171a4d8cc4
parent910ae1a57f263b664ea4266c5bc591a8e1372fd6 (diff)
downloadchromium_src-27f3bb97c84c906238ca0ec8422d143f1f765c19.zip
chromium_src-27f3bb97c84c906238ca0ec8422d143f1f765c19.tar.gz
chromium_src-27f3bb97c84c906238ca0ec8422d143f1f765c19.tar.bz2
Remove HandleCloser::SetupHandleInterceptions
This code isn't in use and will need to be rewritten if we want to use it in the future. NOTRY=true Review URL: https://codereview.chromium.org/320313002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276179 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--sandbox/win/src/handle_closer.cc21
-rw-r--r--sandbox/win/src/handle_closer.h3
-rw-r--r--sandbox/win/src/interceptors.h3
-rw-r--r--sandbox/win/src/interceptors_64.cc17
-rw-r--r--sandbox/win/src/interceptors_64.h9
-rw-r--r--sandbox/win/src/process_thread_interception.cc46
-rw-r--r--sandbox/win/src/process_thread_interception.h13
-rw-r--r--sandbox/win/src/sandbox_policy_base.cc3
8 files changed, 1 insertions, 114 deletions
diff --git a/sandbox/win/src/handle_closer.cc b/sandbox/win/src/handle_closer.cc
index d250ec3..30e8977 100644
--- a/sandbox/win/src/handle_closer.cc
+++ b/sandbox/win/src/handle_closer.cc
@@ -154,27 +154,6 @@ bool HandleCloser::SetupHandleList(void* buffer, size_t buffer_bytes) {
return output <= end;
}
-bool HandleCloser::SetupHandleInterceptions(InterceptionManager* manager) {
- // We need to intercept CreateThread if we're closing ALPC port clients.
- HandleMap::iterator names = handles_to_close_.find(L"ALPC Port");
- if (base::win::GetVersion() >= base::win::VERSION_VISTA &&
- names != handles_to_close_.end() &&
- (names->second.empty() || names->second.size() == 0)) {
- if (!INTERCEPT_EAT(manager, kKerneldllName, CreateThread,
- CREATE_THREAD_ID, 28)) {
- return false;
- }
- if (!INTERCEPT_EAT(manager, kKerneldllName, GetUserDefaultLCID,
- GET_USER_DEFAULT_LCID_ID, 4)) {
- return false;
- }
-
- return true;
- }
-
- return true;
-}
-
bool GetHandleName(HANDLE handle, base::string16* handle_name) {
static NtQueryObject QueryObject = NULL;
if (!QueryObject)
diff --git a/sandbox/win/src/handle_closer.h b/sandbox/win/src/handle_closer.h
index a5808d1..60473b3 100644
--- a/sandbox/win/src/handle_closer.h
+++ b/sandbox/win/src/handle_closer.h
@@ -53,9 +53,6 @@ class HandleCloser {
// Serializes and copies the closer table into the target process.
bool InitializeTargetHandles(TargetProcess* target);
- // Adds any interceptions that may be required due to closed system handles.
- bool SetupHandleInterceptions(InterceptionManager* manager);
-
private:
// Calculates the memory needed to copy the serialized handles list (rounded
// to the nearest machine-word size).
diff --git a/sandbox/win/src/interceptors.h b/sandbox/win/src/interceptors.h
index 43126d0..ae3ecc6 100644
--- a/sandbox/win/src/interceptors.h
+++ b/sandbox/win/src/interceptors.h
@@ -41,9 +41,6 @@ enum InterceptorId {
// Sync dispatcher:
CREATE_EVENT_ID,
OPEN_EVENT_ID,
- // CSRSS bypasses for HandleCloser:
- CREATE_THREAD_ID,
- GET_USER_DEFAULT_LCID_ID,
INTERCEPTOR_MAX_ID
};
diff --git a/sandbox/win/src/interceptors_64.cc b/sandbox/win/src/interceptors_64.cc
index c71d5a2..f279b16 100644
--- a/sandbox/win/src/interceptors_64.cc
+++ b/sandbox/win/src/interceptors_64.cc
@@ -68,23 +68,6 @@ NTSTATUS WINAPI TargetNtOpenThreadTokenEx64(
open_as_self, handle_attributes, token);
}
-HANDLE WINAPI TargetCreateThread64(
- LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size,
- LPTHREAD_START_ROUTINE start_address, PVOID parameter, DWORD creation_flags,
- LPDWORD thread_id) {
- CreateThreadFunction orig_fn = reinterpret_cast<
- CreateThreadFunction>(g_originals[CREATE_THREAD_ID]);
- return TargetCreateThread(orig_fn, thread_attributes, stack_size,
- start_address, parameter, creation_flags,
- thread_id);
-}
-
-LCID WINAPI TargetGetUserDefaultLCID64(void) {
- GetUserDefaultLCIDFunction orig_fn = reinterpret_cast<
- GetUserDefaultLCIDFunction>(g_originals[GET_USER_DEFAULT_LCID_ID]);
- return TargetGetUserDefaultLCID(orig_fn);
-}
-
// -----------------------------------------------------------------------
SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtCreateFile64(
diff --git a/sandbox/win/src/interceptors_64.h b/sandbox/win/src/interceptors_64.h
index ef2c10d..2ff31a8 100644
--- a/sandbox/win/src/interceptors_64.h
+++ b/sandbox/win/src/interceptors_64.h
@@ -44,15 +44,6 @@ SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThreadTokenEx64(
HANDLE thread, ACCESS_MASK desired_access, BOOLEAN open_as_self,
ULONG handle_attributes, PHANDLE token);
-// Interception of CreateThread on the child process.
-SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateThread64(
- LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size,
- LPTHREAD_START_ROUTINE start_address, PVOID parameter,
- DWORD creation_flags, LPDWORD thread_id);
-
-// Interception of GetUserDefaultLCID on the child process.
-SANDBOX_INTERCEPT LCID WINAPI TargetGetUserDefaultLCID64();
-
// -----------------------------------------------------------------------
// Interceptors handled by the file system dispatcher.
diff --git a/sandbox/win/src/process_thread_interception.cc b/sandbox/win/src/process_thread_interception.cc
index d351ee5..45926bc 100644
--- a/sandbox/win/src/process_thread_interception.cc
+++ b/sandbox/win/src/process_thread_interception.cc
@@ -400,50 +400,4 @@ BOOL WINAPI TargetCreateProcessA(CreateProcessAFunction orig_CreateProcessA,
return FALSE;
}
-// Creates a thread without registering with CSRSS. This is required if we
-// closed the CSRSS ALPC port after lockdown.
-HANDLE WINAPI TargetCreateThread(CreateThreadFunction orig_CreateThread,
- LPSECURITY_ATTRIBUTES thread_attributes,
- SIZE_T stack_size,
- LPTHREAD_START_ROUTINE start_address,
- PVOID parameter,
- DWORD creation_flags,
- LPDWORD thread_id) {
-// Try the normal CreateThread; switch to RtlCreateUserThread if needed.
- static bool use_create_thread = true;
- HANDLE thread;
- if (use_create_thread) {
- thread = orig_CreateThread(thread_attributes, stack_size, start_address,
- parameter, creation_flags, thread_id);
- if (thread)
- return thread;
- }
-
- PSECURITY_DESCRIPTOR sd =
- thread_attributes ? thread_attributes->lpSecurityDescriptor : NULL;
- CLIENT_ID client_id;
-
- NTSTATUS result = g_nt.RtlCreateUserThread(NtCurrentProcess, sd,
- creation_flags & CREATE_SUSPENDED,
- 0, stack_size, 0, start_address,
- parameter, &thread, &client_id);
- if (!NT_SUCCESS(result))
- return 0;
-
- // CSRSS is closed if we got here, so use RtlCreateUserThread from here on.
- use_create_thread = false;
- if (thread_id)
- *thread_id = HandleToUlong(client_id.UniqueThread);
- return thread;
-}
-
-// Cache the default LCID to avoid pinging CSRSS after lockdown.
-// TODO(jschuh): This approach will miss a default locale changes after
-// lockdown. In the future we may want to have the broker check instead.
-LCID WINAPI TargetGetUserDefaultLCID(
- GetUserDefaultLCIDFunction orig_GetUserDefaultLCID) {
- static LCID default_lcid = orig_GetUserDefaultLCID();
- return default_lcid;
-}
-
} // namespace sandbox
diff --git a/sandbox/win/src/process_thread_interception.h b/sandbox/win/src/process_thread_interception.h
index 7d2d533..31dc231 100644
--- a/sandbox/win/src/process_thread_interception.h
+++ b/sandbox/win/src/process_thread_interception.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -83,17 +83,6 @@ SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessA(
LPVOID environment, LPCSTR current_directory, LPSTARTUPINFOA startup_info,
LPPROCESS_INFORMATION process_information);
-// Interception of CreateThread in kernel32.dll.
-SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateThread(
- CreateThreadFunction orig_CreateThread,
- LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size,
- LPTHREAD_START_ROUTINE start_address, PVOID parameter,
- DWORD creation_flags, LPDWORD thread_id);
-
-// Interception of GetUserDefaultLCID in kernel32.dll.
-SANDBOX_INTERCEPT LCID WINAPI TargetGetUserDefaultLCID(
- GetUserDefaultLCIDFunction orig_GetUserDefaultLCID);
-
} // extern "C"
} // namespace sandbox
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc
index 41dc6be..ca946a4 100644
--- a/sandbox/win/src/sandbox_policy_base.cc
+++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -680,9 +680,6 @@ bool PolicyBase::SetupAllInterceptions(TargetProcess* target) {
}
}
- if (!handle_closer_.SetupHandleInterceptions(&manager))
- return false;
-
if (!SetupBasicInterceptions(&manager))
return false;