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.
9 'compile_suid_client': 1,
10 'compile_credentials': 1,
11 'use_base_test_suite': 1,
13 'compile_suid_client': 0,
14 'compile_credentials': 0,
15 'use_base_test_suite': 0,
17 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64" or '
18 'target_arch=="mipsel")', {
19 'compile_seccomp_bpf_demo': 1,
21 'compile_seccomp_bpf_demo': 0,
26 'target_conditions': [
27 # All linux/ files will automatically be excluded on Android
28 # so make sure we re-include them explicitly.
31 ['include', '^linux/'],
37 # We have two principal targets: sandbox and sandbox_linux_unittests
38 # All other targets are listed as dependencies.
39 # There is one notable exception: for historical reasons, chrome_sandbox is
40 # the setuid sandbox and is its own target.
42 'target_name': 'sandbox',
48 [ 'compile_suid_client==1', {
50 'suid_sandbox_client',
53 # Compile seccomp BPF when we support it.
54 [ 'use_seccomp_bpf==1', {
57 'seccomp_bpf_helpers',
63 'target_name': 'sandbox_linux_test_utils',
64 'type': 'static_library',
66 '../testing/gtest.gyp:gtest',
72 'tests/sandbox_test_runner.cc',
73 'tests/sandbox_test_runner.h',
74 'tests/sandbox_test_runner_function_pointer.cc',
75 'tests/sandbox_test_runner_function_pointer.h',
76 'tests/test_utils.cc',
78 'tests/unit_tests.cc',
82 [ 'use_seccomp_bpf==1', {
84 'seccomp-bpf/bpf_tester_compatibility_delegate.h',
85 'seccomp-bpf/bpf_tests.h',
86 'seccomp-bpf/sandbox_bpf_test_runner.cc',
87 'seccomp-bpf/sandbox_bpf_test_runner.h',
93 [ 'use_base_test_suite==1', {
95 '../base/base.gyp:test_support_base',
98 'SANDBOX_USES_BASE_TEST_SUITE',
104 # The main sandboxing test target.
105 'target_name': 'sandbox_linux_unittests',
107 'sandbox_linux_test_sources.gypi',
109 'type': 'executable',
112 # This target is the shared library used by Android APK (i.e.
113 # JNI-friendly) tests.
114 'target_name': 'sandbox_linux_jni_unittests',
116 'sandbox_linux_test_sources.gypi',
118 'type': 'shared_library',
120 [ 'OS == "android"', {
122 '../testing/android/native_test.gyp:native_test_native_code',
128 'target_name': 'seccomp_bpf',
129 'type': '<(component)',
131 'bpf_dsl/bpf_dsl.cc',
133 'bpf_dsl/bpf_dsl_forward.h',
134 'bpf_dsl/bpf_dsl_impl.h',
135 'bpf_dsl/codegen.cc',
138 'bpf_dsl/errorcode.h',
139 'bpf_dsl/linux_syscall_ranges.h',
142 'bpf_dsl/policy_compiler.cc',
143 'bpf_dsl/policy_compiler.h',
144 'bpf_dsl/seccomp_macros.h',
145 'bpf_dsl/seccomp_macros.h',
146 'bpf_dsl/syscall_set.cc',
147 'bpf_dsl/syscall_set.h',
148 'bpf_dsl/trap_registry.h',
149 'seccomp-bpf/die.cc',
151 'seccomp-bpf/sandbox_bpf.cc',
152 'seccomp-bpf/sandbox_bpf.h',
153 'seccomp-bpf/syscall.cc',
154 'seccomp-bpf/syscall.h',
155 'seccomp-bpf/trap.cc',
156 'seccomp-bpf/trap.h',
159 '../base/base.gyp:base',
161 'sandbox_services_headers',
164 'SANDBOX_IMPLEMENTATION',
167 # Disable LTO due to compiler bug
168 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703
169 '../../build/android/disable_gcc_lto.gypi',
176 'target_name': 'seccomp_bpf_helpers',
177 'type': '<(component)',
179 'seccomp-bpf-helpers/baseline_policy.cc',
180 'seccomp-bpf-helpers/baseline_policy.h',
181 'seccomp-bpf-helpers/sigsys_handlers.cc',
182 'seccomp-bpf-helpers/sigsys_handlers.h',
183 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
184 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
185 'seccomp-bpf-helpers/syscall_sets.cc',
186 'seccomp-bpf-helpers/syscall_sets.h',
189 '../base/base.gyp:base',
194 'SANDBOX_IMPLEMENTATION',
201 # The setuid sandbox, for Linux
202 'target_name': 'chrome_sandbox',
203 'type': 'executable',
205 'suid/common/sandbox.h',
206 'suid/common/suid_unsafe_environment_variables.h',
207 'suid/process_util.h',
208 'suid/process_util_linux.c',
218 # Do not use any sanitizer tools with this binary. http://crbug.com/382766
220 ['exclude', '-fsanitize'],
223 ['exclude', '-fsanitize'],
226 { 'target_name': 'sandbox_services',
227 'type': '<(component)',
229 'services/init_process_reaper.cc',
230 'services/init_process_reaper.h',
231 'services/proc_util.cc',
232 'services/proc_util.h',
233 'services/resource_limits.cc',
234 'services/resource_limits.h',
235 'services/scoped_process.cc',
236 'services/scoped_process.h',
237 'services/syscall_wrappers.cc',
238 'services/syscall_wrappers.h',
239 'services/thread_helpers.cc',
240 'services/thread_helpers.h',
243 'syscall_broker/broker_channel.cc',
244 'syscall_broker/broker_channel.h',
245 'syscall_broker/broker_client.cc',
246 'syscall_broker/broker_client.h',
247 'syscall_broker/broker_common.h',
248 'syscall_broker/broker_file_permission.cc',
249 'syscall_broker/broker_file_permission.h',
250 'syscall_broker/broker_host.cc',
251 'syscall_broker/broker_host.h',
252 'syscall_broker/broker_policy.cc',
253 'syscall_broker/broker_policy.h',
254 'syscall_broker/broker_process.cc',
255 'syscall_broker/broker_process.h',
258 '../base/base.gyp:base',
261 'SANDBOX_IMPLEMENTATION',
264 ['compile_credentials==1', {
266 'services/credentials.cc',
267 'services/credentials.h',
268 'services/namespace_sandbox.cc',
269 'services/namespace_sandbox.h',
270 'services/namespace_utils.cc',
271 'services/namespace_utils.h',
275 'sandbox_services_headers',
283 { 'target_name': 'sandbox_services_headers',
286 'system_headers/arm64_linux_syscalls.h',
287 'system_headers/arm64_linux_ucontext.h',
288 'system_headers/arm_linux_syscalls.h',
289 'system_headers/arm_linux_ucontext.h',
290 'system_headers/capability.h',
291 'system_headers/i386_linux_ucontext.h',
292 'system_headers/linux_futex.h',
293 'system_headers/linux_seccomp.h',
294 'system_headers/linux_syscalls.h',
295 'system_headers/linux_time.h',
296 'system_headers/linux_ucontext.h',
297 'system_headers/mips_linux_syscalls.h',
298 'system_headers/mips_linux_ucontext.h',
299 'system_headers/x86_32_linux_syscalls.h',
300 'system_headers/x86_64_linux_syscalls.h',
307 # We make this its own target so that it does not interfere
308 # with our tests, and so that it may be selectively included
309 # in ports which need it.
310 'target_name': 'libc_urandom_override',
311 'type': 'static_library',
313 'services/libc_urandom_override.cc',
314 'services/libc_urandom_override.h',
317 '../base/base.gyp:base',
324 'target_name': 'suid_sandbox_client',
325 'type': '<(component)',
327 'suid/common/sandbox.h',
328 'suid/common/suid_unsafe_environment_variables.h',
329 'suid/client/setuid_sandbox_client.cc',
330 'suid/client/setuid_sandbox_client.h',
331 'suid/client/setuid_sandbox_host.cc',
332 'suid/client/setuid_sandbox_host.h',
335 'SANDBOX_IMPLEMENTATION',
338 '../base/base.gyp:base',
346 'target_name': 'bpf_dsl_golden',
350 'action_name': 'generate',
352 'bpf_dsl/golden/generate.py',
353 'bpf_dsl/golden/i386/ArgSizePolicy.txt',
354 'bpf_dsl/golden/i386/BasicPolicy.txt',
355 'bpf_dsl/golden/i386/ElseIfPolicy.txt',
356 'bpf_dsl/golden/i386/MaskingPolicy.txt',
357 'bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt',
358 'bpf_dsl/golden/i386/NegativeConstantsPolicy.txt',
359 'bpf_dsl/golden/i386/SwitchPolicy.txt',
360 'bpf_dsl/golden/x86-64/ArgSizePolicy.txt',
361 'bpf_dsl/golden/x86-64/BasicPolicy.txt',
362 'bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt',
363 'bpf_dsl/golden/x86-64/ElseIfPolicy.txt',
364 'bpf_dsl/golden/x86-64/MaskingPolicy.txt',
365 'bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt',
366 'bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt',
367 'bpf_dsl/golden/x86-64/SwitchPolicy.txt',
370 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_files.h',
374 'linux/bpf_dsl/golden/generate.py',
375 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_files.h',
376 'linux/bpf_dsl/golden/i386/ArgSizePolicy.txt',
377 'linux/bpf_dsl/golden/i386/BasicPolicy.txt',
378 'linux/bpf_dsl/golden/i386/ElseIfPolicy.txt',
379 'linux/bpf_dsl/golden/i386/MaskingPolicy.txt',
380 'linux/bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt',
381 'linux/bpf_dsl/golden/i386/NegativeConstantsPolicy.txt',
382 'linux/bpf_dsl/golden/i386/SwitchPolicy.txt',
383 'linux/bpf_dsl/golden/x86-64/ArgSizePolicy.txt',
384 'linux/bpf_dsl/golden/x86-64/BasicPolicy.txt',
385 'linux/bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt',
386 'linux/bpf_dsl/golden/x86-64/ElseIfPolicy.txt',
387 'linux/bpf_dsl/golden/x86-64/MaskingPolicy.txt',
388 'linux/bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt',
389 'linux/bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt',
390 'linux/bpf_dsl/golden/x86-64/SwitchPolicy.txt',
392 'message': 'Generating header from golden files ...',
401 'target_name': 'sandbox_linux_unittests_stripped',
403 'dependencies': [ 'sandbox_linux_unittests' ],
405 'action_name': 'strip sandbox_linux_unittests',
406 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
407 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
408 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
412 'target_name': 'sandbox_linux_unittests_deps',
415 'sandbox_linux_unittests_stripped',
417 # For the component build, ensure dependent shared libraries are
418 # stripped and put alongside sandbox_linux_unittests to simplify pushing
421 'output_dir': '<(PRODUCT_DIR)/sandbox_linux_unittests_deps/',
422 'native_binary': '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped',
423 'include_main_binary': 0,
426 '../../build/android/native_app_dependencies.gypi'
433 'target_name': 'sandbox_linux_jni_unittests_apk',
436 'test_suite_name': 'sandbox_linux_jni_unittests',
439 'sandbox_linux_jni_unittests',
441 'includes': [ '../../build/apk_test.gypi' ],
445 ['test_isolation_mode != "noop"', {
448 'target_name': 'sandbox_linux_unittests_run',
451 'sandbox_linux_unittests',
454 '../../build/isolate.gypi',
457 '../sandbox_linux_unittests.isolate',