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.h',
81 'seccomp-bpf/bpf_tests.h',
82 'seccomp-bpf/sandbox_bpf_test_runner.cc',
83 'seccomp-bpf/sandbox_bpf_test_runner.h',
92 # The main sandboxing test target.
93 'target_name': 'sandbox_linux_unittests',
95 'sandbox_linux_test_sources.gypi',
100 # This target is the shared library used by Android APK (i.e.
101 # JNI-friendly) tests.
102 'target_name': 'sandbox_linux_jni_unittests',
104 'sandbox_linux_test_sources.gypi',
106 'type': 'shared_library',
108 [ 'OS == "android" and gtest_target_type == "shared_library"', {
110 '../testing/android/native_test.gyp:native_test_native_code',
116 'target_name': 'seccomp_bpf',
117 'type': '<(component)',
119 'seccomp-bpf/basicblock.cc',
120 'seccomp-bpf/basicblock.h',
121 'seccomp-bpf/codegen.cc',
122 'seccomp-bpf/codegen.h',
123 'seccomp-bpf/die.cc',
125 'seccomp-bpf/errorcode.cc',
126 'seccomp-bpf/errorcode.h',
127 'seccomp-bpf/instruction.h',
128 'seccomp-bpf/linux_seccomp.h',
129 'seccomp-bpf/sandbox_bpf.cc',
130 'seccomp-bpf/sandbox_bpf.h',
131 'seccomp-bpf/sandbox_bpf_compatibility_policy.h',
132 'seccomp-bpf/sandbox_bpf_policy.h',
133 'seccomp-bpf/syscall.cc',
134 'seccomp-bpf/syscall.h',
135 'seccomp-bpf/syscall_iterator.cc',
136 'seccomp-bpf/syscall_iterator.h',
137 'seccomp-bpf/trap.cc',
138 'seccomp-bpf/trap.h',
139 'seccomp-bpf/verifier.cc',
140 'seccomp-bpf/verifier.h',
143 '../base/base.gyp:base',
144 'sandbox_services_headers',
147 'SANDBOX_IMPLEMENTATION',
154 'target_name': 'seccomp_bpf_helpers',
155 'type': '<(component)',
157 'seccomp-bpf-helpers/baseline_policy.cc',
158 'seccomp-bpf-helpers/baseline_policy.h',
159 'seccomp-bpf-helpers/sigsys_handlers.cc',
160 'seccomp-bpf-helpers/sigsys_handlers.h',
161 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
162 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
163 'seccomp-bpf-helpers/syscall_sets.cc',
164 'seccomp-bpf-helpers/syscall_sets.h',
167 '../base/base.gyp:base',
171 'SANDBOX_IMPLEMENTATION',
178 # A demonstration program for the seccomp-bpf sandbox.
179 'target_name': 'seccomp_bpf_demo',
181 ['compile_seccomp_bpf_demo==1', {
182 'type': 'executable',
184 'seccomp-bpf/demo.cc',
198 # The setuid sandbox, for Linux
199 'target_name': 'chrome_sandbox',
200 'type': 'executable',
202 'suid/common/sandbox.h',
203 'suid/common/suid_unsafe_environment_variables.h',
206 'suid/process_util.h',
207 'suid/process_util_linux.c',
218 { 'target_name': 'sandbox_services',
219 'type': '<(component)',
221 'services/broker_process.cc',
222 'services/broker_process.h',
223 'services/init_process_reaper.cc',
224 'services/init_process_reaper.h',
225 'services/scoped_process.cc',
226 'services/scoped_process.h',
227 'services/thread_helpers.cc',
228 'services/thread_helpers.h',
233 '../base/base.gyp:base',
236 'SANDBOX_IMPLEMENTATION',
239 ['compile_credentials==1', {
241 'services/credentials.cc',
242 'services/credentials.h',
245 # for capabilities.cc.
246 '../build/linux/system.gyp:libcap',
254 { 'target_name': 'sandbox_services_headers',
257 'services/android_arm_ucontext.h',
258 'services/android_ucontext.h',
259 'services/android_i386_ucontext.h',
260 'services/arm_linux_syscalls.h',
261 'services/linux_syscalls.h',
262 'services/x86_32_linux_syscalls.h',
263 'services/x86_64_linux_syscalls.h',
270 # We make this its own target so that it does not interfere
272 'target_name': 'libc_urandom_override',
273 'type': 'static_library',
275 'services/libc_urandom_override.cc',
276 'services/libc_urandom_override.h',
279 '../base/base.gyp:base',
286 'target_name': 'suid_sandbox_client',
287 'type': '<(component)',
289 'suid/common/sandbox.h',
290 'suid/common/suid_unsafe_environment_variables.h',
291 'suid/client/setuid_sandbox_client.cc',
292 'suid/client/setuid_sandbox_client.h',
295 'SANDBOX_IMPLEMENTATION',
298 '../base/base.gyp:base',
310 'target_name': 'sandbox_linux_unittests_stripped',
312 'dependencies': [ 'sandbox_linux_unittests' ],
314 'action_name': 'strip sandbox_linux_unittests',
315 'inputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests' ],
316 'outputs': [ '<(PRODUCT_DIR)/sandbox_linux_unittests_stripped' ],
317 'action': [ '<(android_strip)', '<@(_inputs)', '-o', '<@(_outputs)' ],
322 # Strategy copied from base_unittests_apk in base/base.gyp.
323 [ 'OS=="android" and gtest_target_type == "shared_library"', {
326 'target_name': 'sandbox_linux_jni_unittests_apk',
329 'test_suite_name': 'sandbox_linux_jni_unittests',
332 'sandbox_linux_jni_unittests',
334 'includes': [ '../../build/apk_test.gypi' ],