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/linux_syscall_ranges.h',
143 'bpf_dsl/policy_compiler.cc',
144 'bpf_dsl/policy_compiler.h',
145 'bpf_dsl/seccomp_macros.h',
146 'bpf_dsl/seccomp_macros.h',
147 'bpf_dsl/syscall_set.cc',
148 'bpf_dsl/syscall_set.h',
149 'bpf_dsl/trap_registry.h',
150 'bpf_dsl/verifier.cc',
151 'bpf_dsl/verifier.h',
152 'seccomp-bpf/die.cc',
154 'seccomp-bpf/errorcode.cc',
155 'seccomp-bpf/errorcode.h',
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_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
314 'target_name': 'libc_urandom_override',
315 'type': 'static_library',
317 'services/libc_urandom_override.cc',
318 'services/libc_urandom_override.h',
321 '../base/base.gyp:base',
328 'target_name': 'suid_sandbox_client',
329 'type': '<(component)',
331 'suid/common/sandbox.h',
332 'suid/common/suid_unsafe_environment_variables.h',
333 'suid/client/setuid_sandbox_client.cc',
334 'suid/client/setuid_sandbox_client.h',
335 'suid/client/setuid_sandbox_host.cc',
336 'suid/client/setuid_sandbox_host.h',
339 'SANDBOX_IMPLEMENTATION',
342 '../base/base.gyp:base',
354 'target_name': 'sandbox_linux_unittests_stripped',
356 'dependencies': [ 'sandbox_linux_unittests' ],
358 'action_name': 'strip sandbox_linux_unittests',
359 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
360 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
361 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
365 'target_name': 'sandbox_linux_unittests_deps',
368 'sandbox_linux_unittests_stripped',
370 # For the component build, ensure dependent shared libraries are
371 # stripped and put alongside sandbox_linux_unittests to simplify pushing
374 'output_dir': '<(PRODUCT_DIR)/sandbox_linux_unittests_deps/',
375 'native_binary': '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped',
376 'include_main_binary': 0,
379 '../../build/android/native_app_dependencies.gypi'
386 'target_name': 'sandbox_linux_jni_unittests_apk',
389 'test_suite_name': 'sandbox_linux_jni_unittests',
392 'sandbox_linux_jni_unittests',
394 'includes': [ '../../build/apk_test.gypi' ],
398 ['test_isolation_mode != "noop"', {
401 'target_name': 'sandbox_linux_unittests_run',
404 'sandbox_linux_unittests',
407 '../../build/isolate.gypi',
410 '../sandbox_linux_unittests.isolate',