diff options
author | Blurrech@gmail.com <Blurrech@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-07 20:51:18 +0000 |
---|---|---|
committer | Blurrech@gmail.com <Blurrech@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-07 20:51:18 +0000 |
commit | 260c993d2c75407033ba79687d5c4a710289a19b (patch) | |
tree | 6a804bf68baa0cf19692add0ee52ced98d64486d | |
parent | 6dca1609bc82697f6c2f87764ece0d43e44c7a7c (diff) | |
download | chromium_src-260c993d2c75407033ba79687d5c4a710289a19b.zip chromium_src-260c993d2c75407033ba79687d5c4a710289a19b.tar.gz chromium_src-260c993d2c75407033ba79687d5c4a710289a19b.tar.bz2 |
Removed a single legacy windows function from the sandbox code.
Specifically, Win2k code and mainly the function: IsXPSP2OrLater()
BUG=151624
Review URL: https://codereview.chromium.org/227163009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262197 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | sandbox/win/src/interception.cc | 3 | ||||
-rw-r--r-- | sandbox/win/src/process_mitigations.cc | 9 | ||||
-rw-r--r-- | sandbox/win/src/process_mitigations_test.cc | 3 | ||||
-rw-r--r-- | sandbox/win/src/sandbox_utils.cc | 8 | ||||
-rw-r--r-- | sandbox/win/src/sandbox_utils.h | 3 | ||||
-rw-r--r-- | sandbox/win/src/service_resolver.h | 23 | ||||
-rw-r--r-- | sandbox/win/src/service_resolver_32.cc | 20 | ||||
-rw-r--r-- | sandbox/win/src/service_resolver_64.cc | 5 | ||||
-rw-r--r-- | sandbox/win/src/service_resolver_unittest.cc | 4 |
10 files changed, 3 insertions, 76 deletions
@@ -242,6 +242,7 @@ Paul Kehrer <paul.l.kehrer@gmail.com> Paul Lind <paul.lind@imgtec.com> Paul Nettleship <pnettleship@gmail.com> Paul Robinson <paulrobinson85@googlemail.com> +Paul Roskell <blurrech@gmail.com> Paul Wicks <pwicks86@gmail.com> Pavan Kumar Emani <pavan.e@samsung.com> Pavel Ivanov <paivanof@gmail.com> diff --git a/sandbox/win/src/interception.cc b/sandbox/win/src/interception.cc index 597b937..5439db6 100644 --- a/sandbox/win/src/interception.cc +++ b/sandbox/win/src/interception.cc @@ -17,7 +17,6 @@ #include "sandbox/win/src/interception_internal.h" #include "sandbox/win/src/interceptors.h" #include "sandbox/win/src/sandbox.h" -#include "sandbox/win/src/sandbox_utils.h" #include "sandbox/win/src/service_resolver.h" #include "sandbox/win/src/target_interceptions.h" #include "sandbox/win/src/target_process.h" @@ -483,8 +482,6 @@ bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, thunk = new Wow64W8ResolverThunk(child_->Process(), relaxed_); else thunk = new Wow64ResolverThunk(child_->Process(), relaxed_); - } else if (!IsXPSP2OrLater()) { - thunk = new Win2kResolverThunk(child_->Process(), relaxed_); } else if (os_info->version() >= base::win::VERSION_WIN8) { thunk = new Win8ResolverThunk(child_->Process(), relaxed_); } else { diff --git a/sandbox/win/src/process_mitigations.cc b/sandbox/win/src/process_mitigations.cc index 9ec19cd..0775b2d 100644 --- a/sandbox/win/src/process_mitigations.cc +++ b/sandbox/win/src/process_mitigations.cc @@ -8,7 +8,6 @@ #include "base/win/windows_version.h" #include "sandbox/win/src/nt_internals.h" -#include "sandbox/win/src/sandbox_utils.h" #include "sandbox/win/src/win_utils.h" namespace { @@ -32,10 +31,6 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { if (!CanSetProcessMitigationsPostStartup(flags)) return false; - // We can't apply anything before Win XP, so just return cleanly. - if (!IsXPSP2OrLater()) - return true; - base::win::Version version = base::win::GetVersion(); HMODULE module = ::GetModuleHandleA("kernel32.dll"); @@ -250,10 +245,6 @@ void ConvertProcessMitigationsToPolicy(MitigationFlags flags, } MitigationFlags FilterPostStartupProcessMitigations(MitigationFlags flags) { - // Anything prior to XP SP2. - if (!IsXPSP2OrLater()) - return 0; - base::win::Version version = base::win::GetVersion(); // Windows XP SP2+. diff --git a/sandbox/win/src/process_mitigations_test.cc b/sandbox/win/src/process_mitigations_test.cc index f1274c5..e6f3fc2 100644 --- a/sandbox/win/src/process_mitigations_test.cc +++ b/sandbox/win/src/process_mitigations_test.cc @@ -10,7 +10,6 @@ #include "sandbox/win/src/process_mitigations.h" #include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox_factory.h" -#include "sandbox/win/src/sandbox_utils.h" #include "sandbox/win/src/target_services.h" #include "sandbox/win/src/win_utils.h" #include "sandbox/win/tests/common/controller.h" @@ -188,7 +187,7 @@ SBOX_TESTS_COMMAND int CheckDep(int argc, wchar_t **argv) { #if !defined(_WIN64) // DEP is always enabled on 64-bit. TEST(ProcessMitigationsTest, CheckDep) { - if (!IsXPSP2OrLater() || base::win::GetVersion() > base::win::VERSION_WIN7) + if (base::win::GetVersion() > base::win::VERSION_WIN7) return; TestRunner runner; diff --git a/sandbox/win/src/sandbox_utils.cc b/sandbox/win/src/sandbox_utils.cc index 8631a7c..a1b77d6 100644 --- a/sandbox/win/src/sandbox_utils.cc +++ b/sandbox/win/src/sandbox_utils.cc @@ -7,18 +7,10 @@ #include <windows.h> #include "base/logging.h" -#include "base/win/windows_version.h" #include "sandbox/win/src/internal_types.h" namespace sandbox { -bool IsXPSP2OrLater() { - base::win::Version version = base::win::GetVersion(); - return (version > base::win::VERSION_XP) || - ((version == base::win::VERSION_XP) && - (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); -} - void InitObjectAttribs(const base::string16& name, ULONG attributes, HANDLE root, diff --git a/sandbox/win/src/sandbox_utils.h b/sandbox/win/src/sandbox_utils.h index 3043597..2a17d63 100644 --- a/sandbox/win/src/sandbox_utils.h +++ b/sandbox/win/src/sandbox_utils.h @@ -14,9 +14,6 @@ namespace sandbox { -// Returns true if the current OS is Windows XP SP2 or later. -bool IsXPSP2OrLater(); - void InitObjectAttribs(const base::string16& name, ULONG attributes, HANDLE root, diff --git a/sandbox/win/src/service_resolver.h b/sandbox/win/src/service_resolver.h index 20486c9..76daee4 100644 --- a/sandbox/win/src/service_resolver.h +++ b/sandbox/win/src/service_resolver.h @@ -16,7 +16,7 @@ class ServiceResolverThunk : public ResolverThunk { public: // The service resolver needs a child process to write to. ServiceResolverThunk(HANDLE process, bool relaxed) - : process_(process), ntdll_base_(NULL), win2k_(false), + : process_(process), ntdll_base_(NULL), relaxed_(relaxed), relative_jump_(0) {} virtual ~ServiceResolverThunk() {} @@ -62,10 +62,6 @@ class ServiceResolverThunk : public ResolverThunk { // Handle of the child process. HANDLE process_; - protected: - // Keeps track of a Windows 2000 resolver. - bool win2k_; - private: // Returns true if the code pointer by target_ corresponds to the expected // type of function. Saves that code on the first part of the thunk pointed @@ -123,23 +119,6 @@ class Wow64W8ResolverThunk : public ServiceResolverThunk { }; // This is the concrete resolver used to perform service-call type functions -// inside ntdll.dll on Windows 2000 and XP pre SP2. -class Win2kResolverThunk : public ServiceResolverThunk { - public: - // The service resolver needs a child process to write to. - Win2kResolverThunk(HANDLE process, bool relaxed) - : ServiceResolverThunk(process, relaxed) { - win2k_ = true; - } - virtual ~Win2kResolverThunk() {} - - private: - virtual bool IsFunctionAService(void* local_thunk) const; - - DISALLOW_COPY_AND_ASSIGN(Win2kResolverThunk); -}; - -// This is the concrete resolver used to perform service-call type functions // inside ntdll.dll on Windows 8. class Win8ResolverThunk : public ServiceResolverThunk { public: diff --git a/sandbox/win/src/service_resolver_32.cc b/sandbox/win/src/service_resolver_32.cc index 9b8bbf9..be9de6b 100644 --- a/sandbox/win/src/service_resolver_32.cc +++ b/sandbox/win/src/service_resolver_32.cc @@ -400,26 +400,6 @@ bool Wow64W8ResolverThunk::IsFunctionAService(void* local_thunk) const { return true; } -bool Win2kResolverThunk::IsFunctionAService(void* local_thunk) const { - ServiceEntry function_code; - SIZE_T read; - if (!::ReadProcessMemory(process_, target_, &function_code, - sizeof(function_code), &read)) - return false; - - if (sizeof(function_code) != read) - return false; - - if (kMovEax != function_code.mov_eax || - function_code.service_id > kMaxService) - return false; - - // Save the verified code - memcpy(local_thunk, &function_code, sizeof(function_code)); - - return true; -} - bool Win8ResolverThunk::IsFunctionAService(void* local_thunk) const { ServiceEntryW8 function_code; SIZE_T read; diff --git a/sandbox/win/src/service_resolver_64.cc b/sandbox/win/src/service_resolver_64.cc index 79c6b16..03795f7 100644 --- a/sandbox/win/src/service_resolver_64.cc +++ b/sandbox/win/src/service_resolver_64.cc @@ -209,9 +209,4 @@ bool Wow64ResolverThunk::IsFunctionAService(void* local_thunk) const { return false; } -bool Win2kResolverThunk::IsFunctionAService(void* local_thunk) const { - NOTREACHED_NT(); - return false; -} - } // namespace sandbox diff --git a/sandbox/win/src/service_resolver_unittest.cc b/sandbox/win/src/service_resolver_unittest.cc index b01fedf..c7ac7ea 100644 --- a/sandbox/win/src/service_resolver_unittest.cc +++ b/sandbox/win/src/service_resolver_unittest.cc @@ -58,7 +58,6 @@ class ResolverThunkTest : public T { typedef ResolverThunkTest<sandbox::ServiceResolverThunk> WinXpResolverTest; #if !defined(_WIN64) -typedef ResolverThunkTest<sandbox::Win2kResolverThunk> Win2kResolverTest; typedef ResolverThunkTest<sandbox::Win8ResolverThunk> Win8ResolverTest; typedef ResolverThunkTest<sandbox::Wow64ResolverThunk> Wow64ResolverTest; typedef ResolverThunkTest<sandbox::Wow64W8ResolverThunk> Wow64W8ResolverTest; @@ -141,9 +140,6 @@ sandbox::ServiceResolverThunk* GetTestResolver(bool relaxed) { return new Wow64ResolverTest(relaxed); } - if (!sandbox::IsXPSP2OrLater()) - return new Win2kResolverTest(relaxed); - if (os_info->version() >= base::win::VERSION_WIN8) return new Win8ResolverTest(relaxed); |