| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. |  | 
| 2 # Use of this source code is governed by a BSD-style license that can be |  | 
| 3 # found in the LICENSE file. |  | 
| 4 |  | 
| 5 import("//testing/test.gni") |  | 
| 6 |  | 
| 7 # This needs to be a static library rather than a sources set because small |  | 
| 8 # portions of this are used in some contexts (like chrome_elf), and it |  | 
| 9 # doesnn't seem to dead-code strip very well. This saves 12K on chrome_elf.dll, |  | 
| 10 # over a source set, for example. |  | 
| 11 static_library("sandbox") { |  | 
| 12   sources = [ |  | 
| 13     "src/acl.cc", |  | 
| 14     "src/acl.h", |  | 
| 15     "src/app_container.cc", |  | 
| 16     "src/app_container.h", |  | 
| 17     "src/broker_services.cc", |  | 
| 18     "src/broker_services.h", |  | 
| 19     "src/crosscall_client.h", |  | 
| 20     "src/crosscall_params.h", |  | 
| 21     "src/crosscall_server.cc", |  | 
| 22     "src/crosscall_server.h", |  | 
| 23     "src/eat_resolver.cc", |  | 
| 24     "src/eat_resolver.h", |  | 
| 25     "src/filesystem_dispatcher.cc", |  | 
| 26     "src/filesystem_dispatcher.h", |  | 
| 27     "src/filesystem_interception.cc", |  | 
| 28     "src/filesystem_interception.h", |  | 
| 29     "src/filesystem_policy.cc", |  | 
| 30     "src/filesystem_policy.h", |  | 
| 31     "src/handle_closer.cc", |  | 
| 32     "src/handle_closer.h", |  | 
| 33     "src/handle_closer_agent.cc", |  | 
| 34     "src/handle_closer_agent.h", |  | 
| 35     "src/handle_dispatcher.cc", |  | 
| 36     "src/handle_dispatcher.h", |  | 
| 37     "src/handle_interception.cc", |  | 
| 38     "src/handle_interception.h", |  | 
| 39     "src/handle_policy.cc", |  | 
| 40     "src/handle_policy.h", |  | 
| 41     "src/interception.cc", |  | 
| 42     "src/interception.h", |  | 
| 43     "src/interception_agent.cc", |  | 
| 44     "src/interception_agent.h", |  | 
| 45     "src/interception_internal.h", |  | 
| 46     "src/interceptors.h", |  | 
| 47     "src/internal_types.h", |  | 
| 48     "src/ipc_tags.h", |  | 
| 49     "src/job.cc", |  | 
| 50     "src/job.h", |  | 
| 51     "src/named_pipe_dispatcher.cc", |  | 
| 52     "src/named_pipe_dispatcher.h", |  | 
| 53     "src/named_pipe_interception.cc", |  | 
| 54     "src/named_pipe_interception.h", |  | 
| 55     "src/named_pipe_policy.cc", |  | 
| 56     "src/named_pipe_policy.h", |  | 
| 57     "src/nt_internals.h", |  | 
| 58     "src/policy_broker.cc", |  | 
| 59     "src/policy_broker.h", |  | 
| 60     "src/policy_engine_opcodes.cc", |  | 
| 61     "src/policy_engine_opcodes.h", |  | 
| 62     "src/policy_engine_params.h", |  | 
| 63     "src/policy_engine_processor.cc", |  | 
| 64     "src/policy_engine_processor.h", |  | 
| 65     "src/policy_low_level.cc", |  | 
| 66     "src/policy_low_level.h", |  | 
| 67     "src/policy_params.h", |  | 
| 68     "src/policy_target.cc", |  | 
| 69     "src/policy_target.h", |  | 
| 70     "src/process_mitigations.cc", |  | 
| 71     "src/process_mitigations.h", |  | 
| 72     "src/process_mitigations_win32k_dispatcher.cc", |  | 
| 73     "src/process_mitigations_win32k_dispatcher.h", |  | 
| 74     "src/process_mitigations_win32k_interception.cc", |  | 
| 75     "src/process_mitigations_win32k_interception.h", |  | 
| 76     "src/process_mitigations_win32k_policy.cc", |  | 
| 77     "src/process_mitigations_win32k_policy.h", |  | 
| 78     "src/process_thread_dispatcher.cc", |  | 
| 79     "src/process_thread_dispatcher.h", |  | 
| 80     "src/process_thread_interception.cc", |  | 
| 81     "src/process_thread_interception.h", |  | 
| 82     "src/process_thread_policy.cc", |  | 
| 83     "src/process_thread_policy.h", |  | 
| 84     "src/registry_dispatcher.cc", |  | 
| 85     "src/registry_dispatcher.h", |  | 
| 86     "src/registry_interception.cc", |  | 
| 87     "src/registry_interception.h", |  | 
| 88     "src/registry_policy.cc", |  | 
| 89     "src/registry_policy.h", |  | 
| 90     "src/resolver.cc", |  | 
| 91     "src/resolver.h", |  | 
| 92     "src/restricted_token.cc", |  | 
| 93     "src/restricted_token.h", |  | 
| 94     "src/restricted_token_utils.cc", |  | 
| 95     "src/restricted_token_utils.h", |  | 
| 96     "src/sandbox.cc", |  | 
| 97     "src/sandbox.h", |  | 
| 98     "src/sandbox_factory.h", |  | 
| 99     "src/sandbox_globals.cc", |  | 
| 100     "src/sandbox_nt_types.h", |  | 
| 101     "src/sandbox_nt_util.cc", |  | 
| 102     "src/sandbox_nt_util.h", |  | 
| 103     "src/sandbox_policy.h", |  | 
| 104     "src/sandbox_policy_base.cc", |  | 
| 105     "src/sandbox_policy_base.h", |  | 
| 106     "src/sandbox_rand.cc", |  | 
| 107     "src/sandbox_rand.h", |  | 
| 108     "src/sandbox_types.h", |  | 
| 109     "src/sandbox_utils.cc", |  | 
| 110     "src/sandbox_utils.h", |  | 
| 111     "src/security_level.h", |  | 
| 112     "src/service_resolver.cc", |  | 
| 113     "src/service_resolver.h", |  | 
| 114     "src/sharedmem_ipc_client.cc", |  | 
| 115     "src/sharedmem_ipc_client.h", |  | 
| 116     "src/sharedmem_ipc_server.cc", |  | 
| 117     "src/sharedmem_ipc_server.h", |  | 
| 118     "src/sid.cc", |  | 
| 119     "src/sid.h", |  | 
| 120     "src/sync_dispatcher.cc", |  | 
| 121     "src/sync_dispatcher.h", |  | 
| 122     "src/sync_interception.cc", |  | 
| 123     "src/sync_interception.h", |  | 
| 124     "src/sync_policy.cc", |  | 
| 125     "src/sync_policy.h", |  | 
| 126     "src/target_interceptions.cc", |  | 
| 127     "src/target_interceptions.h", |  | 
| 128     "src/target_process.cc", |  | 
| 129     "src/target_process.h", |  | 
| 130     "src/target_services.cc", |  | 
| 131     "src/target_services.h", |  | 
| 132     "src/top_level_dispatcher.cc", |  | 
| 133     "src/top_level_dispatcher.h", |  | 
| 134     "src/win2k_threadpool.cc", |  | 
| 135     "src/win2k_threadpool.h", |  | 
| 136     "src/win_utils.cc", |  | 
| 137     "src/win_utils.h", |  | 
| 138     "src/window.cc", |  | 
| 139     "src/window.h", |  | 
| 140   ] |  | 
| 141 |  | 
| 142   if (current_cpu == "x64") { |  | 
| 143     sources += [ |  | 
| 144       "src/interceptors_64.cc", |  | 
| 145       "src/interceptors_64.h", |  | 
| 146       "src/resolver_64.cc", |  | 
| 147       "src/service_resolver_64.cc", |  | 
| 148     ] |  | 
| 149   } else if (current_cpu == "x86") { |  | 
| 150     sources += [ |  | 
| 151       "src/resolver_32.cc", |  | 
| 152       "src/service_resolver_32.cc", |  | 
| 153       "src/sidestep/ia32_modrm_map.cpp", |  | 
| 154       "src/sidestep/ia32_opcode_map.cpp", |  | 
| 155       "src/sidestep/mini_disassembler.cpp", |  | 
| 156       "src/sidestep/mini_disassembler.h", |  | 
| 157       "src/sidestep/mini_disassembler_types.h", |  | 
| 158       "src/sidestep/preamble_patcher.h", |  | 
| 159       "src/sidestep/preamble_patcher_with_stub.cpp", |  | 
| 160       "src/sidestep_resolver.cc", |  | 
| 161       "src/sidestep_resolver.h", |  | 
| 162     ] |  | 
| 163   } |  | 
| 164 |  | 
| 165   configs += [ "//build/config:precompiled_headers" ] |  | 
| 166 |  | 
| 167   deps = [ |  | 
| 168     "//base", |  | 
| 169     "//base:base_static", |  | 
| 170   ] |  | 
| 171   if (current_cpu == "x86") { |  | 
| 172     deps += [ ":copy_wow_helper" ] |  | 
| 173   } |  | 
| 174 } |  | 
| 175 |  | 
| 176 if (current_cpu == "x86") { |  | 
| 177   # Make a target that copies the wow_helper files to the out dir. |  | 
| 178   # |  | 
| 179   # TODO(brettw) we can probably just build this now that we have proper |  | 
| 180   # toolchain support. |  | 
| 181   copy("copy_wow_helper") { |  | 
| 182     sources = [ |  | 
| 183       "wow_helper/wow_helper.exe", |  | 
| 184       "wow_helper/wow_helper.pdb", |  | 
| 185     ] |  | 
| 186     outputs = [ |  | 
| 187       "$root_out_dir/{{source_file_part}}", |  | 
| 188     ] |  | 
| 189   } |  | 
| 190 } |  | 
| 191 |  | 
| 192 test("sbox_integration_tests") { |  | 
| 193   sources = [ |  | 
| 194     "src/address_sanitizer_test.cc", |  | 
| 195     "src/app_container_test.cc", |  | 
| 196     "src/file_policy_test.cc", |  | 
| 197     "src/handle_closer_test.cc", |  | 
| 198     "src/handle_inheritance_test.cc", |  | 
| 199     "src/handle_policy_test.cc", |  | 
| 200     "src/integrity_level_test.cc", |  | 
| 201     "src/ipc_ping_test.cc", |  | 
| 202     "src/lpc_policy_test.cc", |  | 
| 203     "src/named_pipe_policy_test.cc", |  | 
| 204     "src/policy_target_test.cc", |  | 
| 205     "src/process_mitigations_test.cc", |  | 
| 206     "src/process_policy_test.cc", |  | 
| 207     "src/registry_policy_test.cc", |  | 
| 208     "src/restricted_token_test.cc", |  | 
| 209     "src/sync_policy_test.cc", |  | 
| 210     "src/sync_policy_test.h", |  | 
| 211     "src/unload_dll_test.cc", |  | 
| 212     "tests/common/controller.cc", |  | 
| 213     "tests/common/controller.h", |  | 
| 214     "tests/common/test_utils.cc", |  | 
| 215     "tests/common/test_utils.h", |  | 
| 216     "tests/integration_tests/integration_tests.cc", |  | 
| 217     "tests/integration_tests/integration_tests_test.cc", |  | 
| 218   ] |  | 
| 219 |  | 
| 220   deps = [ |  | 
| 221     ":sandbox", |  | 
| 222     "//base/test:test_support", |  | 
| 223     "//testing/gtest", |  | 
| 224   ] |  | 
| 225 } |  | 
| 226 |  | 
| 227 test("sbox_validation_tests") { |  | 
| 228   sources = [ |  | 
| 229     "tests/common/controller.cc", |  | 
| 230     "tests/common/controller.h", |  | 
| 231     "tests/validation_tests/commands.cc", |  | 
| 232     "tests/validation_tests/commands.h", |  | 
| 233     "tests/validation_tests/suite.cc", |  | 
| 234     "tests/validation_tests/unit_tests.cc", |  | 
| 235   ] |  | 
| 236 |  | 
| 237   deps = [ |  | 
| 238     ":sandbox", |  | 
| 239     "//base/test:test_support", |  | 
| 240     "//testing/gtest", |  | 
| 241   ] |  | 
| 242 } |  | 
| 243 |  | 
| 244 test("sbox_unittests") { |  | 
| 245   sources = [ |  | 
| 246     "src/app_container_unittest.cc", |  | 
| 247     "src/interception_unittest.cc", |  | 
| 248     "src/ipc_unittest.cc", |  | 
| 249     "src/job_unittest.cc", |  | 
| 250     "src/policy_engine_unittest.cc", |  | 
| 251     "src/policy_low_level_unittest.cc", |  | 
| 252     "src/policy_opcodes_unittest.cc", |  | 
| 253     "src/restricted_token_unittest.cc", |  | 
| 254     "src/sandbox_nt_util_unittest.cc", |  | 
| 255     "src/service_resolver_unittest.cc", |  | 
| 256     "src/sid_unittest.cc", |  | 
| 257     "src/threadpool_unittest.cc", |  | 
| 258     "src/win_utils_unittest.cc", |  | 
| 259     "tests/common/test_utils.cc", |  | 
| 260     "tests/common/test_utils.h", |  | 
| 261     "tests/unit_tests/unit_tests.cc", |  | 
| 262   ] |  | 
| 263 |  | 
| 264   deps = [ |  | 
| 265     ":sandbox", |  | 
| 266     "//base/test:test_support", |  | 
| 267     "//testing/gtest", |  | 
| 268   ] |  | 
| 269 } |  | 
| 270 |  | 
| 271 test("sandbox_poc") { |  | 
| 272   sources = [ |  | 
| 273     "sandbox_poc/main_ui_window.cc", |  | 
| 274     "sandbox_poc/main_ui_window.h", |  | 
| 275     "sandbox_poc/resource.h", |  | 
| 276     "sandbox_poc/sandbox.cc", |  | 
| 277     "sandbox_poc/sandbox.h", |  | 
| 278     "sandbox_poc/sandbox.ico", |  | 
| 279     "sandbox_poc/sandbox.rc", |  | 
| 280   ] |  | 
| 281 |  | 
| 282   configs -= [ "//build/config/win:console" ] |  | 
| 283   configs += [ "//build/config/win:windowed" ] |  | 
| 284 |  | 
| 285   libs = [ "comctl32.lib" ] |  | 
| 286 |  | 
| 287   deps = [ |  | 
| 288     ":pocdll", |  | 
| 289     ":sandbox", |  | 
| 290   ] |  | 
| 291 } |  | 
| 292 |  | 
| 293 shared_library("pocdll") { |  | 
| 294   sources = [ |  | 
| 295     "sandbox_poc/pocdll/exports.h", |  | 
| 296     "sandbox_poc/pocdll/fs.cc", |  | 
| 297     "sandbox_poc/pocdll/handles.cc", |  | 
| 298     "sandbox_poc/pocdll/invasive.cc", |  | 
| 299     "sandbox_poc/pocdll/network.cc", |  | 
| 300     "sandbox_poc/pocdll/pocdll.cc", |  | 
| 301     "sandbox_poc/pocdll/processes_and_threads.cc", |  | 
| 302     "sandbox_poc/pocdll/registry.cc", |  | 
| 303     "sandbox_poc/pocdll/spyware.cc", |  | 
| 304     "sandbox_poc/pocdll/utils.h", |  | 
| 305   ] |  | 
| 306 |  | 
| 307   defines = [ "POCDLL_EXPORTS" ] |  | 
| 308 |  | 
| 309   deps = [ |  | 
| 310     "//build/config/sanitizers:deps", |  | 
| 311   ] |  | 
| 312 } |  | 
| OLD | NEW | 
|---|