• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3# found in the LICENSE file.
4
5{
6  'target_defaults': {
7    'variables': {
8      'sandbox_windows_target': 0,
9      'target_arch%': 'ia32',
10    },
11    'target_conditions': [
12      ['sandbox_windows_target==1', {
13        # Files that are shared between the 32-bit and the 64-bit versions
14        # of the Windows sandbox library.
15        'sources': [
16            'src/acl.cc',
17            'src/acl.h',
18            'src/broker_services.cc',
19            'src/broker_services.h',
20            'src/crosscall_client.h',
21            'src/crosscall_params.h',
22            'src/crosscall_server.cc',
23            'src/crosscall_server.h',
24            'src/eat_resolver.cc',
25            'src/eat_resolver.h',
26            'src/filesystem_dispatcher.cc',
27            'src/filesystem_dispatcher.h',
28            'src/filesystem_interception.cc',
29            'src/filesystem_interception.h',
30            'src/filesystem_policy.cc',
31            'src/filesystem_policy.h',
32            'src/handle_closer.cc',
33            'src/handle_closer.h',
34            'src/handle_closer_agent.cc',
35            'src/handle_closer_agent.h',
36            'src/interception.cc',
37            'src/interception.h',
38            'src/interception_agent.cc',
39            'src/interception_agent.h',
40            'src/interception_internal.h',
41            'src/interceptors.h',
42            'src/internal_types.h',
43            'src/ipc_tags.h',
44            'src/job.cc',
45            'src/job.h',
46            'src/named_pipe_dispatcher.cc',
47            'src/named_pipe_dispatcher.h',
48            'src/named_pipe_interception.cc',
49            'src/named_pipe_interception.h',
50            'src/named_pipe_policy.cc',
51            'src/named_pipe_policy.h',
52            'src/nt_internals.h',
53            'src/policy_broker.cc',
54            'src/policy_broker.h',
55            'src/policy_engine_opcodes.cc',
56            'src/policy_engine_opcodes.h',
57            'src/policy_engine_params.h',
58            'src/policy_engine_processor.cc',
59            'src/policy_engine_processor.h',
60            'src/policy_low_level.cc',
61            'src/policy_low_level.h',
62            'src/policy_params.h',
63            'src/policy_target.cc',
64            'src/policy_target.h',
65            'src/process_mitigations.cc',
66            'src/process_mitigations.h',
67            'src/process_mitigations_win32k_dispatcher.cc',
68            'src/process_mitigations_win32k_dispatcher.h',
69            'src/process_mitigations_win32k_interception.cc',
70            'src/process_mitigations_win32k_interception.h',
71            'src/process_mitigations_win32k_policy.cc',
72            'src/process_mitigations_win32k_policy.h',
73            'src/process_thread_dispatcher.cc',
74            'src/process_thread_dispatcher.h',
75            'src/process_thread_interception.cc',
76            'src/process_thread_interception.h',
77            'src/process_thread_policy.cc',
78            'src/process_thread_policy.h',
79            'src/registry_dispatcher.cc',
80            'src/registry_dispatcher.h',
81            'src/registry_interception.cc',
82            'src/registry_interception.h',
83            'src/registry_policy.cc',
84            'src/registry_policy.h',
85            'src/resolver.cc',
86            'src/resolver.h',
87            'src/restricted_token_utils.cc',
88            'src/restricted_token_utils.h',
89            'src/restricted_token.cc',
90            'src/restricted_token.h',
91            'src/sandbox_factory.h',
92            'src/sandbox_globals.cc',
93            'src/sandbox_nt_types.h',
94            'src/sandbox_nt_util.cc',
95            'src/sandbox_nt_util.h',
96            'src/sandbox_policy_base.cc',
97            'src/sandbox_policy_base.h',
98            'src/sandbox_policy.h',
99            'src/sandbox_rand.cc',
100            'src/sandbox_rand.h',
101            'src/sandbox_types.h',
102            'src/sandbox_utils.cc',
103            'src/sandbox_utils.h',
104            'src/sandbox.cc',
105            'src/sandbox.h',
106            'src/security_level.h',
107            'src/service_resolver.cc',
108            'src/service_resolver.h',
109            'src/sharedmem_ipc_client.cc',
110            'src/sharedmem_ipc_client.h',
111            'src/sharedmem_ipc_server.cc',
112            'src/sharedmem_ipc_server.h',
113            'src/sid.cc',
114            'src/sid.h',
115            'src/sync_dispatcher.cc',
116            'src/sync_dispatcher.h',
117            'src/sync_interception.cc',
118            'src/sync_interception.h',
119            'src/sync_policy.cc',
120            'src/sync_policy.h',
121            'src/target_interceptions.cc',
122            'src/target_interceptions.h',
123            'src/target_process.cc',
124            'src/target_process.h',
125            'src/target_services.cc',
126            'src/target_services.h',
127            'src/top_level_dispatcher.cc',
128            'src/top_level_dispatcher.h',
129            'src/win_utils.cc',
130            'src/win_utils.h',
131            'src/win2k_threadpool.cc',
132            'src/win2k_threadpool.h',
133            'src/window.cc',
134            'src/window.h',
135        ],
136        'target_conditions': [
137          ['target_arch=="x64"', {
138            'sources': [
139              'src/interceptors_64.cc',
140              'src/interceptors_64.h',
141              'src/resolver_64.cc',
142              'src/service_resolver_64.cc',
143            ],
144          }],
145          ['target_arch=="ia32"', {
146            'sources': [
147              'src/resolver_32.cc',
148              'src/service_resolver_32.cc',
149              'src/sidestep_resolver.cc',
150              'src/sidestep_resolver.h',
151              'src/sidestep\ia32_modrm_map.cpp',
152              'src/sidestep\ia32_opcode_map.cpp',
153              'src/sidestep\mini_disassembler_types.h',
154              'src/sidestep\mini_disassembler.cpp',
155              'src/sidestep\mini_disassembler.h',
156              'src/sidestep\preamble_patcher_with_stub.cpp',
157              'src/sidestep\preamble_patcher.h',
158            ],
159          }],
160        ],
161      }],
162    ],
163  },
164  'targets': [
165    {
166      'target_name': 'sandbox',
167      'type': 'static_library',
168      'variables': {
169        'sandbox_windows_target': 1,
170      },
171      'dependencies': [
172        '../base/base.gyp:base',
173        '../base/base.gyp:base_static',
174      ],
175      'export_dependent_settings': [
176        '../base/base.gyp:base',
177      ],
178      'include_dirs': [
179        '../..',
180      ],
181      'target_conditions': [
182        ['target_arch=="ia32"', {
183          'copies': [
184            {
185              'destination': '<(PRODUCT_DIR)',
186              'files': [
187                'wow_helper/wow_helper.exe',
188                'wow_helper/wow_helper.pdb',
189              ],
190            },
191          ],
192        }],
193      ],
194    },
195    {
196      'target_name': 'sbox_integration_tests',
197      'type': 'executable',
198      'dependencies': [
199        'sandbox',
200        'sbox_integration_test_hook_dll',
201        'sbox_integration_test_win_proc',
202        '../base/base.gyp:test_support_base',
203        '../testing/gtest.gyp:gtest',
204      ],
205      'sources': [
206        'src/address_sanitizer_test.cc',
207        'src/app_container_test.cc',
208        'src/file_policy_test.cc',
209        'src/handle_inheritance_test.cc',
210        'tests/integration_tests/integration_tests_test.cc',
211        'src/handle_closer_test.cc',
212        'src/integrity_level_test.cc',
213        'src/ipc_ping_test.cc',
214        'src/lpc_policy_test.cc',
215        'src/named_pipe_policy_test.cc',
216        'src/policy_target_test.cc',
217        'src/process_mitigations_test.cc',
218        'src/process_policy_test.cc',
219        'src/registry_policy_test.cc',
220        'src/restricted_token_test.cc',
221        'src/sync_policy_test.cc',
222        'src/sync_policy_test.h',
223        'src/unload_dll_test.cc',
224        'tests/common/controller.cc',
225        'tests/common/controller.h',
226        'tests/common/test_utils.cc',
227        'tests/common/test_utils.h',
228        'tests/integration_tests/integration_tests.cc',
229        'tests/integration_tests/integration_tests_common.h',
230      ],
231      'link_settings': {
232        'libraries': [
233          '-ldxva2.lib',
234        ],
235      },
236    },
237    {
238      'target_name': 'sbox_integration_test_hook_dll',
239      'type': 'shared_library',
240      'dependencies': [
241      ],
242      'sources': [
243        'tests/integration_tests/hooking_dll.cc',
244        'tests/integration_tests/integration_tests_common.h',
245      ],
246    },
247    {
248      'target_name': 'sbox_integration_test_win_proc',
249      'type': 'executable',
250      'dependencies': [
251      ],
252      'sources': [
253        'tests/integration_tests/hooking_win_proc.cc',
254        'tests/integration_tests/integration_tests_common.h',
255      ],
256      'msvs_settings': {
257        'VCLinkerTool': {
258          'SubSystem': '2',  # Set /SUBSYSTEM:WINDOWS
259        },
260      },
261    },
262    {
263      'target_name': 'sbox_validation_tests',
264      'type': 'executable',
265      'dependencies': [
266        'sandbox',
267        '../base/base.gyp:test_support_base',
268        '../testing/gtest.gyp:gtest',
269      ],
270      'sources': [
271        'tests/common/controller.cc',
272        'tests/common/controller.h',
273        'tests/validation_tests/unit_tests.cc',
274        'tests/validation_tests/commands.cc',
275        'tests/validation_tests/commands.h',
276        'tests/validation_tests/suite.cc',
277      ],
278      'link_settings': {
279        'libraries': [
280          '-lshlwapi.lib',
281        ],
282      },
283    },
284    {
285      'target_name': 'sbox_unittests',
286      'type': 'executable',
287      'dependencies': [
288        'sandbox',
289        '../base/base.gyp:test_support_base',
290        '../testing/gtest.gyp:gtest',
291      ],
292      'sources': [
293        'src/interception_unittest.cc',
294        'src/service_resolver_unittest.cc',
295        'src/restricted_token_unittest.cc',
296        'src/job_unittest.cc',
297        'src/sid_unittest.cc',
298        'src/policy_engine_unittest.cc',
299        'src/policy_low_level_unittest.cc',
300        'src/policy_opcodes_unittest.cc',
301        'src/ipc_unittest.cc',
302        'src/sandbox_nt_util_unittest.cc',
303        'src/threadpool_unittest.cc',
304        'src/win_utils_unittest.cc',
305        'tests/common/test_utils.cc',
306        'tests/common/test_utils.h',
307        'tests/unit_tests/unit_tests.cc',
308      ],
309    },
310    {
311      'target_name': 'sandbox_poc',
312      'type': 'executable',
313      'dependencies': [
314        'sandbox',
315        'pocdll',
316      ],
317      'sources': [
318        'sandbox_poc/main_ui_window.cc',
319        'sandbox_poc/main_ui_window.h',
320        'sandbox_poc/resource.h',
321        'sandbox_poc/sandbox.cc',
322        'sandbox_poc/sandbox.h',
323        'sandbox_poc/sandbox.ico',
324        'sandbox_poc/sandbox.rc',
325      ],
326      'link_settings': {
327        'libraries': [
328          '-lcomctl32.lib',
329        ],
330      },
331      'msvs_settings': {
332        'VCLinkerTool': {
333          'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
334        },
335      },
336    },
337    {
338      'target_name': 'pocdll',
339      'type': 'shared_library',
340      'sources': [
341        'sandbox_poc/pocdll/exports.h',
342        'sandbox_poc/pocdll/fs.cc',
343        'sandbox_poc/pocdll/handles.cc',
344        'sandbox_poc/pocdll/invasive.cc',
345        'sandbox_poc/pocdll/network.cc',
346        'sandbox_poc/pocdll/pocdll.cc',
347        'sandbox_poc/pocdll/processes_and_threads.cc',
348        'sandbox_poc/pocdll/registry.cc',
349        'sandbox_poc/pocdll/spyware.cc',
350        'sandbox_poc/pocdll/utils.h',
351      ],
352      'defines': [
353        'POCDLL_EXPORTS',
354      ],
355      'include_dirs': [
356        '../..',
357      ],
358    },
359  ],
360  'conditions': [
361    ['OS=="win" and target_arch=="ia32"', {
362      'targets': [
363        {
364          'target_name': 'sandbox_win64',
365          'type': 'static_library',
366          'variables': {
367            'sandbox_windows_target': 1,
368            'target_arch': 'x64',
369          },
370          'dependencies': [
371            '../base/base.gyp:base_win64',
372            '../base/base.gyp:base_static_win64',
373          ],
374          'configurations': {
375            'Common_Base': {
376              'msvs_target_platform': 'x64',
377            },
378          },
379          'include_dirs': [
380            '../..',
381          ],
382          'defines': [
383            '<@(nacl_win64_defines)',
384          ]
385        },
386      ],
387    }],
388    ['test_isolation_mode != "noop"', {
389      'targets': [
390        {
391          'target_name': 'sbox_integration_tests_run',
392          'type': 'none',
393          'dependencies': [
394            'sbox_integration_tests',
395          ],
396          'includes': [
397            '../../build/isolate.gypi',
398          ],
399          'sources': [
400            '../sbox_integration_tests.isolate',
401          ],
402        },
403        {
404          'target_name': 'sbox_unittests_run',
405          'type': 'none',
406          'dependencies': [
407            'sbox_unittests',
408          ],
409          'includes': [
410            '../../build/isolate.gypi',
411          ],
412          'sources': [
413            '../sbox_unittests.isolate',
414          ],
415        },
416        {
417          'target_name': 'sbox_validation_tests_run',
418          'type': 'none',
419          'dependencies': [
420            'sbox_validation_tests',
421          ],
422          'includes': [
423            '../../build/isolate.gypi',
424          ],
425          'sources': [
426            '../sbox_validation_tests.isolate',
427          ],
428        },
429      ],
430    }],
431  ],
432}
433