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,
12 'compile_suid_client': 0,
13 'compile_credentials': 0,
15 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64" or '
16 'target_arch=="mipsel")', {
17 'compile_seccomp_bpf_demo': 1,
19 'compile_seccomp_bpf_demo': 0,
24 'target_conditions': [
25 # All linux/ files will automatically be excluded on Android
26 # so make sure we re-include them explicitly.
29 ['include', '^linux/'],
35 # We have two principal targets: sandbox and sandbox_linux_unittests
36 # All other targets are listed as dependencies.
37 # There is one notable exception: for historical reasons, chrome_sandbox is
38 # the setuid sandbox and is its own target.
40 'target_name': 'sandbox',
46 [ 'compile_suid_client==1', {
48 'suid_sandbox_client',
51 # Compile seccomp BPF when we support it.
52 [ 'use_seccomp_bpf==1', {
55 'seccomp_bpf_helpers',
61 'target_name': 'sandbox_linux_test_utils',
62 'type': 'static_library',
64 '../testing/gtest.gyp:gtest',
70 'tests/sandbox_test_runner.cc',
71 'tests/sandbox_test_runner.h',
72 'tests/sandbox_test_runner_function_pointer.cc',
73 'tests/sandbox_test_runner_function_pointer.h',
74 'tests/test_utils.cc',
76 'tests/unit_tests.cc',
80 [ 'use_seccomp_bpf==1', {
82 'seccomp-bpf/bpf_tester_compatibility_delegate.h',
83 'seccomp-bpf/bpf_tests.h',
84 'seccomp-bpf/sandbox_bpf_test_runner.cc',
85 'seccomp-bpf/sandbox_bpf_test_runner.h',
94 # The main sandboxing test target.
95 'target_name': 'sandbox_linux_unittests',
97 'sandbox_linux_test_sources.gypi',
102 # This target is the shared library used by Android APK (i.e.
103 # JNI-friendly) tests.
104 'target_name': 'sandbox_linux_jni_unittests',
106 'sandbox_linux_test_sources.gypi',
108 'type': 'shared_library',
110 [ 'OS == "android"', {
112 '../testing/android/native_test.gyp:native_test_native_code',
118 'target_name': 'seccomp_bpf',
119 'type': '<(component)',
121 'bpf_dsl/bpf_dsl.cc',
124 'seccomp-bpf/basicblock.cc',
125 'seccomp-bpf/basicblock.h',
126 'seccomp-bpf/codegen.cc',
127 'seccomp-bpf/codegen.h',
128 'seccomp-bpf/die.cc',
130 'seccomp-bpf/errorcode.cc',
131 'seccomp-bpf/errorcode.h',
132 'seccomp-bpf/instruction.h',
133 'seccomp-bpf/linux_seccomp.h',
134 'seccomp-bpf/sandbox_bpf.cc',
135 'seccomp-bpf/sandbox_bpf.h',
136 'seccomp-bpf/sandbox_bpf_compatibility_policy.h',
137 'seccomp-bpf/sandbox_bpf_policy.cc',
138 'seccomp-bpf/sandbox_bpf_policy.h',
139 'seccomp-bpf/syscall.cc',
140 'seccomp-bpf/syscall.h',
141 'seccomp-bpf/syscall_iterator.cc',
142 'seccomp-bpf/syscall_iterator.h',
143 'seccomp-bpf/trap.cc',
144 'seccomp-bpf/trap.h',
145 'seccomp-bpf/verifier.cc',
146 'seccomp-bpf/verifier.h',
149 '../base/base.gyp:base',
150 'sandbox_services_headers',
153 'SANDBOX_IMPLEMENTATION',
160 'target_name': 'seccomp_bpf_helpers',
161 'type': '<(component)',
163 'seccomp-bpf-helpers/baseline_policy.cc',
164 'seccomp-bpf-helpers/baseline_policy.h',
165 'seccomp-bpf-helpers/sigsys_handlers.cc',
166 'seccomp-bpf-helpers/sigsys_handlers.h',
167 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
168 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
169 'seccomp-bpf-helpers/syscall_sets.cc',
170 'seccomp-bpf-helpers/syscall_sets.h',
173 '../base/base.gyp:base',
177 'SANDBOX_IMPLEMENTATION',
184 # The setuid sandbox, for Linux
185 'target_name': 'chrome_sandbox',
186 'type': 'executable',
188 'suid/common/sandbox.h',
189 'suid/common/suid_unsafe_environment_variables.h',
190 'suid/process_util.h',
191 'suid/process_util_linux.c',
201 # Do not use any sanitizer tools with this binary. http://crbug.com/382766
203 ['exclude', '-fsanitize'],
206 ['exclude', '-fsanitize'],
209 { 'target_name': 'sandbox_services',
210 'type': '<(component)',
212 'services/broker_process.cc',
213 'services/broker_process.h',
214 'services/init_process_reaper.cc',
215 'services/init_process_reaper.h',
216 'services/scoped_process.cc',
217 'services/scoped_process.h',
218 'services/thread_helpers.cc',
219 'services/thread_helpers.h',
224 '../base/base.gyp:base',
227 'SANDBOX_IMPLEMENTATION',
230 ['compile_credentials==1', {
232 'services/credentials.cc',
233 'services/credentials.h',
236 # for capabilities.cc.
237 '../build/linux/system.gyp:libcap',
245 { 'target_name': 'sandbox_services_headers',
248 'services/android_arm_ucontext.h',
249 'services/android_arm64_ucontext.h',
250 'services/android_futex.h',
251 'services/android_ucontext.h',
252 'services/android_i386_ucontext.h',
253 'services/android_mips_ucontext.h',
254 'services/arm_linux_syscalls.h',
255 'services/arm64_linux_syscalls.h',
256 'services/mips_linux_syscalls.h',
257 'services/linux_syscalls.h',
258 'services/x86_32_linux_syscalls.h',
259 'services/x86_64_linux_syscalls.h',
266 # We make this its own target so that it does not interfere
268 'target_name': 'libc_urandom_override',
269 'type': 'static_library',
271 'services/libc_urandom_override.cc',
272 'services/libc_urandom_override.h',
275 '../base/base.gyp:base',
282 'target_name': 'suid_sandbox_client',
283 'type': '<(component)',
285 'suid/common/sandbox.h',
286 'suid/common/suid_unsafe_environment_variables.h',
287 'suid/client/setuid_sandbox_client.cc',
288 'suid/client/setuid_sandbox_client.h',
291 'SANDBOX_IMPLEMENTATION',
294 '../base/base.gyp:base',
306 'target_name': 'sandbox_linux_unittests_stripped',
308 'dependencies': [ 'sandbox_linux_unittests' ],
310 'action_name': 'strip sandbox_linux_unittests',
311 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
312 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
313 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
321 'target_name': 'sandbox_linux_jni_unittests_apk',
324 'test_suite_name': 'sandbox_linux_jni_unittests',
327 'sandbox_linux_jni_unittests',
329 'includes': [ '../../build/apk_test.gypi' ],
333 ['test_isolation_mode != "noop"', {
336 'target_name': 'sandbox_linux_unittests_run',
339 'sandbox_linux_unittests',
342 '../../build/isolate.gypi',
343 '../sandbox_linux_unittests.isolate',
346 '../sandbox_linux_unittests.isolate',