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/dump_bpf.cc',
139 'bpf_dsl/dump_bpf.h',
140 'bpf_dsl/errorcode.cc',
141 'bpf_dsl/errorcode.h',
142 'bpf_dsl/linux_syscall_ranges.h',
145 'bpf_dsl/policy_compiler.cc',
146 'bpf_dsl/policy_compiler.h',
147 'bpf_dsl/seccomp_macros.h',
148 'bpf_dsl/seccomp_macros.h',
149 'bpf_dsl/syscall_set.cc',
150 'bpf_dsl/syscall_set.h',
151 'bpf_dsl/trap_registry.h',
152 'bpf_dsl/verifier.cc',
153 'bpf_dsl/verifier.h',
154 'seccomp-bpf/die.cc',
156 'seccomp-bpf/sandbox_bpf.cc',
157 'seccomp-bpf/sandbox_bpf.h',
158 'seccomp-bpf/syscall.cc',
159 'seccomp-bpf/syscall.h',
160 'seccomp-bpf/trap.cc',
161 'seccomp-bpf/trap.h',
164 '../base/base.gyp:base',
166 'sandbox_services_headers',
169 'SANDBOX_IMPLEMENTATION',
172 # Disable LTO due to compiler bug
173 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703
174 '../../build/android/disable_gcc_lto.gypi',
181 'target_name': 'seccomp_bpf_helpers',
182 'type': '<(component)',
184 'seccomp-bpf-helpers/baseline_policy.cc',
185 'seccomp-bpf-helpers/baseline_policy.h',
186 'seccomp-bpf-helpers/sigsys_handlers.cc',
187 'seccomp-bpf-helpers/sigsys_handlers.h',
188 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
189 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
190 'seccomp-bpf-helpers/syscall_sets.cc',
191 'seccomp-bpf-helpers/syscall_sets.h',
194 '../base/base.gyp:base',
199 'SANDBOX_IMPLEMENTATION',
206 # The setuid sandbox, for Linux
207 'target_name': 'chrome_sandbox',
208 'type': 'executable',
210 'suid/common/sandbox.h',
211 'suid/common/suid_unsafe_environment_variables.h',
212 'suid/process_util.h',
213 'suid/process_util_linux.c',
223 # Do not use any sanitizer tools with this binary. http://crbug.com/382766
225 ['exclude', '-fsanitize'],
228 ['exclude', '-fsanitize'],
231 { 'target_name': 'sandbox_services',
232 'type': '<(component)',
234 'services/init_process_reaper.cc',
235 'services/init_process_reaper.h',
236 'services/proc_util.cc',
237 'services/proc_util.h',
238 'services/resource_limits.cc',
239 'services/resource_limits.h',
240 'services/scoped_process.cc',
241 'services/scoped_process.h',
242 'services/syscall_wrappers.cc',
243 'services/syscall_wrappers.h',
244 'services/thread_helpers.cc',
245 'services/thread_helpers.h',
248 'syscall_broker/broker_channel.cc',
249 'syscall_broker/broker_channel.h',
250 'syscall_broker/broker_client.cc',
251 'syscall_broker/broker_client.h',
252 'syscall_broker/broker_common.h',
253 'syscall_broker/broker_file_permission.cc',
254 'syscall_broker/broker_file_permission.h',
255 'syscall_broker/broker_host.cc',
256 'syscall_broker/broker_host.h',
257 'syscall_broker/broker_policy.cc',
258 'syscall_broker/broker_policy.h',
259 'syscall_broker/broker_process.cc',
260 'syscall_broker/broker_process.h',
263 '../base/base.gyp:base',
266 'SANDBOX_IMPLEMENTATION',
269 ['compile_credentials==1', {
271 'services/credentials.cc',
272 'services/credentials.h',
273 'services/namespace_sandbox.cc',
274 'services/namespace_sandbox.h',
275 'services/namespace_utils.cc',
276 'services/namespace_utils.h',
280 'sandbox_services_headers',
288 { 'target_name': 'sandbox_services_headers',
291 'system_headers/arm64_linux_syscalls.h',
292 'system_headers/arm64_linux_ucontext.h',
293 'system_headers/arm_linux_syscalls.h',
294 'system_headers/arm_linux_ucontext.h',
295 'system_headers/capability.h',
296 'system_headers/i386_linux_ucontext.h',
297 'system_headers/linux_futex.h',
298 'system_headers/linux_seccomp.h',
299 'system_headers/linux_syscalls.h',
300 'system_headers/linux_time.h',
301 'system_headers/linux_ucontext.h',
302 'system_headers/mips_linux_syscalls.h',
303 'system_headers/mips_linux_ucontext.h',
304 'system_headers/x86_32_linux_syscalls.h',
305 'system_headers/x86_64_linux_syscalls.h',
312 # We make this its own target so that it does not interfere
313 # with our tests, and so that it may be selectively included
314 # in ports which need it.
315 'target_name': 'libc_urandom_override',
316 'type': 'static_library',
318 'services/libc_urandom_override.cc',
319 'services/libc_urandom_override.h',
322 '../base/base.gyp:base',
329 'target_name': 'suid_sandbox_client',
330 'type': '<(component)',
332 'suid/common/sandbox.h',
333 'suid/common/suid_unsafe_environment_variables.h',
334 'suid/client/setuid_sandbox_client.cc',
335 'suid/client/setuid_sandbox_client.h',
336 'suid/client/setuid_sandbox_host.cc',
337 'suid/client/setuid_sandbox_host.h',
340 'SANDBOX_IMPLEMENTATION',
343 '../base/base.gyp:base',
351 'target_name': 'bpf_dsl_golden',
355 'action_name': 'generate',
357 'bpf_dsl/golden/generate.py',
358 'bpf_dsl/golden/i386/ArgSizePolicy.txt',
359 'bpf_dsl/golden/i386/BasicPolicy.txt',
360 'bpf_dsl/golden/i386/ElseIfPolicy.txt',
361 'bpf_dsl/golden/i386/MaskingPolicy.txt',
362 'bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt',
363 'bpf_dsl/golden/i386/NegativeConstantsPolicy.txt',
364 'bpf_dsl/golden/i386/SwitchPolicy.txt',
365 'bpf_dsl/golden/x86-64/ArgSizePolicy.txt',
366 'bpf_dsl/golden/x86-64/BasicPolicy.txt',
367 'bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt',
368 'bpf_dsl/golden/x86-64/ElseIfPolicy.txt',
369 'bpf_dsl/golden/x86-64/MaskingPolicy.txt',
370 'bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt',
371 'bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt',
372 'bpf_dsl/golden/x86-64/SwitchPolicy.txt',
375 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_files.h',
379 'linux/bpf_dsl/golden/generate.py',
380 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_files.h',
381 'linux/bpf_dsl/golden/i386/ArgSizePolicy.txt',
382 'linux/bpf_dsl/golden/i386/BasicPolicy.txt',
383 'linux/bpf_dsl/golden/i386/ElseIfPolicy.txt',
384 'linux/bpf_dsl/golden/i386/MaskingPolicy.txt',
385 'linux/bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt',
386 'linux/bpf_dsl/golden/i386/NegativeConstantsPolicy.txt',
387 'linux/bpf_dsl/golden/i386/SwitchPolicy.txt',
388 'linux/bpf_dsl/golden/x86-64/ArgSizePolicy.txt',
389 'linux/bpf_dsl/golden/x86-64/BasicPolicy.txt',
390 'linux/bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt',
391 'linux/bpf_dsl/golden/x86-64/ElseIfPolicy.txt',
392 'linux/bpf_dsl/golden/x86-64/MaskingPolicy.txt',
393 'linux/bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt',
394 'linux/bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt',
395 'linux/bpf_dsl/golden/x86-64/SwitchPolicy.txt',
397 'message': 'Generating header from golden files ...',
406 'target_name': 'sandbox_linux_unittests_stripped',
408 'dependencies': [ 'sandbox_linux_unittests' ],
410 'action_name': 'strip sandbox_linux_unittests',
411 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
412 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
413 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
417 'target_name': 'sandbox_linux_unittests_deps',
420 'sandbox_linux_unittests_stripped',
422 # For the component build, ensure dependent shared libraries are
423 # stripped and put alongside sandbox_linux_unittests to simplify pushing
426 'output_dir': '<(PRODUCT_DIR)/sandbox_linux_unittests_deps/',
427 'native_binary': '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped',
428 'include_main_binary': 0,
431 '../../build/android/native_app_dependencies.gypi'
438 'target_name': 'sandbox_linux_jni_unittests_apk',
441 'test_suite_name': 'sandbox_linux_jni_unittests',
444 'sandbox_linux_jni_unittests',
446 'includes': [ '../../build/apk_test.gypi' ],
450 ['test_isolation_mode != "noop"', {
453 'target_name': 'sandbox_linux_unittests_run',
456 'sandbox_linux_unittests',
459 '../../build/isolate.gypi',
462 '../sandbox_linux_unittests.isolate',