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.h',
70 'tests/sandbox_test_runner_function_pointer.cc',
71 'tests/sandbox_test_runner_function_pointer.h',
72 'tests/test_utils.cc',
74 'tests/unit_tests.cc',
78 [ 'use_seccomp_bpf==1', {
80 'seccomp-bpf/bpf_tester_compatibility_delegate.cc',
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" and gtest_target_type == "shared_library"', {
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.h',
134 'seccomp-bpf/syscall.cc',
135 'seccomp-bpf/syscall.h',
136 'seccomp-bpf/syscall_iterator.cc',
137 'seccomp-bpf/syscall_iterator.h',
138 'seccomp-bpf/trap.cc',
139 'seccomp-bpf/trap.h',
140 'seccomp-bpf/verifier.cc',
141 'seccomp-bpf/verifier.h',
144 '../base/base.gyp:base',
145 'sandbox_services_headers',
148 'SANDBOX_IMPLEMENTATION',
155 'target_name': 'seccomp_bpf_helpers',
156 'type': '<(component)',
158 'seccomp-bpf-helpers/baseline_policy.cc',
159 'seccomp-bpf-helpers/baseline_policy.h',
160 'seccomp-bpf-helpers/sigsys_handlers.cc',
161 'seccomp-bpf-helpers/sigsys_handlers.h',
162 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
163 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
164 'seccomp-bpf-helpers/syscall_sets.cc',
165 'seccomp-bpf-helpers/syscall_sets.h',
168 '../base/base.gyp:base',
172 'SANDBOX_IMPLEMENTATION',
179 # A demonstration program for the seccomp-bpf sandbox.
180 'target_name': 'seccomp_bpf_demo',
182 ['compile_seccomp_bpf_demo==1', {
183 'type': 'executable',
185 'seccomp-bpf/demo.cc',
199 # The setuid sandbox, for Linux
200 'target_name': 'chrome_sandbox',
201 'type': 'executable',
203 'suid/common/sandbox.h',
204 'suid/common/suid_unsafe_environment_variables.h',
207 'suid/process_util.h',
208 'suid/process_util_linux.c',
219 { 'target_name': 'sandbox_services',
220 'type': '<(component)',
222 'services/broker_process.cc',
223 'services/broker_process.h',
224 'services/init_process_reaper.cc',
225 'services/init_process_reaper.h',
226 'services/scoped_process.cc',
227 'services/scoped_process.h',
228 'services/thread_helpers.cc',
229 'services/thread_helpers.h',
234 '../base/base.gyp:base',
237 'SANDBOX_IMPLEMENTATION',
240 ['compile_credentials==1', {
242 'services/credentials.cc',
243 'services/credentials.h',
246 # for capabilities.cc.
247 '../build/linux/system.gyp:libcap',
255 { 'target_name': 'sandbox_services_headers',
258 'services/android_arm_ucontext.h',
259 'services/android_ucontext.h',
260 'services/android_i386_ucontext.h',
261 'services/arm_linux_syscalls.h',
262 'services/linux_syscalls.h',
263 'services/x86_32_linux_syscalls.h',
264 'services/x86_64_linux_syscalls.h',
271 # We make this its own target so that it does not interfere
273 'target_name': 'libc_urandom_override',
274 'type': 'static_library',
276 'services/libc_urandom_override.cc',
277 'services/libc_urandom_override.h',
280 '../base/base.gyp:base',
287 'target_name': 'suid_sandbox_client',
288 'type': '<(component)',
290 'suid/common/sandbox.h',
291 'suid/common/suid_unsafe_environment_variables.h',
292 'suid/client/setuid_sandbox_client.cc',
293 'suid/client/setuid_sandbox_client.h',
296 'SANDBOX_IMPLEMENTATION',
299 '../base/base.gyp:base',
311 'target_name': 'sandbox_linux_unittests_stripped',
313 'dependencies': [ 'sandbox_linux_unittests' ],
315 'action_name': 'strip sandbox_linux_unittests',
316 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
317 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
318 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
323 # Strategy copied from base_unittests_apk in base/base.gyp.
324 [ 'OS=="android" and gtest_target_type == "shared_library"', {
327 'target_name': 'sandbox_linux_jni_unittests_apk',
330 'test_suite_name': 'sandbox_linux_jni_unittests',
333 'sandbox_linux_jni_unittests',
335 'includes': [ '../../build/apk_test.gypi' ],