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")', {
16 'compile_seccomp_bpf_demo': 1,
18 'compile_seccomp_bpf_demo': 0,
23 'target_conditions': [
24 # All linux/ files will automatically be excluded on Android
25 # so make sure we re-include them explicitly.
28 ['include', '^linux/'],
34 # We have two principal targets: sandbox and sandbox_linux_unittests
35 # All other targets are listed as dependencies.
36 # There is one notable exception: for historical reasons, chrome_sandbox is
37 # the setuid sandbox and is its own target.
39 'target_name': 'sandbox',
45 [ 'compile_suid_client==1', {
47 'suid_sandbox_client',
50 # Compile seccomp BPF when we support it.
51 [ 'use_seccomp_bpf==1', {
54 'seccomp_bpf_helpers',
60 'target_name': 'sandbox_linux_test_utils',
61 'type': 'static_library',
63 '../testing/gtest.gyp:gtest',
69 'tests/sandbox_test_runner.cc',
70 'tests/sandbox_test_runner.h',
71 'tests/sandbox_test_runner_function_pointer.cc',
72 'tests/sandbox_test_runner_function_pointer.h',
73 'tests/test_utils.cc',
75 'tests/unit_tests.cc',
79 [ 'use_seccomp_bpf==1', {
81 'seccomp-bpf/bpf_tester_compatibility_delegate.h',
82 'seccomp-bpf/bpf_tests.h',
83 'seccomp-bpf/sandbox_bpf_test_runner.cc',
84 'seccomp-bpf/sandbox_bpf_test_runner.h',
93 # The main sandboxing test target.
94 'target_name': 'sandbox_linux_unittests',
96 'sandbox_linux_test_sources.gypi',
101 # This target is the shared library used by Android APK (i.e.
102 # JNI-friendly) tests.
103 'target_name': 'sandbox_linux_jni_unittests',
105 'sandbox_linux_test_sources.gypi',
107 'type': 'shared_library',
109 [ 'OS == "android"', {
111 '../testing/android/native_test.gyp:native_test_native_code',
117 'target_name': 'seccomp_bpf',
118 'type': '<(component)',
120 'seccomp-bpf/basicblock.cc',
121 'seccomp-bpf/basicblock.h',
122 'seccomp-bpf/codegen.cc',
123 'seccomp-bpf/codegen.h',
124 'seccomp-bpf/die.cc',
126 'seccomp-bpf/errorcode.cc',
127 'seccomp-bpf/errorcode.h',
128 'seccomp-bpf/instruction.h',
129 'seccomp-bpf/linux_seccomp.h',
130 'seccomp-bpf/sandbox_bpf.cc',
131 'seccomp-bpf/sandbox_bpf.h',
132 'seccomp-bpf/sandbox_bpf_compatibility_policy.h',
133 'seccomp-bpf/sandbox_bpf_policy.cc',
134 'seccomp-bpf/sandbox_bpf_policy.h',
135 'seccomp-bpf/syscall.cc',
136 'seccomp-bpf/syscall.h',
137 'seccomp-bpf/syscall_iterator.cc',
138 'seccomp-bpf/syscall_iterator.h',
139 'seccomp-bpf/trap.cc',
140 'seccomp-bpf/trap.h',
141 'seccomp-bpf/verifier.cc',
142 'seccomp-bpf/verifier.h',
145 '../base/base.gyp:base',
146 'sandbox_services_headers',
149 'SANDBOX_IMPLEMENTATION',
156 'target_name': 'seccomp_bpf_helpers',
157 'type': '<(component)',
159 'seccomp-bpf-helpers/baseline_policy.cc',
160 'seccomp-bpf-helpers/baseline_policy.h',
161 'seccomp-bpf-helpers/sigsys_handlers.cc',
162 'seccomp-bpf-helpers/sigsys_handlers.h',
163 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
164 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
165 'seccomp-bpf-helpers/syscall_sets.cc',
166 'seccomp-bpf-helpers/syscall_sets.h',
169 '../base/base.gyp:base',
173 'SANDBOX_IMPLEMENTATION',
180 # A demonstration program for the seccomp-bpf sandbox.
181 'target_name': 'seccomp_bpf_demo',
183 ['compile_seccomp_bpf_demo==1', {
184 'type': 'executable',
186 'seccomp-bpf/demo.cc',
200 # The setuid sandbox, for Linux
201 'target_name': 'chrome_sandbox',
202 'type': 'executable',
204 'suid/common/sandbox.h',
205 'suid/common/suid_unsafe_environment_variables.h',
208 'suid/process_util.h',
209 'suid/process_util_linux.c',
219 # Do not use any sanitizer tools with this binary. http://crbug.com/382766
221 ['exclude', '-fsanitize'],
224 ['exclude', '-fsanitize'],
227 { 'target_name': 'sandbox_services',
228 'type': '<(component)',
230 'services/broker_process.cc',
231 'services/broker_process.h',
232 'services/init_process_reaper.cc',
233 'services/init_process_reaper.h',
234 'services/scoped_process.cc',
235 'services/scoped_process.h',
236 'services/thread_helpers.cc',
237 'services/thread_helpers.h',
242 '../base/base.gyp:base',
245 'SANDBOX_IMPLEMENTATION',
248 ['compile_credentials==1', {
250 'services/credentials.cc',
251 'services/credentials.h',
254 # for capabilities.cc.
255 '../build/linux/system.gyp:libcap',
263 { 'target_name': 'sandbox_services_headers',
266 'services/android_arm_ucontext.h',
267 'services/android_futex.h',
268 'services/android_ucontext.h',
269 'services/android_i386_ucontext.h',
270 'services/arm_linux_syscalls.h',
271 'services/linux_syscalls.h',
272 'services/x86_32_linux_syscalls.h',
273 'services/x86_64_linux_syscalls.h',
280 # We make this its own target so that it does not interfere
282 'target_name': 'libc_urandom_override',
283 'type': 'static_library',
285 'services/libc_urandom_override.cc',
286 'services/libc_urandom_override.h',
289 '../base/base.gyp:base',
296 'target_name': 'suid_sandbox_client',
297 'type': '<(component)',
299 'suid/common/sandbox.h',
300 'suid/common/suid_unsafe_environment_variables.h',
301 'suid/client/setuid_sandbox_client.cc',
302 'suid/client/setuid_sandbox_client.h',
305 'SANDBOX_IMPLEMENTATION',
308 '../base/base.gyp:base',
320 'target_name': 'sandbox_linux_unittests_stripped',
322 'dependencies': [ 'sandbox_linux_unittests' ],
324 'action_name': 'strip sandbox_linux_unittests',
325 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
326 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
327 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
335 'target_name': 'sandbox_linux_jni_unittests_apk',
338 'test_suite_name': 'sandbox_linux_jni_unittests',
341 'sandbox_linux_jni_unittests',
343 'includes': [ '../../build/apk_test.gypi' ],
347 ['test_isolation_mode != "noop"', {
350 'target_name': 'sandbox_linux_unittests_run',
353 'sandbox_linux_unittests',
356 '../../build/isolate.gypi',
357 '../sandbox_linux_unittests.isolate',
360 '../sandbox_linux_unittests.isolate',