Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/win/scoped_handle.h" | 6 #include "base/win/scoped_handle.h" |
| 7 | 7 |
| 8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
| 9 #include "sandbox/win/src/nt_internals.h" | 9 #include "sandbox/win/src/nt_internals.h" |
| 10 #include "sandbox/win/src/process_mitigations.h" | 10 #include "sandbox/win/src/process_mitigations.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 return SBOX_TEST_NOT_FOUND; | 158 return SBOX_TEST_NOT_FOUND; |
| 159 | 159 |
| 160 ULONG size = 0; | 160 ULONG size = 0; |
| 161 ULONG dep_flags = 0; | 161 ULONG dep_flags = 0; |
| 162 if (!SUCCEEDED(query_information_process(::GetCurrentProcess(), | 162 if (!SUCCEEDED(query_information_process(::GetCurrentProcess(), |
| 163 ProcessExecuteFlags, &dep_flags, | 163 ProcessExecuteFlags, &dep_flags, |
| 164 sizeof(dep_flags), &size))) { | 164 sizeof(dep_flags), &size))) { |
| 165 return SBOX_TEST_THIRD_ERROR; | 165 return SBOX_TEST_THIRD_ERROR; |
| 166 } | 166 } |
| 167 | 167 |
| 168 static const int MEM_EXECUTE_OPTION_ENABLE = 1; | 168 // static const int MEM_EXECUTE_OPTION_ENABLE = 1; |
|
Nico
2015/07/02 17:34:26
?
Matt Giuca
2015/07/03 03:46:29
Well I thought that since this seems to represent
Nico
2015/07/03 04:11:15
As-is, it looks like code that was left in acciden
Matt Giuca
2015/07/03 04:33:45
jschuh: Can I get your quick opinion on this. You
| |
| 169 static const int MEM_EXECUTE_OPTION_DISABLE = 2; | 169 static const int MEM_EXECUTE_OPTION_DISABLE = 2; |
| 170 static const int MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION = 4; | 170 // static const int MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION = 4; |
|
Nico
2015/07/02 17:34:26
?
jschuh
2015/07/06 22:16:18
Yeah, looks like dead constants. lgtm on removing
Matt Giuca
2015/07/07 04:52:17
Well they were dead the moment they were added, so
| |
| 171 static const int MEM_EXECUTE_OPTION_PERMANENT = 8; | 171 static const int MEM_EXECUTE_OPTION_PERMANENT = 8; |
| 172 dep_flags &= 0xff; | 172 dep_flags &= 0xff; |
| 173 | 173 |
| 174 if (dep_flags != (MEM_EXECUTE_OPTION_DISABLE | | 174 if (dep_flags != (MEM_EXECUTE_OPTION_DISABLE | |
| 175 MEM_EXECUTE_OPTION_PERMANENT)) { | 175 MEM_EXECUTE_OPTION_PERMANENT)) { |
| 176 return SBOX_TEST_FOURTH_ERROR; | 176 return SBOX_TEST_FOURTH_ERROR; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 return SBOX_TEST_SUCCEEDED; | 180 return SBOX_TEST_SUCCEEDED; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), | 239 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), |
| 240 SBOX_ALL_OK); | 240 SBOX_ALL_OK); |
| 241 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, | 241 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, |
| 242 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), | 242 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), |
| 243 sandbox::SBOX_ALL_OK); | 243 sandbox::SBOX_ALL_OK); |
| 244 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); | 244 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace sandbox | 247 } // namespace sandbox |
| 248 | 248 |
| OLD | NEW |